Permalink
Browse files

Added directory option for archiving in PackageTask.

  • Loading branch information...
mde
mde committed Mar 5, 2012
1 parent 1bbc7ac commit c7b906b60449487c512e62a5d0faeeda061f0c59
Showing with 10 additions and 2 deletions.
  1. +10 −2 lib/package_task.js
View
@@ -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);
}
@@ -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'];
@@ -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});

0 comments on commit c7b906b

Please sign in to comment.