Skip to content

Instantly share code, notes, and snippets.

@ksinkar
Created December 11, 2012 05:42
Show Gist options
  • Save ksinkar/4256162 to your computer and use it in GitHub Desktop.
Save ksinkar/4256162 to your computer and use it in GitHub Desktop.
This rake task is for deploying your Ruby on Rails app to heroku
######################################################################################
##### Copyright(C) Koustubh Sinkar <[email protected]> #####
##### #####
##### This program is free software: you can redistribute it and/or modify #####
##### it under the terms of the GNU Lesser General Public License as #####
##### published by the Free Software Foundation, either version 2 of the #####
##### License, or (at your option) any later version. #####
##### #####
##### This program is distributed in the hope that it will be useful, #####
##### but WITHOUT ANY WARRANTY; without even the implied warranty of #####
##### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #####
##### GNU Lesser General Public License for more details. #####
##### #####
##### You should have received a copy of the GNU Lesser GPL #####
##### along with this program. If not, see <http://www.gnu.org/licenses/>. #####
##### #####
######################################################################################
namespace :heroku do
desc "Deploy to staging environment hosted on heroku"
task :deploy, :app do |t, args|
heroku_app = args[:app]
system("heroku maintenance:on --app #{heroku_app}")
system("git push heroku master")
system("heroku run rake db:migrate")
system("heroku maintenance:off --app #{heroku_app}")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment