Skip to content

Instantly share code, notes, and snippets.

@ryane
Created May 18, 2013 17:47
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 ryane/5605255 to your computer and use it in GitHub Desktop.
Save ryane/5605255 to your computer and use it in GitHub Desktop.
A pre-commit hook that forces specs to run if you are on the master branch
#!/bin/sh
if [ "$(git rev-parse --abbrev-ref HEAD)" == "master" ]
then
if [ -f FORCE_COMMIT ]
then
rm FORCE_COMMIT
exit 0
else
echo "Running specs since you are committing to master..."
bundle exec rake db:migrate
bundle exec rake db:test:prepare
bundle exec rspec spec --order rand
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment