Comparing version 0.2.3 to 0.2.6
@@ -61,3 +61,3 @@ #!/usr/bin/env node | ||
jake.PackageTask = require(libPath + '/package_task').PackageTask; | ||
jake.NpmPublisTask = require(libPath + '/npm_publish_task').NpmPublishTask; | ||
jake.NpmPublishTask = require(libPath + '/npm_publish_task').NpmPublishTask; | ||
@@ -64,0 +64,0 @@ // Enhance env with any env vars passed in |
@@ -195,4 +195,6 @@ /* | ||
jake.Task = Task; | ||
jake.FileTask = FileTask; | ||
jake.DirectoryTask = DirectoryTask; | ||
jake.Namespace = Namespace; | ||
module.exports = jake; |
@@ -32,2 +32,8 @@ /* | ||
var getPackageVersionNumber = function () { | ||
pkg = JSON.parse(fs.readFileSync(process.cwd() + '/package.json').toString()) | ||
version = pkg.version | ||
return version; | ||
}; | ||
this.define = function () { | ||
@@ -50,3 +56,3 @@ var self = this; | ||
task('definePackage', function () { | ||
var version = jake.getPackageVersionNumber() | ||
var version = getPackageVersionNumber() | ||
, t; | ||
@@ -62,3 +68,3 @@ t = new jake.PackageTask(self.name, 'v' + version, function () { | ||
, pack = jake.Task['package'] | ||
, version = jake.getPackageVersionNumber(); | ||
, version = getPackageVersionNumber(); | ||
// May have already been run | ||
@@ -77,3 +83,3 @@ definePack.reenable(true); | ||
task('publish', function () { | ||
var version = jake.getPackageVersionNumber(); | ||
var version = getPackageVersionNumber(); | ||
console.log('Publishing ' + self.name + ' v' + version); | ||
@@ -93,9 +99,15 @@ cmds = [ | ||
}, {async: true}); | ||
task('cleanup', function () { | ||
jake.exec('rm -fr ./pkg', function () { | ||
console.log('Cleaned up package'); | ||
complete(); | ||
}); | ||
}, {async: true}); | ||
}); | ||
desc('Bump version-number, package, and publish to NPM.'); | ||
task('publish', ['npm:version', 'npm:package', | ||
'npm:publish'], function () {}); | ||
'npm:publish', 'npm:cleanup'], function () {}); | ||
}; | ||
@@ -102,0 +114,0 @@ |
@@ -21,3 +21,2 @@ /* | ||
var exec = require('child_process').exec | ||
, fs = require('fs') | ||
, utils; | ||
@@ -62,10 +61,85 @@ | ||
this.getPackageVersionNumber = function () { | ||
pkg = JSON.parse(fs.readFileSync(process.cwd() + '/package.json').toString()) | ||
version = pkg.version | ||
return version; | ||
var _mix = function (targ, src, merge, includeProto) { | ||
for (var p in src) { | ||
// Don't copy stuff from the prototype | ||
if (src.hasOwnProperty(p) || includeProto) { | ||
if (merge && | ||
// Assumes the source property is an Object you can | ||
// actually recurse down into | ||
(typeof src[p] == 'object') && | ||
(src[p] !== null) && | ||
!(src[p] instanceof Array)) { | ||
// Create the source property if it doesn't exist | ||
// TODO: What if it's something weird like a String or Number? | ||
if (typeof targ[p] == 'undefined') { | ||
targ[p] = {}; | ||
} | ||
_mix(targ[p], src[p], merge, includeProto); // Recurse | ||
} | ||
// If it's not a merge-copy, just set and forget | ||
else { | ||
targ[p] = src[p]; | ||
} | ||
} | ||
} | ||
}; | ||
this.objectToString = function (object) { | ||
var objectArray = []; | ||
for (var key in object) { | ||
if ('object' == typeof object[key]) { | ||
objectArray.push(this.objectToString(object[key])); | ||
} else { | ||
objectArray.push(key + '=' + object[key]); | ||
} | ||
} | ||
return objectArray.join(', '); | ||
}; | ||
/* | ||
* Mix in the properties on an object to another object | ||
* yam.mixin(target, source, [source,] [source, etc.] [merge-flag]); | ||
* 'merge' recurses, to merge object sub-properties together instead | ||
* of just overwriting with the source object. | ||
*/ | ||
this.mixin = (function () { | ||
return function () { | ||
var args = Array.prototype.slice.apply(arguments), | ||
merge = false, | ||
targ, sources; | ||
if (args.length > 2) { | ||
if (typeof args[args.length - 1] == 'boolean') { | ||
merge = args.pop(); | ||
} | ||
} | ||
targ = args.shift(); | ||
sources = args; | ||
for (var i = 0, ii = sources.length; i < ii; i++) { | ||
_mix(targ, sources[i], merge); | ||
} | ||
return targ; | ||
}; | ||
}).call(this); | ||
this.enhance = (function () { | ||
return function () { | ||
var args = Array.prototype.slice.apply(arguments), | ||
merge = false, | ||
targ, sources; | ||
if (args.length > 2) { | ||
if (typeof args[args.length - 1] == 'boolean') { | ||
merge = args.pop(); | ||
} | ||
} | ||
targ = args.shift(); | ||
sources = args; | ||
for (var i = 0, ii = sources.length; i < ii; i++) { | ||
_mix(targ, sources[i], merge, true); | ||
} | ||
return targ; | ||
}; | ||
}).call(this); | ||
})(); | ||
module.exports = utils; |
{ | ||
"name": "jake", | ||
"version": "0.2.3", | ||
"version": "0.2.6", | ||
"author": "Matthew Eernisse <mde@fleegix.org> (http://fleegix.org)", | ||
@@ -5,0 +5,0 @@ "bin": { |
@@ -128,2 +128,8 @@ ### Jake -- JavaScript build tool for Node.js | ||
A Task is also an EventEmitter which emits the 'complete' event when it is | ||
finished. This allows asynchronous tasks to be run from within other asked via | ||
either `invoke` or `execute`, and ensure they will complete before the rest of | ||
the containing task executes. See the section "Running tasks from within other | ||
tasks," below. | ||
### File-tasks | ||
@@ -256,4 +262,21 @@ | ||
It will only run the task once, even if you call `invoke` repeatedly. | ||
Tasks are EventEmitters. If the inner-task invoked is asynchronous, you can set | ||
a listener on the 'complete' event to run any code that depends on it. | ||
desc('Calls the async foo:baz task and its prerequisites.'); | ||
task('invokeFooBaz', function () { | ||
var t = jake.Task['foo:baz']; | ||
t.addListener('complete', function () { | ||
console.log('Finished executing foo:baz'); | ||
// Maybe run some other code | ||
// ... | ||
// Complete the containing task | ||
complete(); | ||
}); | ||
// Kick off foo:baz | ||
t.invoke(); | ||
}, {async: true}); | ||
The `invoke` method will only run the task once, even if you call it repeatedly. | ||
desc('Calls the foo:bar task and its prerequisites.'); | ||
@@ -450,3 +473,3 @@ task('invokeFooBar', function () { | ||
The NpmPublisTask will automatically create a `publish` task which performs the | ||
The NpmPublishTask will automatically create a `publish` task which performs the | ||
following steps: | ||
@@ -460,2 +483,3 @@ | ||
6. Publish it to NPM | ||
7. Clean up the package | ||
@@ -462,0 +486,0 @@ ### CoffeeScript Jakefiles |
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
85282
23
1871
531
18