Created
August 6, 2014 23:52
-
-
Save ckjoris/5e171b8e832681e293bd to your computer and use it in GitHub Desktop.
gulp-jsvalidate with git hook
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
var gulp = require('gulp'); | |
var jsValidate = require('gulp-jsvalidate'); | |
gulp.task('default', function() { | |
// check for js syntax errors | |
return gulp.src('web/app/**/*.js') | |
.pipe(jsValidate()); | |
}); |
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
#!/bin/bash | |
set -e | |
function run_test { | |
if git rev-parse --verify HEAD >/dev/null 2>&1 ; then | |
head="HEAD" | |
else | |
# First commit, use an empty tree | |
head="4b825dc642cb6eb9a060e54bf8d69288fbee4904" | |
fi | |
gulp | |
if [[ "$?" != "0" ]]; then | |
echo "gulp exited with error, aborting commit." | |
exit 1 | |
fi | |
} | |
case "${1}" in | |
--about ) | |
echo "run gulpfile" | |
;; | |
* ) | |
run_test | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment