Created
March 7, 2016 20:04
-
-
Save epintos/2e212a91d9a45658110a to your computer and use it in GitHub Desktop.
Git Pre Push example to check linters and run tests
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/sh | |
echo 'Running Rspec tests' | |
RUN_CHECK_CMD='bundle exec rspec spec -fd' | |
RUN_TESTS_OUTPUT=`${RUN_CHECK_CMD}` | |
if [ $? -eq 1 ] | |
then | |
echo "Can't commit! You've broken Rspec tests!!!" | |
exit 1 | |
fi | |
echo 'Running Rubocop' | |
RUN_CHECK_CMD='bundle exec rubocop app spec -R --format simple' | |
RUN_TESTS_OUTPUT=`${RUN_CHECK_CMD}` | |
if [ $? -eq 1 ] | |
then | |
echo "Can't commit! You have rubocop offences!!!" | |
exit 1 | |
fi | |
echo "All checks passed. Congrats!\n" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment