Socket
Socket
Sign inDemoInstall

jake

Package Overview
Dependencies
0
Maintainers
1
Versions
166
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.22 to 0.2.2

lib/npm_publish_task.js

22

bin/cli.js

@@ -32,3 +32,4 @@ #!/usr/bin/env node

, opts
, envVars;
, envVars
, taskNames;

@@ -54,8 +55,11 @@ jake.version = pkg.version;

jake.exec = utils.exec;
// Convenience aliases
jake.opts = opts;
for (var p in utils) {
jake[p] = utils[p];
}
jake.FileList = require(libPath + '/file_list').FileList;
jake.PackageTask = require(libPath + '/package_task').PackageTask;
jake.NpmPublisTask = require(libPath + '/npm_publish_task').NpmPublishTask;
// Get convenient refs to FileList, PackageTask
jake.FileList = require(libPath + '/file_list').FileList
jake.PackageTask = require(libPath + '/package_task').PackageTask
// Enhance env with any env vars passed in

@@ -72,3 +76,5 @@ for (var p in envVars) { process.env[p] = envVars[p]; }

jake.parseAllTasks();
taskNames = program.taskNames;
taskNames = taskNames.length ? taskNames : ['default'];
task('__root__', taskNames, function () {});

@@ -79,5 +85,5 @@ if (opts.tasks) {

else {
jake.runTask(program.taskName || 'default', program.taskArgs, true);
jake.Task['__root__'].invoke();
}
}

@@ -58,3 +58,6 @@ /*

this.complete = function () {
jake.runNextTask();
var current = jake._invocationChain.pop();
if (current) {
current.complete();
}
};

@@ -61,0 +64,0 @@

@@ -21,63 +21,8 @@ /*

, fs = require('fs')
, path = require('path');
, path = require('path')
, task = require('./task')
, Task = task.Task
, FileTask = task.FileTask
, DirectoryTask = task.DirectoryTask;
/**
* @constructor
* A Jake task
*/
var Task = function () {
this.constructor.prototype.initialize.apply(this, arguments);
};
Task.prototype = new (function () {
this.initialize = function (name, prereqs, action, options, type) {
var opts = options || {};
this.name = name;
this.prereqs = prereqs;
this.action = action;
//this.async = (async === true);
this.async = false;
this.type = type;
this.done = false;
this.fullName = null;
this.desription = null;
// Support legacy async-flag -- if not explicitly passed or falsy, will
// be set to empty-object
if (typeof opts == 'boolean' && opts === true) {
this.async = true;
}
else {
if (opts.async) {
this.async = true;
}
}
};
this.invoke = function () {
jake.runTask(this.fullName, arguments, true);
};
this.execute = function () {
jake.reenableTask(this.fullName, false);
jake.runTask(this.fullName, arguments, false);
};
this.reenable = function (deep) {
jake.reenableTask(this.fullName, deep);
};
})();
Task.prototype.constructor = Task;
var FileTask = function (name, prereqs, action, opts, type) {
this.constructor.prototype.initialize.apply(this, arguments);
};
FileTask.prototype = new Task();
FileTask.prototype.constructor = FileTask;
var DirectoryTask = function (name, prereqs, action, opts, type) {
this.constructor.prototype.initialize.apply(this, arguments);
};
DirectoryTask.prototype = new Task();
DirectoryTask.prototype.constructor = DirectoryTask;
var Namespace = function (name, parentNamespace) {

@@ -101,79 +46,9 @@ this.name = name;

this._invocationChain = [];
// Private variables
// =================
// Local reference for scopage
var _this = this
var self = this;
, _taskIndex = 0
, _modTimes = {}
, _workingTaskList = []
// The list of tasks/prerequisites to run, parsed recursively
// and run bottom-up, so prerequisites run first
, _taskList = []
// A dictionary of loaded tasks, to ensure that all tasks
// run once and only once
, _taskDict = {};
// The args passed to the 'jake' invocation, after the task name
// Private functions
// =================
/**
* Crockfordian Array-test
* @param {???} obj A value of indeterminate type that may
* or may not be an Array
*/
var _isArray = function (obj) {
return obj &&
typeof obj === 'object' &&
typeof obj.length === 'number' &&
typeof obj.splice === 'function' &&
!(obj.propertyIsEnumerable('length'));
}
, _mixin = function (t, f) {
for (var p in f) {
t[p] = f[p];
}
return t;
}
/**
* Tells us if the task has any prerequisites
* @param {Array.<String>} prereqs An array of prerequisites
* @return {Boolean} true if prereqs is a non-empty Array
*/
, _taskHasPrereqs = function (prereqs) {
return !!(prereqs && _isArray(prereqs) && prereqs.length);
}
/**
* Parses all prerequisites of a task (and their prerequisites, etc.)
* recursively -- depth-first, so prereqs run first
* @param {String} name The name of the current task whose
* prerequisites are being parsed.
* @param {Boolean} [isRoot] Is this the root task of a prerequisite tree or not
* @param {Boolean} [includePrereqs] Whether or not to descend into prerequs
*/
, _parsePrereqs = function (name, opts) {
var task = _this.getTask(name)
, includePrereqs = opts.includePrereqs || false
, isRoot = opts.isRoot || false
, args = opts.args
, prereqs = task ? task.prereqs : [];
// No task found -- if it's the root, throw, because we know that
// *should* be an existing task. Otherwise it could be a file prereq
if (isRoot && !task) {
throw new Error('Task "' + name + '" not found.');
}
else {
if (includePrereqs && _taskHasPrereqs(prereqs)) {
for (var i = 0, ii = prereqs.length; i < ii; i++) {
_parsePrereqs(prereqs[i], {isRoot: false, includePrereqs: includePrereqs});
}
}
_workingTaskList.push(new Invocation(name, args));
}
};
// Public properties

@@ -193,195 +68,2 @@ // =================

this.createTree = function (name, opts) {
_parsePrereqs(name, opts);
};
/**
* Initial function called to run the specified task. Parses all the
* prerequisites and then kicks off the queue-processing
* @param {String} name The name of the task to run
* @param {Array} args The list of command-line args passed after
* the task name -- may be a combination of plain positional args,
* or name/value pairs in the form of name:value or name=value to
* be placed in a final keyword/value object param
*/
this.runTask = function (name, args, includePrereqs) {
this.createTree(name, {isRoot: true, includePrereqs: includePrereqs, args: args});
_taskList.splice.apply(_taskList, [_taskIndex, 0].concat(_workingTaskList));
_workingTaskList = [];
this.runNextTask();
};
this.reenableTask = function (name, includePrereqs) {
var invocation
, task;
_parsePrereqs(name, {isRoot: true, includePrereqs: includePrereqs});
if (!_workingTaskList.length) {
fail('No tasks to reenable.');
}
else {
for (var i = 0, ii = _workingTaskList.length; i < ii; i++) {
invocation = _workingTaskList[i];
task = this.getTask(invocation.taskName);
task.done = false;
}
}
_workingTaskList = [];
};
/**
* Looks up a function object based on its name or namespace:name
* @param {String} name The name of the task to look up
*/
this.getTask = function (name) {
var nameArr = name.split(':')
, taskName = nameArr.pop()
, ns = jake.defaultNamespace
, currName;
while (nameArr.length) {
currName = nameArr.shift();
ns = ns.childNamespaces[currName];
if(typeof ns === "undefined" || ns === null) {
fail('Cannot find the namespace "' + currName + '" for task "' + name + '".');
}
}
var task = ns.tasks[taskName];
return task;
};
/**
* Runs the next task in the _taskList queue until none are left
* Synchronous tasks require calling "complete" afterward, and async
* ones are expected to do that themselves
* TODO Add a cancellable error-throw in a setTimeout to allow
* an async task to timeout instead of having the script hang
* indefinitely
*/
this.runNextTask = function () {
var invocation = _taskList[_taskIndex]
, name
, task
, args
, prereqs
, prereqName
, prereqTask
, actionRan
, stats
, modTime;
// Finalize the mod-time of the previously processed file-task, if any
if (_taskIndex > 0) {
name = _taskList[_taskIndex - 1].taskName;
task = this.getTask(name);
if (task instanceof FileTask) {
// The action may have created/modified the file
// ---------
// If there's a valid file at the end of running the task,
// use its mod-time as last modified
try {
stats = fs.statSync(task.name);
modTime = stats.ctime;
}
// If there's still no actual file after running the file-task,
// treat this simply as a plain task -- the current time will be
// the mod-time for anything that depends on this file-task
catch (e) {
modTime = new Date();
}
_modTimes[name] = modTime;
}
}
// If there are still tasks to run, do it
if (invocation) {
name = invocation.taskName;
args = invocation.args;
_taskIndex++;
task = this.getTask(name);
// Task, FileTask, DirectoryTask
if (task) {
prereqs = task.prereqs;
// Run tasks only once, even if it ends up in the task queue multiple times
if (task.done) {
complete();
}
// Okie, we haven't done this one
else {
// Flag this one as done, no repeatsies
task.done = true;
if (task instanceof FileTask) {
try {
stats = fs.statSync(task.name);
modTime = stats.ctime;
}
catch (e) {
// Assume there's a task to fall back to to generate the file
}
// Compare mod-time of all the prereqs with the mod-time of this task
if (prereqs.length) {
actionRan = false;
for (var i = 0, ii = prereqs.length; i < ii; i++) {
prereqName = prereqs[i];
prereqTask = this.getTask(prereqName);
// Run the action if:
// 1. The prereq is a normal task
// 2. A file/directory task with a mod-date more recent than
// the one for this file (or this file doesn't exist yet)
if ((prereqTask && !(prereqTask instanceof FileTask || prereqTask instanceof DirectoryTask))
|| (!modTime || _modTimes[prereqName] >= modTime)) {
actionRan = true;
if (typeof task.action == 'function') {
task.action.apply(task, args || []);
}
break;
}
}
}
else {
if (typeof task.action == 'function') {
task.action.apply(task, args || []);
modTime = new Date();
}
}
_modTimes[name] = modTime;
// Async tasks whose action has actually run call this themselves
if (!task.async || !actionRan) {
complete();
}
}
else {
// Run this mofo
if (typeof task.action == 'function') {
task.action.apply(task, args || []);
}
// Async tasks call this themselves
if (!task.async) {
complete();
}
}
}
}
// Task doesn't exist; assume file. Just get the mod-time if the file
// actually exists. If it doesn't exist, we're dealing with a missing
// task -- just blow up
else {
stats = fs.statSync(name);
_modTimes[name] = stats.ctime;
complete();
}
}
};
this.parseAllTasks = function () {

@@ -410,2 +92,3 @@ var _parseNs = function (name, ns) {

};
/**

@@ -466,3 +149,3 @@ * Displays the list of descriptions avaliable for tasks defined in

name = args.shift();
if (_isArray(args[0])) {
if (Array.isArray(args[0])) {
prereqs = args.shift();

@@ -487,16 +170,17 @@ }

if (type == 'directory') {
action = function () {
if (!path.existsSync(name)) {
fs.mkdirSync(name, 0755);
}
};
task = new DirectoryTask(name, prereqs, action, opts, type);
switch (type) {
case 'directory':
action = function () {
if (!path.existsSync(name)) {
fs.mkdirSync(name, 0755);
}
};
task = new DirectoryTask(name, prereqs, action, opts);
break;
case 'file':
task = new FileTask(name, prereqs, action, opts);
break;
default:
task = new Task(name, prereqs, action, opts);
}
else if (type == 'file') {
task = new FileTask(name, prereqs, action, opts, type);
}
else {
task = new Task(name, prereqs, action, opts, type);
}

@@ -508,2 +192,6 @@ if (jake.currentTaskDescription) {

jake.currentNamespace.tasks[name] = task;
// FIXME: Should only need to add a new entry for the current
// task-definition, not reparse the entire structure
jake.parseAllTasks();
};

@@ -510,0 +198,0 @@

@@ -61,7 +61,8 @@ /*

, packageDirPath = this.packageDirPath()
, taskObj = {}
, compressTaskArr = [];
desc('Force a rebuild of the package')
task({'repackage': ['clobberPackage', 'package']});
desc('Build the package for distribution');
task('package', ['clobberPackage', 'buildPackage']);
// Backward-compat alias
task('repackage', ['package']);

@@ -73,6 +74,6 @@ task('clobberPackage', function () {

});
}, true);
}, {async: true});
desc('Remove the package')
task({'clobber': ['clobberPackage']});
task('clobber', ['clobberPackage']);

@@ -82,8 +83,7 @@ for (var p in _compressOpts) {

(function (p) {
var filename = self.packageDir + '/' + self.packageName() + _compressOpts[p].ext
, taskObj = {};
var filename = self.packageDir + '/' + self.packageName() +
_compressOpts[p].ext;
compressTaskArr.push(filename);
taskObj[filename] = [packageDirPath];
file(taskObj, function () {
file(filename, [packageDirPath], function () {
var opts = _compressOpts[p];

@@ -100,3 +100,3 @@ // Move into the package dir to compress

});
}, true);
}, {async: true});
})(p);

@@ -106,9 +106,8 @@ }

desc('Build the package for distribution');
task({'package': compressTaskArr}, function () {});
task('buildPackage', compressTaskArr, function () {});
directory(this.packageDir);
taskObj[packageDirPath] = [this.packageDir].concat(self.packageFiles.toArray());
file(taskObj, function () {
file(packageDirPath,
[this.packageDir].concat(self.packageFiles.toArray()), function () {
var fileList = [];

@@ -152,3 +151,3 @@ self.packageFiles.forEach(function (name) {

_copyFile();
}, true);
}, {async: true});

@@ -155,0 +154,0 @@

@@ -31,4 +31,3 @@ /*

this.opts = {};
this.taskName = null;
this.taskArgs = null;
this.taskNames = null;
this.envVars = null;

@@ -75,5 +74,3 @@

, cmdItems
, taskArr
, taskName
, taskArgs
, taskNames = []
, preempt;

@@ -89,3 +86,3 @@

if (argItem) {
// First-encountered preemptive opt take precedence -- no further opts
// First-encountered preemptive opt takes precedence -- no further opts
// or possibility of ambiguity, so just look for a value, or set to

@@ -98,5 +95,5 @@ // true and then bail

}
// If we find more opts, throw away any previous args that
// didn't serve as a val
cmds = [];
// If the opt requires a value, see if we can get a value from the
// next arg, or infer true from no-arg -- if it's followed by another
// opt, throw an error
if (argItem.expectValue) {

@@ -114,3 +111,3 @@ opts[argItem.full] = _trueOrNextVal(argParts, args);

else {
cmds.push(arg);
cmds.unshift(arg);
}

@@ -127,23 +124,13 @@ }

else {
taskName = cmd;
break;
taskNames.push(cmd);
}
}
// Parse any positional args attached to the task-name
if (taskName) {
taskArr = taskName.split('[');
taskName = taskArr[0];
// Parse any task-args
if (taskArr[1]) {
taskArgs = taskArr[1].replace(/\]$/, '');
taskArgs = taskArgs.split(',');
}
}
}
this.opts = opts
this.envVars = envVars;
this.taskName = taskName;
this.taskArgs = taskArgs;
return {
opts: opts
, envVars: envVars
, taskNames: taskNames
};
};

@@ -150,0 +137,0 @@

@@ -37,2 +37,7 @@ /*

}
, { full: 'always-make'
, abbr: 'B'
, preempts: false
, expectValue: false
}
, { full: 'tasks'

@@ -76,2 +81,3 @@ , abbr: 'T'

+ ' -C, --directory DIRECTORY Change to DIRECTORY before running tasks.\n'
+ ' -B, --always-make Unconditionally make all targets.\n'
+ ' -T, --tasks Display the tasks, with descriptions, then exit.\n'

@@ -85,3 +91,3 @@ + ' -t, --trace Enable full backtrace.\n'

this.opts = {};
this.taskName = null;
this.taskNames = null;
this.taskArgs = null;

@@ -112,12 +118,6 @@ this.envVars = null;

this.parseArgs = function (args) {
var parser = new parseargs.Parser(optsReg)
, arr = ['opts', 'taskName', 'taskArgs', 'envVars']
, arrItem
parser.parse(args);
for (i = 0, ii = arr.length; i < ii; i++) {
arrItem = arr[i];
this[arrItem] = parser[arrItem];
}
var result = (new parseargs.Parser(optsReg)).parse(args);
this.opts = result.opts;
this.taskNames = result.taskNames;
this.envVars = result.envVars;
};

@@ -124,0 +124,0 @@

@@ -21,6 +21,10 @@ /*

var exec = require('child_process').exec
, utils = new (function () {
, fs = require('fs')
, utils;
utils = new (function () {
this.exec = function (arr, callback, opts) {
var options = opts || {}
, list = arr.slice()
, stdout = options.stdout

@@ -30,30 +34,38 @@ , stderr = options.stderr

options.breakOnError : true
var run = function (cmd) {
exec(cmd, function (err, stdout, stderr) {
var next;
if (err && breakOnError) {
this.fail('Error: ' + JSON.stringify(err));
}
if (stderr && options.stderr) {
console.log('Error: ' + stderr);
}
if (stdout && options.stdout) {
console.log(stdout);
}
next = arr.shift();
if (next) {
run(next);
}
else {
if (callback) {
callback();
, run;
run = function () {
var next = list.shift();
if (next) {
exec(next, function (err, stdout, stderr) {
if (err && breakOnError) {
this.fail('Error: ' + JSON.stringify(err));
}
if (stderr && options.stderr) {
console.log('Error: ' + stderr);
}
if (stdout && options.stdout) {
console.log(stdout);
}
run();
});
}
else {
if (callback) {
callback();
}
});
}
};
run(arr.shift());
run();
};
this.getPackageVersionNumber = function () {
pkg = JSON.parse(fs.readFileSync(process.cwd() + '/package.json').toString())
version = pkg.version
return version;
};
})();
module.exports = utils;

@@ -1,11 +0,19 @@

{ "name": "jake"
, "version": "0.1.22"
, "author": "Matthew Eernisse <mde@fleegix.org> (http://fleegix.org)"
, "bin": { "jake": "./bin/cli.js" }
, "main": "./lib"
, "repository": {
"type": "git"
, "url": "https://github.com/mde/jake.git"
{
"name": "jake",
"version": "0.2.2",
"author": "Matthew Eernisse <mde@fleegix.org> (http://fleegix.org)",
"bin": {
"jake": "./bin/cli.js"
},
"main": "./lib",
"repository": {
"type": "git",
"url": "git://github.com/mde/jake.git"
},
"preferGlobal": true,
"dependencies": {},
"devDependencies": {},
"engines": {
"node": "*"
}
, "preferGlobal": true
}
}

@@ -15,2 +15,14 @@ ### Jake -- JavaScript build tool for Node.js

By default Jake is installed in "/usr/local." To install it into a
different directory (e.g., one that doesn't require super-user
privilege), pass the PREFIX variable to the `make install` command.
For example, to install it into a "jake" directory in your home
directory, you could use this:
make && make install PREFIX=~/jake
If do you install Jake somewhere special, you'll need to add the
"bin" directory in the install target to your PATH to get access
to the `jake` executable.
### Installing with [NPM](http://npmjs.org/)

@@ -124,2 +136,4 @@

This task will create the directory when used as a prerequisite for a file-task, or when run from the command-line.
### Namespaces

@@ -245,3 +259,3 @@

If you want to run the task and its prerequisites more than once, you can use `invoke` with the `re-enable` method.
If you want to run the task and its prerequisites more than once, you can use `invoke` with the `reenable` method.

@@ -255,7 +269,7 @@ desc('Calls the foo:bar task and its prerequisites.');

// Only re-runs foo:bar, but not its prerequisites
jake.Task['foo:bar'].re-enable();
jake.Task['foo:bar'].reenable();
jake.Task['foo:bar'].invoke();
});
The `re-enable` method takes a single Boolean arg, a 'deep' flag, which reenables the task's prerequisites if set to true.
The `reenable` method takes a single Boolean arg, a 'deep' flag, which reenables the task's prerequisites if set to true.

@@ -269,3 +283,3 @@ desc('Calls the foo:bar task and its prerequisites.');

// Only re-runs foo:bar, but not its prerequisites
jake.Task['foo:bar'].re-enable(true);
jake.Task['foo:bar'].reenable(true);
jake.Task['foo:bar'].invoke();

@@ -272,0 +286,0 @@ });

@@ -33,73 +33,81 @@ var parseargs = require('../lib/parseargs')

, p = new parseargs.Parser(optsReg)
, z = function (s) { return s.split(' '); };
, z = function (s) { return s.split(' '); }
, res;
// Long preemptive opt and val with equal-sign, ignore further opts
p.parse(z('--tasks=foo --jakefile=asdf'));
assert.equal('foo', p.opts.tasks);
assert.equal(undefined, p.opts.jakefile);
res = p.parse(z('--tasks=foo --jakefile=asdf'));
assert.equal('foo', res.opts.tasks);
assert.equal(undefined, res.opts.jakefile);
// Long preemptive opt and val without equal-sign, ignore further opts
p.parse(z('--tasks foo --jakefile=asdf'));
assert.equal('foo', p.opts.tasks);
assert.equal(undefined, p.opts.jakefile);
res = p.parse(z('--tasks foo --jakefile=asdf'));
assert.equal('foo', res.opts.tasks);
assert.equal(undefined, res.opts.jakefile);
// Long preemptive opt and no val, ignore further opts
p.parse(z('--tasks --jakefile=asdf'));
assert.equal(true, p.opts.tasks);
assert.equal(undefined, p.opts.jakefile);
res = p.parse(z('--tasks --jakefile=asdf'));
assert.equal(true, res.opts.tasks);
assert.equal(undefined, res.opts.jakefile);
// Preemptive opt with no val, should be true
p.parse(z('-T'));
assert.equal(true, p.opts.tasks);
res = p.parse(z('-T'));
assert.equal(true, res.opts.tasks);
// Preemptive opt with no val, should be true and ignore further opts
p.parse(z('-T -f'));
assert.equal(true, p.opts.tasks);
assert.equal(undefined, p.opts.jakefile);
res = p.parse(z('-T -f'));
assert.equal(true, res.opts.tasks);
assert.equal(undefined, res.opts.jakefile);
// Preemptive opt with val, should be val
p.parse(z('-T zoobie -f foo/bar/baz'));
assert.equal('zoobie', p.opts.tasks);
assert.equal(undefined, p.opts.jakefile);
res = p.parse(z('-T zoobie -f foo/bar/baz'));
assert.equal('zoobie', res.opts.tasks);
assert.equal(undefined, res.opts.jakefile);
// -f expects a value, -t does not (howdy is task-name)
p.parse(z('-f zoobie -t howdy'));
assert.equal('zoobie', p.opts.jakefile);
assert.equal(true, p.opts.trace);
assert.equal('howdy', p.taskName);
res = p.parse(z('-f zoobie -t howdy'));
assert.equal('zoobie', res.opts.jakefile);
assert.equal(true, res.opts.trace);
assert.equal('howdy', res.taskNames[0]);
// Different order, -f expects a value, -t does not (howdy is task-name)
res = p.parse(z('-f zoobie howdy -t'));
assert.equal('zoobie', res.opts.jakefile);
assert.equal(true, res.opts.trace);
assert.equal('howdy', res.taskNames[0]);
// -f expects a value, -t does not (foo=bar is env var)
p.parse(z('-f zoobie -t foo=bar'));
assert.equal('zoobie', p.opts.jakefile);
assert.equal(true, p.opts.trace);
assert.equal('bar', p.envVars.foo);
assert.equal(undefined, p.taskName);
res = p.parse(z('-f zoobie -t foo=bar'));
assert.equal('zoobie', res.opts.jakefile);
assert.equal(true, res.opts.trace);
assert.equal('bar', res.envVars.foo);
assert.equal(undefined, res.taskName);
// -f expects a value, -t does not (foo=bar is env-var, task-name follows)
p.parse(z('-f zoobie -t howdy foo=bar'));
assert.equal('zoobie', p.opts.jakefile);
assert.equal(true, p.opts.trace);
assert.equal('bar', p.envVars.foo);
assert.equal('howdy', p.taskName);
res = p.parse(z('-f zoobie -t howdy foo=bar'));
assert.equal('zoobie', res.opts.jakefile);
assert.equal(true, res.opts.trace);
assert.equal('bar', res.envVars.foo);
assert.equal('howdy', res.taskNames[0]);
// -t does not expect a value, -f does (throw howdy away)
p.parse(z('-t howdy -f zoobie'));
assert.equal(true, p.opts.trace);
assert.equal('zoobie', p.opts.jakefile);
assert.equal(undefined, p.taskName);
res = p.parse(z('-t howdy -f zoobie'));
assert.equal(true, res.opts.trace);
assert.equal('zoobie', res.opts.jakefile);
assert.equal(undefined, res.taskName);
// --trace does not expect a value, -f does (throw howdy away)
p.parse(z('--trace howdy --jakefile zoobie'));
assert.equal(true, p.opts.trace);
assert.equal('zoobie', p.opts.jakefile);
assert.equal(undefined, p.taskName);
res = p.parse(z('--trace howdy --jakefile zoobie'));
assert.equal(true, res.opts.trace);
assert.equal('zoobie', res.opts.jakefile);
assert.equal(undefined, res.taskName);
// --trace does not expect a value, -f does (throw howdy away)
p.parse(z('--trace=howdy --jakefile=zoobie'));
assert.equal(true, p.opts.trace);
assert.equal('zoobie', p.opts.jakefile);
assert.equal(undefined, p.taskName);
res = p.parse(z('--trace=howdy --jakefile=zoobie'));
assert.equal(true, res.opts.trace);
assert.equal('zoobie', res.opts.jakefile);
assert.equal(undefined, res.taskName);
/*
// Task-name with positional args
p.parse(z('foo:bar[asdf,qwer]'));
res = p.parse(z('foo:bar[asdf,qwer]'));
assert.equal('asdf', p.taskArgs[0]);

@@ -109,10 +117,10 @@ assert.equal('qwer', p.taskArgs[1]);

// Opts, env vars, task-name with positional args
p.parse(z('-f ./tests/Jakefile -t default[asdf,qwer] foo=bar'));
assert.equal('./tests/Jakefile', p.opts.jakefile);
assert.equal(true, p.opts.trace);
assert.equal('bar', p.envVars.foo);
assert.equal('default', p.taskName);
res = p.parse(z('-f ./tests/Jakefile -t default[asdf,qwer] foo=bar'));
assert.equal('./tests/Jakefile', res.opts.jakefile);
assert.equal(true, res.opts.trace);
assert.equal('bar', res.envVars.foo);
assert.equal('default', res.taskName);
assert.equal('asdf', p.taskArgs[0]);
assert.equal('qwer', p.taskArgs[1]);
*/

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc