Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of github.com:mde/jake

  • Loading branch information...
commit 447c3968898c18b68055b0616b25d4435b594514 2 parents 83afef7 + c5bf424
mde authored
Showing with 21 additions and 11 deletions.
  1. +7 −4 README.md
  2. +14 −7 lib/loader.js
View
11 README.md
@@ -115,10 +115,13 @@ literals makes it not very useful.) The action is invoked with the Task object
itself as the execution context (i.e, "this" inside the action references the
Task object).
-The `opts` argument is optional, and when it includes an `async` property set to
-`true`, indicates the task executes asynchronously. Asynchronous tasks need to
-call `complete()` to signal they have completed. (Passing a final `async`
-Boolean flag is deprecated, but still supported.)
+The `opts` argument is optional. When a task's operations are asynchronous, the
+`async` property should be set to `true` to notify Jake to wait for its
+`complete` event before proceeding. The `async` flag is meant to describe the
+operation, not the intended outcome. Asynchronous tasks should always call
+`complete()` to signal they have completed. By default this property is `false`.
+(Note: Passing a final Boolean literal to indicate `async` is deprecated, but
+still supported.)
Tasks created with `task` are always executed when asked for (or are a
prerequisite). Tasks created with `file` are only executed if no file with the
View
21 lib/loader.js
@@ -24,7 +24,7 @@ var path = require('path')
Loader = function () {
- var JAKEFILE_PAT = /\.jake$/;
+ var JAKEFILE_PAT = /\.jake(\.js|\.coffee)?$/;
var _loadJakefile = function (file) {
var jakefile = file ?
@@ -56,12 +56,7 @@ Loader = function () {
isCoffee = path.existsSync(jakefile + '.coffee');
if (isCoffee) {
- try {
- CoffeeScript = require('coffee-script');
- }
- catch (e) {
- fail('CoffeeScript is missing! Try `npm install coffee-script`');
- }
+ CoffeeScript = _requireCoffee();
}
require(fileUtils.absolutize(jakefile));
}
@@ -74,10 +69,22 @@ Loader = function () {
dirlist = fs.readdirSync(dirname);
dirlist.forEach(function (filePath) {
if (JAKEFILE_PAT.test(filePath)) {
+ if (/\.coffee$/.test(filePath)) {
+ CoffeeScript = _requireCoffee();
+ }
require(path.join(dirname, filePath));
}
});
}
+ }
+
+ , _requireCoffee = function() {
+ try {
+ return require('coffee-script');
+ }
+ catch (e) {
+ fail('CoffeeScript is missing! Try `npm install coffee-script`');
+ }
};
this.load = function (opts) {
Please sign in to comment.
Something went wrong with that request. Please try again.