Created
February 11, 2016 21:14
-
-
Save calderas/c9ae1f34d1155e3e90d4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| echo "pre-push started" | |
| files=("./app" "./tests") | |
| if [ "$files" = "" ]; then | |
| echo "\nNo files found:\n" | |
| exit 0 | |
| fi | |
| pass=true | |
| echo "\nValidating JavaScript:\n" | |
| for file in ${files}; do | |
| result=$(jshint ${file} | grep "${file} is OK") | |
| if [ "$result" != "" ]; then | |
| echo "\t\033[32mJSHint Passed: ${file}\033[0m" | |
| else | |
| echo "\t\033[31mJSHint Failed: ${file}\033[0m" | |
| pass=false | |
| fi | |
| done | |
| echo "\nJavaScript validation complete\n" | |
| if ! $pass; then | |
| echo "\033[41mCOMMIT FAILED:\033[0m Your commit contains files that should pass JSHint but do not. Please fix the JSHint errors and try again.\n" | |
| exit 1 | |
| else | |
| echo "\033[42mCOMMIT SUCCEEDED\033[0m\n" | |
| fi | |
| echo "post-push finished" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment