Skip to content

Instantly share code, notes, and snippets.

@brianjlandau
Created February 23, 2012 00:59
Show Gist options
  • Select an option

  • Save brianjlandau/1888857 to your computer and use it in GitHub Desktop.

Select an option

Save brianjlandau/1888857 to your computer and use it in GitHub Desktop.
Heroku deploy plugin for cruise.rb
# Deploy To Heroku
#
class HerokuDeployer
attr_accessor :campfire_config
def initialize(project = nil)
@campfire_config = {}
end
def build_finished(build)
return if build.failed?
deploy build
end
def api
Tinder::Campfire.new(campfire_config[:domain], {
:token => campfire_config[:token],
:ssl => campfire_config[:ssl]
})
end
def room
api.find_room_by_name(campfire_config[:room])
end
def speak(msg)
room.speak msg
end
private
def deploy(build)
work_path = build.project.path + "/work/"
cmd = [
"cd #{work_path}",
"git push heroku master >> #{build.artifacts_directory}/heroku_deploy.txt 2>&1",
%Q[rvm-shell 1.9.2@pumacards -c "bundle exec heroku run rake db:migrate >> #{build.artifacts_directory}/heroku_deploy.txt"]
].join(" && ")
success = system cmd
notify(success, build)
end
def notify(success, build)
if success
speak "#{build.project.name} build #{build.label} has been deployed to Heroku! :+1:"
else
speak "#{build.project.name} build #{build.label} could not be deployed to Heroku! :-1:"
end
end
end
Project.plugin :heroku_deployer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment