Created
February 13, 2010 00:34
-
-
Save look/303146 to your computer and use it in GitHub Desktop.
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
desc "Deploy to Heroku. Pass APP=appname to deploy to a different app" | |
task :deploy do | |
require 'heroku' | |
require 'heroku/command' | |
user, pass = File.read(File.expand_path("~/.heroku/credentials")).split("\n") | |
heroku = Heroku::Client.new(user, pass) | |
cmd = Heroku::Command::BaseWithApp.new([]) | |
remotes = cmd.git_remotes(File.dirname(__FILE__) + "/../..") | |
remote, app = remotes.detect {|key, value| value == (ENV['APP'] || cmd.app)} | |
if remote.nil? | |
raise "Could not find a git remote for the '#{ENV['APP']}' app" | |
end | |
`git push #{remote} master` | |
heroku.rake(app, "db:migrate") | |
heroku.restart(app) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment