Comparing version 0.2.23 to 0.2.24
@@ -33,3 +33,6 @@ /* | ||
this.needTarBz2 = false; | ||
this.needJar = false; | ||
this.needZip = false; | ||
this.tarCommand = 'tar'; | ||
this.jarCommand = 'jar'; | ||
this.zipCommand = 'zip'; | ||
@@ -47,12 +50,25 @@ if (typeof definition == 'function') { | ||
ext: '.tgz' | ||
, flag: 'z' | ||
, flags: 'cvzf' | ||
, cmd: 'tar' | ||
} | ||
, TarGz: { | ||
ext: '.tar.gz' | ||
, flag: 'z' | ||
, flags: 'cvzf' | ||
, cmd: 'tar' | ||
} | ||
, TarBz2: { | ||
ext: '.tar.bz2' | ||
, flag: 'j' | ||
, flags: 'cvjf' | ||
, cmd: 'tar' | ||
} | ||
, Jar: { | ||
ext: '.jar' | ||
, flags: 'cf' | ||
, cmd: 'jar' | ||
} | ||
, Zip: { | ||
ext: '.zip' | ||
, flags: 'r' | ||
, cmd: 'zip' | ||
} | ||
}; | ||
@@ -87,9 +103,22 @@ | ||
file(filename, [packageDirPath], function () { | ||
var opts = _compressOpts[p]; | ||
var cmd | ||
, opts = _compressOpts[p]; | ||
// Move into the package dir to compress | ||
process.chdir(self.packageDir); | ||
var cmd = self.tarCommand + ' -' + opts.flag + 'cvf ' + | ||
self.packageName() + opts.ext + ' ' + self.packageName(); | ||
cmd = self[opts.cmd + 'Command']; | ||
cmd += ' -' + opts.flags; | ||
if (opts.cmd == 'jar' && self.manifestFile) { | ||
cmd += 'm'; | ||
} | ||
cmd += ' ' + self.packageName() + opts.ext; | ||
if (opts.cmd == 'jar' && self.manifestFile) { | ||
cmd += ' ' + self.manifestFile; | ||
} | ||
cmd += ' ' + self.packageName(); | ||
exec(cmd, function (err, stdout, stderr) { | ||
if (err) { throw err; } | ||
// Return back up to the project directory | ||
@@ -96,0 +125,0 @@ process.chdir(currDir); |
@@ -87,2 +87,3 @@ var fs = require('fs') | ||
this.updateModTime(); | ||
this._currentPrereqIndex = 0; | ||
this.done = true; | ||
@@ -89,0 +90,0 @@ this.emit('complete'); |
@@ -198,2 +198,3 @@ var fs = require('fs') | ||
this.complete = function () { | ||
this._currentPrereqIndex = 0; | ||
this.done = true; | ||
@@ -200,0 +201,0 @@ this.emit('complete'); |
@@ -10,3 +10,3 @@ { | ||
], | ||
"version": "0.2.23", | ||
"version": "0.2.24", | ||
"author": "Matthew Eernisse <mde@fleegix.org> (http://fleegix.org)", | ||
@@ -13,0 +13,0 @@ "bin": { |
@@ -435,8 +435,31 @@ ### Jake -- JavaScript build tool for Node.js | ||
### File-utils | ||
Since shelling out in Node is an asynchronous operation, Jake comes with a few | ||
useful blocking file-utilities that make scripting easier. | ||
The `jake.mkdirP` utility recursively creates a set of nested directories. It | ||
will not throw an error if any of the directories already exists. Here's an example: | ||
```javascript | ||
jake.mkdirP('app/views/layouts'); | ||
``` | ||
The `jake.cpR` utility does a synchronous, recursive copy of a file or | ||
directory. It takes two arguments, the file/directory to copy, and the | ||
destination. Note that this command can only copy files and directories; it does | ||
not perform globbing (so arguments like '*.txt' are not possible). | ||
```javascript | ||
jake.cpR(path.join(sourceDir, '/templates'), currentDir); | ||
``` | ||
This would copy 'templates' (and all its contents) into `currentDir`. | ||
### Running shell-commands with `jake.exec` | ||
Since shelling out in Node is an asynchronous operation, Jake provides a utility | ||
function for running a sequence of shell-commands. The `jake.exec` command takes | ||
an array of shell-command strings, and a final callback to run after completing | ||
them. Here's an example from Jake's Jakefile, that runs the tests: | ||
Jake also provides a more general utility function for running a sequence of | ||
shell-commands. The `jake.exec` command takes an array of shell-command strings, | ||
and a final callback to run after completing them. Here's an example from Jake's | ||
Jakefile, that runs the tests: | ||
@@ -443,0 +466,0 @@ ```javascript |
@@ -105,2 +105,10 @@ var assert = require('assert') | ||
this.testPrereqIndexReset = function () { | ||
h.exec('../bin/cli.js hoge:kira', function (out) { | ||
assert.equal('hoge:hoge task\nhoge:piyo task\nhoge:fuga task\n' + | ||
'hoge:charan task\nhoge:gero task\nhoge:kira task', out); | ||
}); | ||
h.next(); | ||
}; | ||
})(); | ||
@@ -107,0 +115,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
105983
2428
629