Created
August 20, 2014 20:55
-
-
Save philtr/02519c21aec26f2fb4d3 to your computer and use it in GitHub Desktop.
Run tests and prompt before git push if they fail
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 | |
function run_tests { | |
bundle exec rspec | |
} | |
function double_check { | |
echo -e "\n" | |
read -p "WARNING: Your tests failed. Are you sure you want to push? " -n 1 -r < /dev/tty | |
echo | |
if [[ $REPLY =~ ^[Yy]$ ]] | |
then | |
exit 0 # push will execute | |
fi | |
exit 1 # push will not execute) | |
} | |
run_tests || double_check |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment