Skip to content

Instantly share code, notes, and snippets.

@calebhaye
Created February 27, 2014 19:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save calebhaye/9258126 to your computer and use it in GitHub Desktop.
Save calebhaye/9258126 to your computer and use it in GitHub Desktop.
Run tests before git push
#!/bin/sh
branch=`git rev-parse --abbrev-ref HEAD`
echo "Running tests before pushing ...."
if [ $branch == 'master' ]; then
exit_code=$(bundle exec rake > /dev/null 2>/dev/null )$?
if [ $exit_code -gt 0 ]
then echo "Did not push because of failing tests"
fi
exit $exit_code
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment