Forked from brianmriley/git-pre-commit-jshint-karma-unit
Created
September 18, 2013 15:44
-
-
Save ThomasBurleson/6611150 to your computer and use it in GitHub Desktop.
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/sh | |
# | |
# Pre-commit hooks | |
###################################################################### | |
# Environment Setup | |
# 1) Change directory to build dir so we can run grunt tasks. | |
# 2) Make sure path is extended to include grunt task executable | |
# dir, as this commit shell is executed in the git | |
# client's own shell; ie Tower and WebStorm have own shell path. | |
###################################################################### | |
cd build | |
PATH=$PATH:~/usr/local/bin | |
PATH=$PATH:/usr/local/bin | |
###################################################################### | |
# JSHint: Lint stuff before committing | |
###################################################################### | |
grunt jshint | |
EXIT_CODE=$? | |
# echo ${EXIT_CODE} | |
if [[ ${EXIT_CODE} -ne 0 ]]; then | |
echo "[ERRROR] code = " ${EXIT_CODE} | |
echo "JSHint detected syntax problems." | |
echo "Commit aborted." | |
exit 1 | |
else | |
echo "JSHint completed successfully\n" | |
fi | |
###################################################################### | |
# Unit Tests: Run unit tests/specs before committing | |
###################################################################### | |
grunt karma:continuous | |
EXIT_CODE=$? | |
if [[ ${EXIT_CODE} -ne 0 ]]; then | |
echo "[ERRROR] code = " ${EXIT_CODE} | |
echo "Karma Unit Tests failed." | |
echo "Commit aborted." | |
exit 1 | |
else | |
echo "Karma Unit Tests completed successfully\n" | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment