Skip to content

Commit

Permalink
deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
Contra committed Jan 22, 2014
1 parent 7651a97 commit aea0f93
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

- added `gulp.watch(globs, tasksArray)` sugar
- remove gulp.taskQueue

- deprecate gulp.run
# 3.4

- added `--tasks` that prints out the tree of tasks + deps
Expand Down
9 changes: 8 additions & 1 deletion bin/gulp.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,18 @@ function loadGulpFile(localGulp, gulpFile, tasks){
if (argv.tasks) {
return logTasks(gulpFile, localGulp);
}
localGulp.run.apply(localGulp, tasks);

startGulp(localGulp, tasks);
});
return theGulpfile;
}

function startGulp(localGulp, tasks) {
// impose our opinion of "default" tasks onto orchestrator
var toRun = tasks.length ? tasks : ['default'];
return localGulp.start.apply(localGulp, toRun);
}

function logTasks(gulpFile, localGulp) {
var tree = taskTree(localGulp.tasks);
tree.label = 'Tasks for '+gutil.colors.magenta(gulpFile);
Expand Down
10 changes: 10 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ util.inherits(Gulp, Orchestrator);

Gulp.prototype.task = Gulp.prototype.add;
Gulp.prototype.run = function(){
// run() is deprecated as of 3.5 and will be removed in 4.0
// use task dependencies instead

// impose our opinion of "default" tasks onto orchestrator
var tasks = arguments.length ? arguments : ['default'];

Expand All @@ -27,13 +30,20 @@ Gulp.prototype.watch = function (glob, opt, fn) {
opt = null;
}

if (typeof fn === 'function') {
return vfs.watch(glob, opt, fn);
}

// array of tasks given
if (Array.isArray(fn)) {
return vfs.watch(glob, opt, function(){
this.start.apply(this, fn);
}.bind(this));
}

if (typeof fn === 'object') {

}
return vfs.watch(glob, opt, fn);
};

Expand Down
2 changes: 1 addition & 1 deletion test/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var outpath = path.join(__dirname, "./out-fixtures");
describe('gulp', function() {
describe('watch()', function() {
beforeEach(rimraf.bind(null, outpath));
beforeEach(mkdirp.bind(null, outpath))
beforeEach(mkdirp.bind(null, outpath));
afterEach(rimraf.bind(null, outpath));

var tempFileContent = 'A test generated this file and it is safe to delete';
Expand Down

0 comments on commit aea0f93

Please sign in to comment.