shortcake
Version:
Shorten your Cakefiles and fix oddities in cake.
61 lines (49 loc) • 1.19 kB
JavaScript
// Generated by CoffeeScript 1.7.1
var cakeInvoke, cakeTask, exec, invoke, tasks;
global.exec = exec = require('executive');
require('coffee-script/register');
require('source-map-support').install();
cakeInvoke = global.invoke;
cakeTask = global.task;
tasks = {};
invoke = function(name, cb) {
var action, options, _ref;
cakeInvoke(name);
_ref = tasks[name], action = _ref.action, options = _ref.options;
if (/function \(done\)/.test(action)) {
return action(cb);
} else {
return action(options, cb);
}
};
global.task = function(name, description, action) {
tasks[name] = {
action: action,
description: description,
name: name
};
return cakeTask(name, description, function(options) {
return tasks[name].options = options;
});
};
global.invoke = function(tasks, callback) {
var next;
if (callback == null) {
callback = function() {};
}
if (!Array.isArray(tasks)) {
tasks = [tasks];
}
return (next = function() {
if (!tasks.length) {
return callback();
} else {
return invoke(tasks.shift(), next);
}
})();
};
module.exports = {
exec: exec,
invoke: invoke
};
//# sourceMappingURL=index.map