Skip to content

Instantly share code, notes, and snippets.

@frankyston
Forked from ssaunier/git-pre-push-hook-install.sh
Last active August 29, 2015 14:23
Show Gist options
  • Save frankyston/6789bd0a4f24343b55de to your computer and use it in GitHub Desktop.
Save frankyston/6789bd0a4f24343b55de to your computer and use it in GitHub Desktop.
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
echo "Running RSpec"
bundle exec rspec spec
spec=$?
#echo "Running Karma"
#bundle exec rake karma:run
#karma=$?
# if use spec and karma
# if [ $spec -eq 0 ] && [ $karma -eq 0 ]; then
if [ $spec -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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment