Created
October 19, 2011 11:47
-
-
Save polarblau/1298064 to your computer and use it in GitHub Desktop.
Prepare Rails 3.1 app and deploy to 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
desc "Compile assets, commit them and deploy to heroku" | |
task :deploy do | |
puts legend("Precompiling assets") | |
%x(rake assets:precompile RAILS_ENV=production) | |
puts legend("Committing assets") | |
%x(git add public/assets/*) | |
%x(git commit -m "Precompiled assets for production.") | |
puts legend("Deploying") | |
%x(git push heroku master) | |
puts legend("Migrating (if necessary)") | |
%x(heroku run rake db:migrate) | |
%x(heroku open) | |
puts legend("Local clean up") | |
%x(rake assets:clean) | |
%x(git rm public/assets/* -r -f) | |
%x(git commit -m "Removed precompiled assets.") | |
%x(touch app/assets/stylesheets/application.css) | |
%x(touch app/assets/javascripts/application.js) | |
%x(git add app/assets/stylesheets/application.css) | |
%x(git add app/assets/javascripts/application.js) | |
puts legend("FYI: Touched manifest files to force rebuild") | |
end | |
def legend(output, width = 70, string = "=") | |
"\n" + string * 2 + " " + output + " " + string * (width - (output.length + 4)) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment