Forked from ssaunier/git-pre-push-hook-install.sh
Last active
January 29, 2021 08:13
-
-
Save johnhamelink/577b8613ae82d2b3037b to your computer and use it in GitHub Desktop.
Made the echo command output colour on a Linux terminal, removed karma and added a crunchbang
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.githubusercontent.com/johnhamelink/577b8613ae82d2b3037b/raw/ad71fb72a1b86ee9a90ac62eccc4a55367578625/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
#!/bin/env bash | |
echo "Running RSpec" | |
bundle exec rspec spec | |
spec=$? | |
if [ $spec -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
Using this spits out errors:
Fixed it by adding a semicolon after the if block:
if [ $spec -eq 0 ]; then