Created
June 22, 2012 19:10
-
-
Save brianhempel/2974566 to your computer and use it in GitHub Desktop.
Production deploy checks
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
# config/deploy/production.rb | |
# okay, this is to make sure I don't miss another deploy. | |
def abort_deploy | |
puts "Deploy aborted." | |
exit 1 | |
end | |
unless `git show-ref heads/stable`.split[0] == `git show-ref heads/master`.split[0] | |
puts "Local stable branch DOES NOT match local master branch. [e]xit or [c]ontinue?" | |
case STDIN.gets | |
when /^c/i | |
else | |
abort_deploy | |
end | |
end | |
unless `git show-ref heads/stable`.split[0] == `git show-ref remotes/origin/stable`.split[0] | |
puts "Local stable branch DOES NOT match origin/stable. [e]xit, [c]ontinue, [p]ush, or [f]orce push?" | |
case STDIN.gets | |
when /^c/i | |
when /^p/i | |
%x{git push origin stable:stable} == 0 or abort_deploy | |
when /^f/i | |
%x{git push --force origin stable:stable} == 0 or abort_deploy | |
else | |
abort_deploy | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment