Skip to content

Commit

Permalink
Merge pull request gulpjs#27 from robrich/master
Browse files Browse the repository at this point in the history
Upgrade Orchestrator to 0.1.0 (can now wait for streams), show task duration
  • Loading branch information
yocontra committed Nov 27, 2013
2 parents 04a6b9b + 67ab0cc commit a52a450
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[![Build Status](https://travis-ci.org/wearefractal/gulp.png?branch=master)](https://travis-ci.org/wearefractal/gulp)
[![Dependency Status](https://david-dm.org/wearefractal/gulp.png)](https://david-dm.org/wearefractal/gulp)

## Information

Expand Down Expand Up @@ -150,13 +151,43 @@ gulp.task('somename', ['array','of','task','names'], function(){

##### Async tasks

With callbacks:

```javascript
gulp.task('somename', function(cb){
// do stuff
cb(err);
});
```

Wait for stream to end:

```javascript
gulp.task('somename', function () {
var stream = gulp.src('./client/**/*.js')
.pipe(minify())
.pipe(gulp.dest('/public');
return stream;
});
```
With promises:
```javascript
var Q = require('q');

gulp.task('somename', function(){
var deferred = Q.defer();

// do async stuff
setTimeout(function () {
deferred.resolve();
}, 1);

return deferred.promise;
});
```
### gulp.run(tasks...[, cb])
Triggers tasks to be executed. *Does not run in order*.
Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function Gulp(){
gulp.log('Running', "'"+chalk.cyan(e.task)+"'...");
});
this.on('task_stop', function(e){
gulp.log('Finished', "'"+chalk.cyan(e.task)+"'");
gulp.log('Finished', "'"+chalk.cyan(e.task)+"' in "+e.duration+" seconds");
});
this.on('task_err', function(e){
var mess;
Expand All @@ -26,7 +26,7 @@ function Gulp(){
} else {
mess = e.message;
}
gulp.log('Errored', "'"+chalk.cyan(e.task)+"' "+chalk.red(mess)+' ');
gulp.log('Errored', "'"+chalk.cyan(e.task)+"' in "+e.duration+" seconds "+chalk.red(mess)+' ');
});
}
util.inherits(Gulp, Orchestrator);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"optimist":"0.6.0",
"gulp-util":"1.0.0",
"gaze":"0.4.3",
"orchestrator": "0.0.8",
"orchestrator": "0.1.0",
"chalk":"0.3.0",
"resolve":"0.5.1",
"semver":"2.2.1",
Expand Down

0 comments on commit a52a450

Please sign in to comment.