Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Ensure changing RAILS_GROUPS will load the proper dependencies.

  • Loading branch information...
commit 652ab436db674a112bcbc72d8c73e21f2ced512a 1 parent 99f87c9
@josevalim josevalim authored
Showing with 16 additions and 13 deletions.
  1. +16 −13 actionpack/lib/sprockets/assets.rake
View
29 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
Please sign in to comment.
Something went wrong with that request. Please try again.