diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-07-21 15:30:28 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-07-21 15:30:28 -0700 |
commit | 5b6121aa3428f4fc0f12fd797abde143b97650fb (patch) | |
tree | a1dbd18368b5d9f392a548c5684bf6a14f6d79a9 | |
parent | bb7e35531e181439ff4a454296a78a00fe1e8723 (diff) | |
download | rails-5b6121aa3428f4fc0f12fd797abde143b97650fb.tar.gz rails-5b6121aa3428f4fc0f12fd797abde143b97650fb.tar.bz2 rails-5b6121aa3428f4fc0f12fd797abde143b97650fb.zip |
use rake tasks to set the default environment variables. fixes #2126
-rw-r--r-- | actionpack/lib/sprockets/assets.rake | 20 |
1 files changed, 10 insertions, 10 deletions
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" |