aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-08-14 10:52:46 -0700
committerJosé Valim <jose.valim@gmail.com>2011-08-14 10:52:46 -0700
commit652ab436db674a112bcbc72d8c73e21f2ced512a (patch)
treefddb61ac06d19f2561c6918c54d3d235bf56a9a2 /actionpack
parent99f87c9ad325e610df6298a1b8dec571cd920230 (diff)
downloadrails-652ab436db674a112bcbc72d8c73e21f2ced512a.tar.gz
rails-652ab436db674a112bcbc72d8c73e21f2ced512a.tar.bz2
rails-652ab436db674a112bcbc72d8c73e21f2ced512a.zip
Ensure changing RAILS_GROUPS will load the proper dependencies.
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/sprockets/assets.rake29
1 files changed, 16 insertions, 13 deletions
diff --git a/actionpack/lib/sprockets/assets.rake b/actionpack/lib/sprockets/assets.rake
index 01132d218f..50af88c44f 100644
--- a/actionpack/lib/sprockets/assets.rake
+++ b/actionpack/lib/sprockets/assets.rake
@@ -1,18 +1,21 @@
namespace :assets do
- task :ensure_env do
- ENV["RAILS_GROUPS"] ||= "assets"
- ENV["RAILS_ENV"] ||= "production"
- end
-
desc "Compile all the assets named in config.assets.precompile"
- task :precompile => :ensure_env do
- Rake::Task["environment"].invoke
- Sprockets::Helpers::RailsHelper
+ task :precompile do
+ # We need to do this dance because RAILS_GROUPS is used
+ # too early in the boot process and changing here is already too late.
+ if ENV["RAILS_GROUPS"].to_s.empty?
+ ENV["RAILS_GROUPS"] = "assets"
+ ENV["RAILS_ENV"] ||= "production"
+ Kernel.exec $0, *ARGV
+ else
+ 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)
+ 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
end
desc "Remove compiled assets"
@@ -21,4 +24,4 @@ namespace :assets do
public_asset_path = Rails.public_path + assets.prefix
rm_rf public_asset_path, :secure => true
end
-end
+end \ No newline at end of file