2011-03-21 19:05:56 -04:00
|
|
|
namespace :assets do
|
2011-07-21 18:30:28 -04:00
|
|
|
# Ensures the RAILS_GROUPS environment variable is set
|
|
|
|
task :ensure_env do
|
|
|
|
ENV["RAILS_GROUPS"] ||= "assets"
|
|
|
|
end
|
|
|
|
|
2011-04-18 05:18:37 -04:00
|
|
|
desc "Compile all the assets named in config.assets.precompile"
|
2011-07-21 18:30:28 -04:00
|
|
|
task :precompile => :ensure_env do
|
|
|
|
Rake::Task["environment"].invoke
|
|
|
|
Sprockets::Helpers::RailsHelper
|
2011-04-19 14:06:09 -04:00
|
|
|
|
2011-07-21 18:30:28 -04:00
|
|
|
assets = Rails.application.config.assets.precompile
|
2011-07-24 14:52:08 -04:00
|
|
|
# Always perform caching so that asset_path appends the timestamps to file references.
|
2011-07-23 19:32:14 -04:00
|
|
|
Rails.application.config.action_controller.perform_caching = true
|
2011-07-21 18:30:28 -04:00
|
|
|
Rails.application.assets.precompile(*assets)
|
2011-03-21 19:05:56 -04:00
|
|
|
end
|
2011-05-27 03:29:54 -04:00
|
|
|
|
|
|
|
desc "Remove compiled assets"
|
2011-05-27 10:42:11 -04:00
|
|
|
task :clean => :environment do
|
2011-05-27 03:29:54 -04:00
|
|
|
assets = Rails.application.config.assets
|
|
|
|
public_asset_path = Rails.public_path + assets.prefix
|
2011-07-16 18:44:00 -04:00
|
|
|
rm_rf public_asset_path, :secure => true
|
2011-05-27 03:29:54 -04:00
|
|
|
end
|
2011-03-21 19:05:56 -04:00
|
|
|
end
|