From 5b6121aa3428f4fc0f12fd797abde143b97650fb Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Thu, 21 Jul 2011 15:30:28 -0700 Subject: use rake tasks to set the default environment variables. fixes #2126 --- actionpack/lib/sprockets/assets.rake | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/sprockets/assets.rake b/actionpack/lib/sprockets/assets.rake index b2c282c158..a68f0e84f8 100644 --- a/actionpack/lib/sprockets/assets.rake +++ b/actionpack/lib/sprockets/assets.rake @@ -1,16 +1,16 @@ 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 + Rails.application.assets.precompile(*assets) end desc "Remove compiled assets" -- cgit v1.2.3