-
-
Save nruth/838686 to your computer and use it in GitHub Desktop.
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
#as seen in https://github.com/mooktakim/heroku_deployment | |
class AppTemplatesController < ApplicationController | |
def app | |
render :inline => "SUCCESS", :layout => 'master' | |
end | |
def cms | |
render :inline => "SUCCESS", :layout => 'cms_admin' | |
end | |
end |
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 "cache assets" | |
task :cache_assets => :environment do | |
paths = ['public/javascripts/all.js', 'public/stylesheets/all.css', 'public/stylesheets/_cms.css'] | |
puts "-----> caching assets..." | |
paths.each do |path| | |
puts "-----> #{path}" | |
end | |
paths.each do |path| | |
FileUtils.rm(path) if File.exist?(path) | |
end | |
ActionController::Base.perform_caching = true | |
session = ActionDispatch::Integration::Session.new(Rails.application) | |
session.get('/caching/cms_templates') | |
session.get('/caching/app_templates') | |
paths.each do |path| | |
if File.exist?(path) | |
system("git add #{path}") ? true : fail | |
end | |
end | |
if paths.map {|path| %x[git status -s #{path}]}.any? {|p| p.present?} | |
puts "-----> committing cached assets" | |
system("git commit -m 'updating cache_assets'") ? true : fail | |
else | |
puts "-----> nothing to commit" | |
end | |
puts "-----> done" | |
end |
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 "cache assets, push to github, deploy to heroku, and notify hoptoad" | |
task :deploy => :environment do | |
puts "-----> running rake cache_assets" | |
system("rake cache_assets") ? true : fail | |
puts "-----> pushing to github" | |
system("git push origin master") ? true : fail | |
puts "-----> deploying to heroku" | |
system("git push heroku master") ? true : fail | |
puts "-----> notifying hoptoad" | |
system("rake hoptoad:deploy TO=production REVISION=`git rev-parse HEAD`") ? true : fail | |
puts "-----> done" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
work around devise auth by having a special route/controller setup for rendering particular layouts with no content
also checks that the expected files have been modified in git, not other unstaged changes, as the precondition for a new commit