Last active
April 16, 2019 13:25
-
-
Save alebian/d7b3e18549599cacec3f16621c67e6f5 to your computer and use it in GitHub Desktop.
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 | |
mkdir .githooks | |
curl https://gist.githubusercontent.com/alebian/d7b3e18549599cacec3f16621c67e6f5/raw/pre-push.sh > .githooks/pre-push | |
chmod u+x .githooks/pre-push | |
git config core.hooksPath ./.githooks |
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 | |
curl https://gist.githubusercontent.com/alebian/d7b3e18549599cacec3f16621c67e6f5/raw/pre-push.sh > .git/hooks/pre-push | |
chmod u+x .git/hooks/pre-push |
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 Rubocop" | |
bundle exec rubocop -R Gemfile app spec | |
rubocop=$? | |
if [ $rubocop -eq 0 ]; then | |
echo "\\033[32mRubocop passed!\\033[0;39m" | |
else | |
echo "\\033[1;31mCannot push, some cops are failing. Use --no-verify to force push.\\033[0;39m" | |
exit 1 | |
fi | |
echo "Running RSpec" | |
bundle exec rspec | |
spec=$? | |
if [ $spec -eq 0 ]; then | |
echo "\\033[32mRspec passed!\\033[0;39m" | |
exit 0 | |
else | |
echo "\\033[1;31mCannot push, some specs 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