Last active
June 9, 2018 02:51
-
-
Save ssaunier/8704755 to your computer and use it in GitHub Desktop.
Hook to rub rspec and karma before each `git push`. Can be bypassed with `git push --no-verify`
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
cd /path/to/your/repo | |
curl https://gist.github.com/ssaunier/8704755/raw/pre-push.sh > .git/hooks/pre-push | |
chmod u+x .git/hooks/pre-push |
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
echo "Running RSpec" | |
bundle exec rspec spec | |
spec=$? | |
echo "Running Karma" | |
bundle exec rake karma:run | |
karma=$? | |
if [ $spec -eq 0 ] && [ $karma -eq 0 ]; then | |
echo "\\033[32mTests are green, pushing...\\033[0;39m" | |
exit 0 | |
else | |
echo "\\033[1;31mCannot push, tests are failing. Use --no-verify to force push.\\033[0;39m" | |
exit 1 | |
fi |
Le lien du gist à changer : https://gist.githubusercontent.com/ssaunier/8704755/raw/e65156d080fb1ad8d40feca305bc95baaf165ec8/pre-push.sh
Ou alors faut faire suivre la redirection à curl avec un -L
🍑
Made it work a bit better on Linux, and added a crunchbang: https://gist.github.com/johnhamelink/577b8613ae82d2b3037b
I wonder: is there a way to have the hook installed automatically?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Source: https://github.com/markhazlett/RSpec-Pre-commit-Git-Hook