Skip to content

Instantly share code, notes, and snippets.

@kylewelsby
Created January 20, 2012 08:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kylewelsby/1646195 to your computer and use it in GitHub Desktop.
Save kylewelsby/1646195 to your computer and use it in GitHub Desktop.
Deploying Heroku Safe Style
#!/bin/bash
# This tool checks if there are any uncommitted changes in the current git branch.
# If it finds any uncommited changes it exits with an error.
# We use it to prevent pushing dirty changes to production.
clean=$(git status | grep "nothing to commit (working directory clean)")
if [ -z "$clean" ]; then
echo There are uncommitted changes.
exit 1
else
echo Branch is clean.
fi
production:
@./clean.sh
git checkout production
git merge beta
@./passing.sh
git push production production:master
git push origin production:production
#!/bin/bash
# This tool checks for a full passing test suite.
# If either RSpec or Spinach fail passing specs, it'll raise an error.
rspec=$(bundle exec rspec | grep "[0-9]* examples, 0 failures")
spinach=$(bundle exec spinach | grep "Steps Summary: ([0-9]*) Successful, (0) Undefined, (0) Failed, (0) Error")
if [ -z "$rspec" ]; then
echo RSpec tests are not passing, go and fix them before deploying.
exit 1
else
if [ -z "$spinach" ]; then
echo Spinach tests are not passing, go and fix them before deploying.
exit 1
fi
echo All tests are fine.
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment