Skip to content

Commit

Permalink
fixes #84
Browse files Browse the repository at this point in the history
  • Loading branch information
gojko committed Nov 11, 2016
1 parent 47e540e commit a880734
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
20 changes: 17 additions & 3 deletions spec/collect-files-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,21 @@ describe('collectFiles', function () {
expect(fs.readFileSync(path.join(packagePath, 'excluded.txt'), 'utf8')).toEqual('excl1');
}).then(done, done.fail);
});
it('works with folders containing a space', function (done) {
var oldsource = sourcedir;
sourcedir = oldsource + ' with space';
shell.mv(oldsource, sourcedir);
configurePackage({name: 'test123'});
underTest(sourcedir).then(function (packagePath) {
destdir = packagePath;
expect(isSameDir(path.dirname(packagePath), os.tmpdir())).toBeTruthy();
expect(fs.readFileSync(path.join(packagePath, 'root.txt'), 'utf8')).toEqual('text1');
expect(fs.readFileSync(path.join(packagePath, 'subdir', 'sub.txt'), 'utf8')).toEqual('text2');
expect(fs.readFileSync(path.join(packagePath, 'excluded.txt'), 'utf8')).toEqual('excl1');
sourcedir = oldsource;
}).then(done, done.fail);
});

it('logs progress', function (done) {
var logger = new ArrayLogger();
configurePackage({
Expand All @@ -326,11 +341,10 @@ describe('collectFiles', function () {
}
});
underTest(sourcedir, false, logger).then(function () {
var npmPath = shell.which('npm');
expect(logger.getCombinedLog()).toEqual([
['stage', 'packaging files'],
['call', npmPath + ' pack ' + sourcedir],
['call', npmPath + ' install --production']
['call', 'npm pack "' + sourcedir + '"'],
['call', 'npm install --production']
]);
}).then(done, done.fail);
});
Expand Down
2 changes: 1 addition & 1 deletion src/tasks/collect-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module.exports = function collectFiles(sourcePath, useLocalDependencies, optiona
targetDir = tmppath(),
expectedName = expectedArchiveName(packageConfig);
shell.mkdir('-p', packDir);
return runNpm(packDir, 'pack ' + path.resolve(sourcePath), logger).then(function () {
return runNpm(packDir, 'pack "' + path.resolve(sourcePath) + '"', logger).then(function () {
return extractTarGz(path.join(packDir, expectedName), packDir);
}).then(function () {
shell.mv(path.join(packDir, 'package'), targetDir);
Expand Down

0 comments on commit a880734

Please sign in to comment.