diff options
Diffstat (limited to 'actionpack/lib/sprockets/assets.rake')
-rw-r--r-- | actionpack/lib/sprockets/assets.rake | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/actionpack/lib/sprockets/assets.rake b/actionpack/lib/sprockets/assets.rake index 0236350576..50278cffcd 100644 --- a/actionpack/lib/sprockets/assets.rake +++ b/actionpack/lib/sprockets/assets.rake @@ -1,26 +1,24 @@ 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 do - if ENV["RAILS_GROUPS"].to_s.empty? - ENV["RAILS_GROUPS"] = "assets" - Kernel.exec $0, *ARGV - else - Rake::Task["environment"].invoke - Sprockets::Helpers::RailsHelper + task :precompile => :ensure_env do + Rake::Task["environment"].invoke + Sprockets::Helpers::RailsHelper - assets = Rails.application.config.assets.precompile - Rails.application.assets.precompile(*assets) - end + 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 do assets = Rails.application.config.assets public_asset_path = Rails.public_path + assets.prefix - file_list = FileList.new("#{public_asset_path}/**/*") - file_list.each do |file| - rm_rf file - rm_rf "#{file}.gz" - end + rm_rf public_asset_path, :secure => true end end |