Skip to content

Commit

Permalink
Added directory option for archiving in PackageTask.
Browse files Browse the repository at this point in the history
  • Loading branch information
mde committed Mar 5, 2012
1 parent 1bbc7ac commit c7b906b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/package_task.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ var PackageTask = function (name, version, definition) {
this.needTarBz2 = false;
this.needJar = false;
this.needZip = false;
this.manifestFile = null;
this.tarCommand = 'tar';
this.jarCommand = 'jar';
this.zipCommand = 'zip';
this.archiveDirectory = null;
if (typeof definition == 'function') {
definition.call(this);
}
Expand Down Expand Up @@ -101,7 +103,8 @@ PackageTask.prototype = new (function () {
var cmd
, opts = _compressOpts[p];

// Move into the package dir to compress
// Move into the package dir to compress (see below, after
// exec)
process.chdir(self.packageDir);

cmd = self[opts.cmd + 'Command'];
Expand All @@ -113,13 +116,18 @@ PackageTask.prototype = new (function () {
if (opts.cmd == 'jar' && self.manifestFile) {
cmd += ' ' + self.manifestFile;
}
if (self.archiveDirectory) {
cmd += ' -C ' + self.archiveDirectory;
}
cmd += ' ' + self.packageName();

exec(cmd, function (err, stdout, stderr) {
if (err) { throw err; }

// Return back up to the project directory
// Return back up to the project directory (see above,
// before exec)
process.chdir(currDir);

complete();
});
}, {async: true});
Expand Down

0 comments on commit c7b906b

Please sign in to comment.