-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathbundler.js
More file actions
26 lines (25 loc) · 923 Bytes
/
bundler.js
File metadata and controls
26 lines (25 loc) · 923 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
var fs = require('fs');
module.exports = {
// This is how you would bundle a NODE.JS project...
// A generic solution would be to use git-archive;
// See https://github.com/Strider-CD/strider-ssh-deploy/issues/2
bundleProject: function(dataDir, name, progress, done) {
var bundlePath = '/tmp/'+name+'.tar.gz';
var progstream = require('progress-stream');
progressEmitter = progstream({ time:1000 });
progressEmitter.on('progress', progress);
require('npmd-pack')(dataDir, {})
.pipe(progressEmitter)
.pipe(fs.createWriteStream(bundlePath)).on('finish', function() {
fs.exists(bundlePath, function(yes) {
if (yes)
done(null, bundlePath)
else
done(new Error("Failed to create project bundle"));
})
});
},
untarCmd: function(bundlePath, extractDir) {
return 'tar -zxf '+bundlePath+' -C '+extractDir+' --strip-components=1';
}
}