Comparing version 1.6.0 to 1.6.1
var tar = require('tar-fs'); | ||
var fs = require('fs'); | ||
var zlib = require('zlib'); | ||
var path = require('path'); | ||
var IGNORE_REGEX = /SOURCES|SPECS|RPMS|SRPMS|\.git/; | ||
module.exports.compress = function (source, target, cb) { | ||
@@ -10,3 +13,3 @@ var gzip = zlib.createGzip(); | ||
ignore: function (name) { | ||
return /SOURCES|SPECS|RPMS|SRPMS/.test(name); | ||
return IGNORE_REGEX.test(path.relative(source, name)); | ||
} | ||
@@ -13,0 +16,0 @@ }); |
{ | ||
"name": "speculate", | ||
"version": "1.6.0", | ||
"version": "1.6.1", | ||
"description": "Automatically generates an RPM Spec file for your Node.js project", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -61,2 +61,3 @@ var _ = require('lodash'); | ||
assert.equal(ignore('SRPMS'), true); | ||
assert.equal(ignore('.git/objects/00'), true); | ||
done(); | ||
@@ -67,2 +68,13 @@ }); | ||
}); | ||
it('does not ignore all artifacts because of full path name', function (done) { | ||
archiver.compress('/tmp/SOURCES', 'tmp.tar.gz', function (err) { | ||
assert.ifError(err); | ||
var ignore = tar.pack.getCall(0).args[1].ignore; | ||
assert.equal(ignore('/tmp/SOURCES/cake/real_file_here'), false); | ||
done(); | ||
}); | ||
writeStream.emit('close'); | ||
}); | ||
}); |
92850
51
703