Created
January 20, 2012 08:51
-
-
Save kylewelsby/1646195 to your computer and use it in GitHub Desktop.
Deploying Heroku Safe Style
This file contains hidden or 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/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 |
This file contains hidden or 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
production: | |
@./clean.sh | |
git checkout production | |
git merge beta | |
@./passing.sh | |
git push production production:master | |
git push origin production:production |
This file contains hidden or 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/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