1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/actionpack/lib/sprockets/assets.rake
Ilya Grigorik 050c1510b6 Clear out tmp/cache when assets:clean is invoked.
Otherwise, if bad data is cached in tmp/clear then the next invocation
of assets:precompile (or a regular incoming request) will pickup files from
tmp without regenerating them from source.
2011-08-04 23:54:22 -04:00

24 lines
838 B
Ruby

namespace :assets do
# Ensures the RAILS_GROUPS environment variable is set
task :ensure_env do
ENV["RAILS_GROUPS"] ||= "assets"
end
desc "Compile all the assets named in config.assets.precompile"
task :precompile => :ensure_env do
Rake::Task["environment"].invoke
Sprockets::Helpers::RailsHelper
assets = Rails.application.config.assets.precompile
# Always perform caching so that asset_path appends the timestamps to file references.
Rails.application.config.action_controller.perform_caching = true
Rails.application.assets.precompile(*assets)
end
desc "Remove compiled assets"
task :clean => [:environment, 'tmp:cache:clear'] do
assets = Rails.application.config.assets
public_asset_path = Rails.public_path + assets.prefix
rm_rf public_asset_path, :secure => true
end
end