Created
May 24, 2012 16:11
-
-
Save erbmicha/2782474 to your computer and use it in GitHub Desktop.
Ruby script to more easily deploy to environments with their own branches when using capistrano-multistage
This file contains 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
#!/usr/bin/env ruby | |
if ARGV.size < 2 | |
puts "Usage: deployto <environment> <branch name>" | |
else | |
begin | |
env = ARGV[0] | |
branch = ARGV[1] | |
system("git checkout #{env};git merge #{branch};git push origin #{env};cap #{env} deploy:migrations;") | |
system("cap #{env} deploy:cleanup") | |
rescue | |
puts "Error: #{$?}" | |
ensure | |
system("git checkout #{branch}") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment