Created
February 12, 2013 15:10
-
-
Save juandazapata/4770505 to your computer and use it in GitHub Desktop.
Deploy task to Heroku
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
# Pushes to heroku origin | |
# Call like this: | |
# >> rake deploy:heroku staging | |
# >> rake deploy:heroku production | |
namespace :deploy do | |
task :heroku do | |
current_branch = `git branch --no-color | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`.gsub("\n", "").gsub("* ", "") | |
deploy_to = ARGV[1].try(:dup) || 'staging' | |
sh "git push #{deploy_to} #{current_branch}:master -f" | |
sh "heroku run rake db:migrate -r #{deploy_to}" | |
sh "echo \"Rails.cache.clear; exit\" | heroku run console -r #{deploy_to}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment