grunt-parallel
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -45,4 +45,12 @@ module.exports = function(grunt) { | ||
grunt: { | ||
grunt: true, | ||
options: { | ||
grunt: true | ||
}, | ||
tasks: ['fast', 'block', 'fast'] | ||
}, | ||
stream: { | ||
options: { | ||
stream: true | ||
}, | ||
tasks: [{ cmd: 'tail', args: ['-f', '/var/log/system.log']}] | ||
} | ||
@@ -49,0 +57,0 @@ } |
{ | ||
"name": "grunt-parallel", | ||
"description": "Run tasks or commands in child processes.", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"homepage": "https://github.com/iammerrick/grunt-parallel", | ||
@@ -28,2 +28,5 @@ "author": { | ||
}, | ||
"peerDependencies": { | ||
"grunt": "~0.4.0" | ||
}, | ||
"devDependencies": { | ||
@@ -30,0 +33,0 @@ "grunt": "~0.4.0" |
# grunt-parallel | ||
Run commands and tasks in parallel. | ||
Run commands and tasks in parallel to speed up your build. | ||
@@ -19,2 +19,47 @@ ## Getting Started | ||
## The Configuration | ||
```javascript | ||
grunt.initConfig({ | ||
parallel: { | ||
mix: { | ||
tasks: [{ | ||
grunt: true, | ||
args: ['fast'] | ||
}, { | ||
grunt: true, | ||
args: ['block'] | ||
}, { | ||
cmd: 'pwd' | ||
},{ | ||
grunt: true, | ||
args: ['fast'] | ||
}] | ||
}, | ||
shell: { | ||
tasks: [{ | ||
cmd: 'whoami' | ||
}] | ||
}, | ||
grunt: { | ||
options: { | ||
grunt: true | ||
}, | ||
tasks: ['fast', 'block', 'fast'] | ||
}, | ||
stream: { | ||
options: { | ||
stream: true | ||
}, | ||
tasks: [ { cmd: 'tail', args: ['-f', '/var/log/system.log'] }] | ||
} | ||
} | ||
}); | ||
``` | ||
## Example | ||
![Example](http://f.cl.ly/items/3e281L3X3h01293q3Z11/grunt-parallel.png) | ||
### Settings | ||
@@ -42,2 +87,19 @@ | ||
#### Streaming Log Output For Never Ending Tasks | ||
Sometimes tasks don't end and consequently you don't want to wait to receive their output till they are done, because you would never see their output. Think of watching files or tailing logs. For this case you can set the stream option to true, and all of the tasks output will be logged to your console, this is letting the sub process inherit your stdio. | ||
```javascript | ||
grunt.initConfig({ | ||
stream: { | ||
options: { | ||
stream: true | ||
}, | ||
tasks: [{ cmd: 'tail', args: ['-f', '/var/log/system.log']}] | ||
} | ||
}); | ||
``` | ||
Since tail runs till you send it a shutdown signal, you would like to stream the output to your stdio. | ||
#### Only Using Grunt | ||
@@ -44,0 +106,0 @@ |
@@ -36,5 +36,9 @@ /* | ||
var done = this.async(); | ||
var options = this.options({ | ||
grunt: false, | ||
stream: false | ||
}); | ||
// If the configuration specifies that the task is a grunt task. Make it so. | ||
if (this.data.grunt === true) { | ||
if (options.grunt === true) { | ||
this.data.tasks = this.data.tasks.map(function(task) { | ||
@@ -48,2 +52,10 @@ return { | ||
if (options.stream === true) { | ||
this.data.tasks = this.data.tasks.map(function(task) { | ||
task.opts = task.opts || {}; | ||
task.opts.stdio = 'inherit'; | ||
return task; | ||
}); | ||
} | ||
Q.all(this.data.tasks.map(spawn)).then(done, done.bind(this, false)).finally(function() { | ||
@@ -50,0 +62,0 @@ lpad.stdout(); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7762
109
123
4