diff options
Diffstat (limited to 'railties/lib/rails/tasks/assets.rake')
-rw-r--r-- | railties/lib/rails/tasks/assets.rake | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/railties/lib/rails/tasks/assets.rake b/railties/lib/rails/tasks/assets.rake index 4678ea460e..0236350576 100644 --- a/railties/lib/rails/tasks/assets.rake +++ b/railties/lib/rails/tasks/assets.rake @@ -1,21 +1,26 @@ namespace :assets do desc "Compile all the assets named in config.assets.precompile" - task :precompile => :environment do - # Give assets access to asset_path - Sprockets::Helpers::RailsHelper + 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 - assets = Rails.application.config.assets.precompile - Rails.application.assets.precompile(*assets) + assets = Rails.application.config.assets.precompile + Rails.application.assets.precompile(*assets) + end 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}/*.js", "#{public_asset_path}/*.css") + file_list = FileList.new("#{public_asset_path}/**/*") file_list.each do |file| - rm file - rm "#{file}.gz", :force => true + rm_rf file + rm_rf "#{file}.gz" end end end |