gulp-shell
Advanced tools
Comparing version 0.3.0 to 0.4.0
15
index.js
@@ -21,2 +21,3 @@ var _ = require('lodash') | ||
ignoreErrors: false, | ||
errorMessage: 'Command `<%= command %>` failed with exit code <%= error.code %>', | ||
quiet: false, | ||
@@ -46,2 +47,10 @@ cwd: process.cwd(), | ||
error.stderr = stderr | ||
var errorContext = _.extend({ | ||
command: command, | ||
file: file, | ||
error: error | ||
}, options.templateData) | ||
error.message = gutil.template(options.errorMessage, errorContext) | ||
} | ||
@@ -58,5 +67,5 @@ | ||
if (error) { | ||
self.emit('error', new gutil.PluginError(PLUGIN_NAME, error, { | ||
stdout: error.stdout, | ||
stderr: error.stderr | ||
self.emit('error', new gutil.PluginError({ | ||
plugin: PLUGIN_NAME, | ||
message: error.message | ||
})) | ||
@@ -63,0 +72,0 @@ } else { |
{ | ||
"name": "gulp-shell", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "A handy command line interface for gulp", | ||
@@ -28,16 +28,16 @@ "main": "index.js", | ||
"coveralls": "~2.11.2", | ||
"gulp": "~3.8.10", | ||
"istanbul": "~0.3.2", | ||
"jscs": "~1.8.1", | ||
"jshint": "~2.5.10", | ||
"mocha": "~2.0.1", | ||
"mocha-lcov-reporter": "0.0.1", | ||
"should": "~4.3.0" | ||
"gulp": "~3.8.11", | ||
"istanbul": "~0.3.7", | ||
"jscs": "~1.11.3", | ||
"jshint": "~2.6.3", | ||
"mocha": "~2.2.1", | ||
"mocha-lcov-reporter": "0.0.2", | ||
"should": "~5.1.0" | ||
}, | ||
"dependencies": { | ||
"async": "~0.9.0", | ||
"gulp-util": "~3.0.1", | ||
"lodash": "~2.4.1", | ||
"gulp-util": "~3.0.4", | ||
"lodash": "~3.5.0", | ||
"through2": "~0.6.3" | ||
} | ||
} |
@@ -74,2 +74,13 @@ # gulp-shell | ||
#### options.errorMessage | ||
type: `String` | ||
default: ``Command `<%= command %>` failed with exit code <%= error.code %>`` | ||
You can add a custom error message for when the command fails. | ||
This can be a [template][] which can be interpolated with the current `command`, some [file][] info (e.g. `file.path`) and some [error][] info (e.g. `error.code`). | ||
[error]: http://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback | ||
#### options.ignoreErrors | ||
@@ -76,0 +87,0 @@ |
@@ -112,2 +112,29 @@ var gutil = require('gulp-util') | ||
describe('errorMessage', function () { | ||
it('should allow for custom messages', function (done) { | ||
var errorMessage = 'foo' | ||
var stream = shell(['false'], {errorMessage: errorMessage}) | ||
stream.on('error', function (error) { | ||
error.message.should.equal(errorMessage) | ||
done() | ||
}) | ||
stream.write(fakeFile) | ||
}) | ||
it('should include the error object in the error context', function (done) { | ||
var errorMessage = 'Foo <%= error.code %>' | ||
var expectedMessage = 'Foo 2' | ||
var stream = shell(['exit 2'], {errorMessage: errorMessage}) | ||
stream.on('error', function (error) { | ||
error.message.should.equal(expectedMessage) | ||
done() | ||
}) | ||
stream.write(fakeFile) | ||
}) | ||
}) | ||
describe('cwd', function () { | ||
@@ -114,0 +141,0 @@ it('should set the current working directory when `cwd` is a string', function (done) { |
Sorry, the diff of this file is not supported yet
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
14789
210
132
+ Addedlodash@3.5.0(transitive)
- Removedlodash@2.4.2(transitive)
Updatedgulp-util@~3.0.4
Updatedlodash@~3.5.0