Permalink
Browse files

Minor fixes, jshinting

  • Loading branch information...
1 parent 56f4866 commit 6d0f143414176e5eb5a2ae719b697c3c3e23c93d mde committed May 11, 2013
Showing with 32 additions and 28 deletions.
  1. +4 −2 bin/cli.js
  2. +6 −7 lib/jake.js
  3. +1 −0 lib/loader.js
  4. +3 −2 lib/npm_publish_task.js
  5. +2 −2 lib/parseargs.js
  6. +2 −1 lib/program.js
  7. +1 −1 lib/test_task.js
  8. +7 −8 test/exec.js
  9. +1 −1 test/file_task.js
  10. +1 −0 test/helpers.js
  11. +3 −3 test/namespace.js
  12. +1 −1 test/parseargs.js
View
@@ -17,7 +17,9 @@
*
*/
-var args = process.argv.slice(2)
- , jake = require('../lib/jake');
+// Load `jake` global
+require('../lib/jake');
+
+var args = process.argv.slice(2);
jake.run.apply(jake, args);
View
@@ -16,9 +16,11 @@
*
*/
-var jake
- , EventEmitter = require('events').EventEmitter
- , fs = require('fs')
+var EventEmitter = require('events').EventEmitter;
+// And so it begins
+global.jake = new EventEmitter();
+
+var fs = require('fs')
, path = require('path')
, taskNs = require('./task')
, Task = taskNs.Task
@@ -37,11 +39,7 @@ var Invocation = function (taskName, args) {
this.args = args;
};
-// And so it begins
-jake = new EventEmitter();
-
// Globalize jake and top-level API methods (e.g., `task`, `desc`)
-global.jake = jake;
utils.mixin(global, api);
// Copy utils onto base jake
@@ -154,6 +152,7 @@ utils.mixin(jake, new (function () {
this.createTask = function () {
var args = Array.prototype.slice.call(arguments)
, arg
+ , obj
, task
, type
, name
View
@@ -21,6 +21,7 @@ var path = require('path')
, existsSync = typeof fs.existsSync == 'function' ?
fs.existsSync : path.existsSync
, utils = require('utilities')
+ , CoffeeScript
, Loader;
@@ -46,7 +46,7 @@ NpmPublishTask.prototype = new (function () {
namespace('npm', function () {
task('fetchTags', {async: true}, function () {
// Make sure local tags are up to date
- cmds = [
+ var cmds = [
'git fetch --tags'
];
jake.exec(cmds, function () {
@@ -154,7 +154,8 @@ NpmPublishTask.prototype = new (function () {
});
task('publish', {async: true}, function () {
- var version = getPackageVersionNumber();
+ var version = getPackageVersionNumber()
+ , cmds;
console.log('Publishing ' + self.name + ' v' + version);
cmds = [
'npm publish pkg/' + self.name + '-v' + version + '.tar.gz'
View
@@ -52,7 +52,7 @@ parseargs.Parser.prototype = new function () {
return argParts[1];
}
else {
- return (!args[0] || (args[0].indexOf('-') == 0)) ?
+ return (!args[0] || (args[0].indexOf('-') === 0)) ?
true : args.shift();
}
};
@@ -76,7 +76,7 @@ parseargs.Parser.prototype = new function () {
while (args.length) {
arg = args.shift();
- if (arg.indexOf('-') == 0) {
+ if (arg.indexOf('-') === 0) {
arg = arg.replace(/^--/, '').replace(/^-/, '');
argParts = arg.split('=');
argItem = this.longOpts[argParts[0]] || this.shortOpts[argParts[0]];
View
@@ -190,7 +190,8 @@ Program.prototype = new (function () {
};
this.run = function () {
- var taskNames
+ var rootTask
+ , taskNames
, dirname
, opts = this.opts;
View
@@ -112,7 +112,7 @@ var TestTask = function (name, definition) {
, createTask = function (name, action) {
// If the test-function is defined with a continuation
// param, flag the task as async
- isAsync = !!action.length;
+ var isAsync = !!action.length;
// Define the actual namespaced task with the name, the
// wrapped action, and the correc async-flag
View
@@ -1,9 +1,8 @@
var assert = require('assert')
, h = require('./helpers')
- , jake = {}
, utils = require('../lib/utils');
-utils.mixin(jake, utils);
+utils.mixin(utils, utils);
var tests = {
'before': function () {
@@ -15,15 +14,15 @@ var tests = {
}
, 'test basic exec': function (next) {
- var ex = jake.createExec('ls', function () {})
+ var ex = utils.createExec('ls', function () {})
, evts = { // Events should fire in this order
cmdStart: [0, null]
, stdout: [1, null]
, cmdEnd: [2, null]
, end: [3, null]
}
, incr = 0; // Increment with each event to check order
- assert.ok(ex instanceof jake.Exec);
+ assert.ok(ex instanceof utils.Exec);
var addListenerAndIncrement = function (p) {
ex.addListener(p, function () {
@@ -47,7 +46,7 @@ var tests = {
}
, 'test an exec failure': function (next) {
- var ex = jake.createExec('false', function () {});
+ var ex = utils.createExec('false', function () {});
ex.addListener('error', function (msg, code) {
assert.equal(1, code);
next();
@@ -56,7 +55,7 @@ var tests = {
}
, 'test exec stdout events': function (next) {
- var ex = jake.createExec('echo "foo"', function () {});
+ var ex = utils.createExec('echo "foo"', function () {});
ex.addListener('stdout', function (data) {
assert.equal("foo", h.trim(data.toString()));
next();
@@ -65,7 +64,7 @@ var tests = {
}
, 'test exec stderr events': function (next) {
- var ex = jake.createExec('echo "foo" 1>&2', function () {});
+ var ex = utils.createExec('echo "foo" 1>&2', function () {});
ex.addListener('stderr', function (data) {
assert.equal("foo", h.trim(data.toString()));
next();
@@ -74,7 +73,7 @@ var tests = {
}
, 'test piping results into next command': function (next) {
- var ex = jake.createExec('ls', function () {})
+ var ex = utils.createExec('ls', function () {})
, data
, appended = false;
View
@@ -111,7 +111,7 @@ var tests = {
, 'test nested directory-task': function (next) {
h.exec('../bin/cli.js fileTest:foo/bar/baz/bamf.txt', function (out) {
- data = fs.readFileSync(process.cwd() + '/foo/bar/baz/bamf.txt');
+ var data = fs.readFileSync(process.cwd() + '/foo/bar/baz/bamf.txt');
assert.equal('w00t', data);
cleanUpAndNext(next);
});
View
@@ -17,6 +17,7 @@ var helpers = new (function () {
this.exec = function () {
var args = Array.prototype.slice.call(arguments)
+ , arg
, cmd = args.shift()
, opts = {}
, callback;
View
@@ -1,11 +1,11 @@
+// Load the jake global
+require('../lib/jake');
+
var assert = require('assert')
, h = require('./helpers')
, api = require('../lib/api')
, Namespace = require('../lib/namespace').Namespace;
-var jake = {};
-jake.defaultNamespace = new Namespace('default', null);
-
var tests = {
'before': function() {
process.chdir('./test');
View
@@ -119,7 +119,7 @@ var tests = {
assert.equal(undefined, res.taskName);
}
-, 'test --trace does not expect a value, -f does (throw howdy away)': function () {
+, 'test --trace does not expect a value (equal), -f does (throw howdy away)': function () {
res = p.parse(z('--trace=howdy --jakefile=zoobie'));
assert.equal(true, res.opts.trace);
assert.equal('zoobie', res.opts.jakefile);

0 comments on commit 6d0f143

Please sign in to comment.