Created
February 26, 2010 20:33
-
-
Save nirvdrum/316119 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
stylesheet_link_tag(AssetCache::BASE_CSS, :cache => 'cached/base') |
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
class AssetCache | |
include ActionView::Helpers::TagHelper | |
include ActionView::Helpers::AssetTagHelper | |
BASE_CSS = ['jquery-ui', 'formtastic', 'mogo'] | |
def warm | |
stylesheet_link_tag(BASE_CSS, :cache => 'cached/base') | |
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
namespace :assets do | |
desc "Warm the asset caches" | |
task :warm_caches => :environment do | |
AssetCache.new.warm | |
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
before 'deploy:restart', 'warm_asset_caches' | |
task :warm_asset_caches, :roles => :app do | |
run "cd #{current_path}; RAILS_ENV=#{RUBBER_ENV} rake assets:warm_caches" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment