Forked from johnhamelink/git-pre-push-hook-install.sh
Last active
March 29, 2018 18:03
-
-
Save kuzmik/c08864648e4721f96a2a3050384ee030 to your computer and use it in GitHub Desktop.
Run `rake` before push. Because reasons.
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
cd /path/to/your/repo | |
curl https://gist.githubusercontent.com/kuzmik/c08864648e4721f96a2a3050384ee030/raw/dad37f43037e44af991c81e65c9a739669d0556a/pre-push.sh > .git/hooks/pre-push | |
chmod u+x .git/hooks/pre-push |
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
#!/usr/bin/env bash | |
echo "Running rake" | |
bundle exec rake | |
spec=$? | |
echo "Running brakeman" | |
brakeman -5 --progress --no-pager | |
brk=$? | |
if [ $spec -eq 0 ] && [ $brk -eq 0 ]; then | |
echo -en "\\033[32mTests are green, pushing...\\033[0;39m\n" | |
exit 0 | |
else | |
echo -en "\\033[1;31mCannot push, tests are failing. Use --no-verify to force push.\\033[0;39m\n" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment