Skip to content

Instantly share code, notes, and snippets.

@luchiago
Created April 23, 2020 03:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luchiago/414bd3486dfd137d3d1c6a8fbeac9aa7 to your computer and use it in GitHub Desktop.
Save luchiago/414bd3486dfd137d3d1c6a8fbeac9aa7 to your computer and use it in GitHub Desktop.
Hook for pre-push
// pre-push
#!/usr/bin/env bash
echo "Running pre-push hook"
./scripts/run-brakeman.bash
./scripts/run-tests.bash
# $? stores exit value of the last command
if [ $? -ne 0 ]; then
echo "Brakeman and Tests must pass before pushing!"
exit 1
fi
// run-brakeman.bash
#!/usr/bin/env bash
set -e
cd "${0%/*}/../.."
echo "Running brakeman"
bundle exec brakeman
// run-tests.bash
#!/usr/bin/env bash
set -e
cd "${0%/*}/../.."
echo "Running rspec"
bundle exec rspec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment