Skip to content

Instantly share code, notes, and snippets.

@nickserv
Created August 19, 2014 17:17
Show Gist options
  • Save nickserv/da14566ed730b4944416 to your computer and use it in GitHub Desktop.
Save nickserv/da14566ed730b4944416 to your computer and use it in GitHub Desktop.
Rake task for deploying a Rails app to Heroku
# Deploy to Heroku in production
task deploy: ['deploy:push', 'deploy:migrate']
namespace :deploy do
APP = 'openatrit'
task :push do
puts 'Deploying site to Heroku ...'
puts `git push -f [email protected]:#{APP}.git master`
end
task :restart do
puts 'Restarting app servers ...'
puts `heroku restart --app #{APP}`
end
task :migrate do
puts 'Running database migrations ...'
puts `heroku run rake db:migrate --app #{APP}`
end
task :off do
puts 'Putting the app into maintenance mode ...'
puts `heroku maintenance:on --app #{APP}`
end
task :on do
puts 'Taking the app out of maintenance mode ...'
puts `heroku maintenance:off --app #{APP}`
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment