Permalink
Browse files

Move working dir and -T result into program.run

  • Loading branch information...
1 parent 342f5f4 commit e5f16ace558396056bbb46e0c76974566d30b509 mde committed Oct 7, 2012
Showing with 23 additions and 21 deletions.
  1. +1 −20 lib/jake.js
  2. +22 −1 lib/program.js
View
@@ -267,30 +267,11 @@ utils.mixin(jake, new (function () {
}
else {
opts = program.opts;
-
// Load Jakefile and jakelibdir files
loader.loadFile(opts.jakefile);
loader.loadDirectory(opts.jakelibdir);
- // Run with `jake -T`, just show descriptions
- if (opts.tasks) {
- this.showAllTaskDescriptions(opts.tasks);
- }
- else {
- // Set working dir
- var dirname = opts.directory;
- if (dirname) {
- if (utils.file.existsSync(directory) &&
- fs.statSync(directory).isDirectory()) {
- process.chdir(dirname);
- }
- else {
- throw new Error(dirname + ' is not a valid directory path');
- }
- }
-
- program.run();
- }
+ program.run();
}
};
View
@@ -189,11 +189,32 @@ Program.prototype = new (function () {
};
this.run = function () {
- var taskNames = this.taskNames;
+ var taskNames
+ , dirname
+ , opts = this.opts;
+ // Run with `jake -T`, just show descriptions
+ if (opts.tasks) {
+ return this.showAllTaskDescriptions(opts.tasks);
+ }
+
+ taskNames = this.taskNames;
if (!(Array.isArray(taskNames) && taskNames.length)) {
throw new Error('Please pass jake.runTasks an array of task-names');
}
+
+ // Set working dir
+ dirname = opts.directory;
+ if (dirname) {
+ if (utils.file.existsSync(directory) &&
+ fs.statSync(directory).isDirectory()) {
+ process.chdir(dirname);
+ }
+ else {
+ throw new Error(dirname + ' is not a valid directory path');
+ }
+ }
+
task('__root__', taskNames, function () {});
rootTask = jake.Task['__root__'];

3 comments on commit e5f16ac

@imkira
Contributor
imkira commented on e5f16ac Oct 9, 2012

Hi mde,
I just happened to update my jake version to the latest 0.5.4, and noticed that a jake -T will fail with a

jake aborted.
TypeError: Object [object Object] has no method 'showAllTaskDescriptions'

By looking at the nature of this commit, I suppose you forgot to move the function called showAllTaskDescriptions from lib/jake.js to lib/program.js, am I wrong?

Best regards and thanks for such tool!

@mde
Contributor
mde commented on e5f16ac Oct 9, 2012

Excellent catch. This is fixed in v0.5.5. :)

@imkira
Contributor
imkira commented on e5f16ac Oct 9, 2012

Thanks for the super fast support!
I can confirm it works perfectly now with 0.5.5.

Please sign in to comment.