grunt-shell
Advanced tools
Comparing version 0.3.1 to 0.4.0
{ | ||
"name": "grunt-shell", | ||
"version": "0.3.1", | ||
"version": "0.4.0", | ||
"description": "Run shell commands", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
141
readme.md
@@ -31,2 +31,21 @@ # grunt-shell | ||
### Example config | ||
```js | ||
grunt.initConfig({ | ||
shell: { // Task | ||
listFolders: { // Target | ||
options: { // Options | ||
stdout: true | ||
}, | ||
command: 'ls' | ||
} | ||
} | ||
}); | ||
grunt.loadNpmTasks('grunt-shell'); | ||
grunt.registerTask('default', ['shell']); | ||
``` | ||
### Example usage | ||
@@ -39,8 +58,10 @@ | ||
```javascript | ||
shell: { | ||
makeDir: { | ||
command: 'mkdir test' | ||
```js | ||
grunt.initConfig({ | ||
shell: { | ||
makeDir: { | ||
command: 'mkdir test' | ||
} | ||
} | ||
} | ||
}); | ||
``` | ||
@@ -50,9 +71,11 @@ | ||
```javascript | ||
testDir: 'test', | ||
shell: { | ||
makeDir: { | ||
command: 'mkdir <%= testDir %>' | ||
```js | ||
grunt.initConfig({ | ||
testDir: 'test', | ||
shell: { | ||
makeDir: { | ||
command: 'mkdir <%= testDir %>' | ||
} | ||
} | ||
} | ||
}); | ||
``` | ||
@@ -62,10 +85,26 @@ | ||
```javascript | ||
```js | ||
grunt.initConfig({ | ||
shell: { | ||
makeDir: { | ||
command: function () { | ||
return 'echo hello'; | ||
} | ||
} | ||
} | ||
}); | ||
``` | ||
Which can also take arguments: | ||
```js | ||
shell: { | ||
makeDir: { | ||
command: function () { | ||
return 'echo hello'; | ||
command: function (greeting) { | ||
return 'echo ' + greeting; | ||
} | ||
} | ||
} | ||
grunt.loadNpmTasks('grunt-shell'); | ||
grunt.registerTask('default', ['shell:hello']); | ||
``` | ||
@@ -78,11 +117,13 @@ | ||
```javascript | ||
shell: { | ||
dirListing: { | ||
command: 'ls', | ||
options: { | ||
stdout: true | ||
```js | ||
grunt.initConfig({ | ||
shell: { | ||
dirListing: { | ||
command: 'ls', | ||
options: { | ||
stdout: true | ||
} | ||
} | ||
} | ||
} | ||
}); | ||
``` | ||
@@ -95,3 +136,3 @@ | ||
```javascript | ||
```js | ||
function log(err, stdout, stderr, cb) { | ||
@@ -102,12 +143,12 @@ console.log(stdout); | ||
... | ||
shell: { | ||
dirListing: { | ||
command: 'ls', | ||
options: { | ||
callback: log | ||
grunt.initConfig({ | ||
shell: { | ||
dirListing: { | ||
command: 'ls', | ||
options: { | ||
callback: log | ||
} | ||
} | ||
} | ||
} | ||
}); | ||
``` | ||
@@ -120,14 +161,16 @@ | ||
```javascript | ||
shell: { | ||
subfolderLs: { | ||
command: 'ls', | ||
options: { | ||
stdout: true, | ||
execOptions: { | ||
cwd: 'tasks' | ||
```js | ||
grunt.initConfig({ | ||
shell: { | ||
subfolderLs: { | ||
command: 'ls', | ||
options: { | ||
stdout: true, | ||
execOptions: { | ||
cwd: 'tasks' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}); | ||
``` | ||
@@ -140,12 +183,14 @@ | ||
```javascript | ||
shell: { | ||
multiple: { | ||
command: [ | ||
'mkdir test', | ||
'cd test', | ||
'ls' | ||
].join('&&') | ||
```js | ||
grunt.initConfig({ | ||
shell: { | ||
multiple: { | ||
command: [ | ||
'mkdir test', | ||
'cd test', | ||
'ls' | ||
].join('&&') | ||
} | ||
} | ||
} | ||
}); | ||
``` | ||
@@ -152,0 +197,0 @@ |
@@ -20,3 +20,3 @@ 'use strict'; | ||
cmd = grunt.template.process(_.isFunction(cmd) ? cmd.call(grunt) : cmd); | ||
cmd = grunt.template.process(_.isFunction(cmd) ? cmd.apply(grunt, arguments) : cmd); | ||
@@ -23,0 +23,0 @@ var cp = exec(cmd, options.execOptions, function (err, stdout, stderr) { |
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
7147
267