Created
July 26, 2013 23:17
-
-
Save romaricpascal/6092876 to your computer and use it in GitHub Desktop.
pre-commit Git hook that runs grunt to validate the sources before commit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
var exec = require('child_process').exec; | |
// Runs the build task, in our case `grunt jshint` | |
exec('grunt jshint', function (error, stdout, stderr) { | |
// Build task output might be useful to the developer so let's print it | |
// We could also log it in a file | |
console.log(stdout); | |
// Depending on the result of the build, either print the error | |
// or exit successfully | |
var exitCode = 0; | |
if (error) { | |
console.log('Build script encountered an error :('); | |
console.log(stderr); | |
exitCode = -1; | |
} | |
process.exit(exitCode); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
MIT Licenced