Skip to content

Instantly share code, notes, and snippets.

@brianhempel
Created June 22, 2012 19:10
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 brianhempel/2974566 to your computer and use it in GitHub Desktop.
Save brianhempel/2974566 to your computer and use it in GitHub Desktop.
Production deploy checks
# 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