Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Run `rake` before push. Because reasons.
cd /path/to/your/repo
curl https://gist.githubusercontent.com/kuzmik/c08864648e4721f96a2a3050384ee030/raw/dad37f43037e44af991c81e65c9a739669d0556a/pre-push.sh > .git/hooks/pre-push
chmod u+x .git/hooks/pre-push
#!/usr/bin/env bash
echo "Running rake"
bundle exec rake
spec=$?
echo "Running brakeman"
brakeman -5 --progress --no-pager
brk=$?
if [ $spec -eq 0 ] && [ $brk -eq 0 ]; then
echo -en "\\033[32mTests are green, pushing...\\033[0;39m\n"
exit 0
else
echo -en "\\033[1;31mCannot push, tests are failing. Use --no-verify to force push.\\033[0;39m\n"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.