Skip to content

Commit

Permalink
move task_not_found back into orchestrator
Browse files Browse the repository at this point in the history
  • Loading branch information
Contra committed Dec 23, 2013
1 parent 96d6596 commit c99d5cc
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
4 changes: 2 additions & 2 deletions bin/gulp.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ function logEvents(gulp) {
gutil.log('Errored', "'"+gutil.colors.cyan(e.task)+"'", 'in', gutil.colors.magenta(time), gutil.colors.red(msg));
});

gulp.on('task_not_found', function(name){
gutil.log(gutil.colors.red("Task '"+name+"' was not defined in your gulpfile but you tried to run it."));
gulp.on('task_not_found', function(err){
gutil.log(gutil.colors.red("Task '"+err.task+"' was not defined in your gulpfile but you tried to run it."));
gutil.log('Please check the documentation for proper gulpfile formatting.');
process.exit(1);
});
Expand Down
10 changes: 1 addition & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,7 @@ Gulp.prototype.taskQueue = Gulp.prototype.seq;
Gulp.prototype.task = Gulp.prototype.add;
Gulp.prototype.run = function(){
// impose our opinion of "default" tasks onto orchestrator
var tasks = arguments.length ? Array.prototype.slice.call(arguments) : ['default'];

// check if tasks were defined
// orchestrator will fail
// but we just want to emit an event so the CLI can error nicely
tasks.forEach(function(name){
if (this.tasks[name]) return;
this.emit('task_not_found', name);
}, this);
var tasks = arguments.length ? arguments : ['default'];

this.start.apply(this, tasks);
};
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gulp",
"description": "The streaming build system",
"version": "3.2.0",
"version": "3.2.1",
"homepage": "http://github.com/wearefractal/gulp",
"repository": "git://github.com/wearefractal/gulp.git",
"author": "Fractal <[email protected]> (http://wearefractal.com/)",
Expand All @@ -20,7 +20,7 @@
"mkdirp": "~0.3.5",
"optimist": "~0.6.0",
"gulp-util": "~2.2.0",
"orchestrator": "~0.2.1",
"orchestrator": "~0.3.0",
"resolve": "~0.6.1",
"semver": "~2.2.1",
"findup-sync": "~0.1.2",
Expand Down
5 changes: 4 additions & 1 deletion test/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,10 @@ describe('gulp tasks', function() {
gulp.isRunning.should.equal(true);
});
it('should emit task_not_found and throw an error when task is not defined', function(done) {
gulp.on('task_not_found', function(){
gulp.on('task_not_found', function(err){
should.exist(err);
should.exist(err.task);
err.task.should.equal('test');
gulp.reset();
done();
});
Expand Down

0 comments on commit c99d5cc

Please sign in to comment.