Created
September 12, 2015 22:32
-
-
Save angelbotto/bb60401b03a0f349b693 to your computer and use it in GitHub Desktop.
Run all test before commits :)
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/bash | |
git stash -q --keep-index | |
echo -e "👮 Wait, run all test before commit!\n" | |
FAILS=`rspec --format progress | grep -E '(\d*) failure(s?)' -o | awk '{print $1}'` | |
git stash pop -q | |
if [ $FAILS -ne 0 ]; then | |
echo -e "✋ Can't commit! You've broken $FAILS tests!!!" | |
exit 1 | |
else | |
echo -e "👍 Commit approved.\n" | |
exit 0 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment