Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
24 lines (16 sloc) 575 Bytes
require 'rake'
desc "Deploy to Heroku."
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.restart(app)
end