Created
March 21, 2012 20:27
-
-
Save rafaelp/2152548 to your computer and use it in GitHub Desktop.
Rake task to synchronous continuous deployment of Rails application deployed on Heroku
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
# -*- encoding : utf-8 -*- | |
namespace :integration do | |
namespace :heroku do | |
task :add_remote do | |
sh "git remote add staging [email protected]:nomedoprojeto-staging.git" if `git remote |grep staging`.strip.blank? | |
sh "git remote add production [email protected]:com:nomedoprojeto-production.git" if `git remote |grep production`.strip.blank? | |
end | |
task :check do | |
var = `heroku config -s --app nomedoprojeto-staging|grep INTEGRATING_BY` | |
integrating_by = var.split('=')[1] | |
integrating_by.strip! unless integrating_by.blank? | |
user = `whoami`.strip | |
if !integrating_by.blank? and integrating_by != user | |
p80 "Project is already being integrated by #{integrating_by}" | |
exit | |
end | |
end | |
task :lock do | |
user = `whoami`.strip | |
sh "heroku config:add INTEGRATING_BY=#{user} --app nomedoprojeto-staging" | |
end | |
task :unlock do | |
`heroku config:remove INTEGRATING_BY --app nomedoprojeto-staging` | |
end | |
end | |
end | |
INTEGRATION_TASKS = %w( | |
integration:start | |
integration:bundle_install | |
db:migrate | |
spec | |
integration:coverage_verify | |
integration:heroku:add_remote | |
integration:heroku:check | |
integration:heroku:lock | |
integration:hipchat:announce | |
integration:finish | |
heroku:deploy:staging | |
integration:hipchat:finish | |
integration:heroku:unlock | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment