Permalink
Browse files

More API docs added.

  • Loading branch information...
1 parent 32383be commit bf2b3fb848422d95d9bc421a7b24da7fd266a817 mde committed Feb 27, 2012
Showing with 31 additions and 5 deletions.
  1. +1 −1 Makefile
  2. +30 −4 lib/task/task.js
View
@@ -26,7 +26,7 @@ build:
@echo 'Jake built.'
install:
- @mkdir -p $(DESTDIR)$(PREFIX)/bin \
+ @mkdir -p $(DESTDIR)$(PREFIX)/bin && \
mkdir -p $(DESTDIR)$(PREFIX)/lib/node_modules/jake && \
cp -R ./* $(DESTDIR)$(PREFIX)/lib/node_modules/jake/ && \
ln -snf ../lib/node_modules/jake/bin/cli.js $(DESTDIR)$(PREFIX)/bin/jake && \
View
@@ -6,8 +6,19 @@ var fs = require('fs')
, utils = require('../utils');
/**
- * @constructor
- * A Jake task
+ @name Task
+ @constructor
+ @augments EventEmitter
+ @description A Jake Task
+
+ @param {String} name The name of the Task
+ @param {Array} [prereqs] Prerequisites to be run before this task
+ @param {Function} [action] The action to perform for this task
+ @param {Object} [opts]
+ @param {Array} [opts.asyc=false] Perform this task asynchronously.
+ If you flag a task with this option, you must call the global
+ `complete` method inside the task's action, for execution to proceed
+ to the next task.
*/
Task = function () {
// Do constructor-work only on actual instances, not when used
@@ -36,6 +47,11 @@ TaskBase = new (function () {
};
};
+ /**
+ @name Task#event:complete
+ @event
+ */
+
this.init = function (name, prereqs, action, options) {
var opts = options || {};
@@ -62,14 +78,24 @@ TaskBase = new (function () {
}
};
- // Run prereqs, run task
+ /**
+ @name Task#invoke
+ @function
+ @description Runs prerequisites, then this task. If the task has already
+ been run, will not run the task again.
+ */
this.invoke = function () {
jake._invocationChain.push(this);
this.args = Array.prototype.slice.call(arguments);
this.runPrereqs();
};
- // Reenable, run task (no prereqs)
+ /**
+ @name Task#reenable
+ @function
+ @description Runs this task, without running any prerequisites. If the task
+ has already been run, it will still run it again.
+ */
this.execute = function () {
jake._invocationChain.push(this);
this.reenable();

0 comments on commit bf2b3fb

Please sign in to comment.