diff options
-rw-r--r-- | actionpack/lib/sprockets/assets.rake | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/actionpack/lib/sprockets/assets.rake b/actionpack/lib/sprockets/assets.rake index 68d9a9ca31..15cba0c475 100644 --- a/actionpack/lib/sprockets/assets.rake +++ b/actionpack/lib/sprockets/assets.rake @@ -11,7 +11,14 @@ namespace :assets do desc "Compile all the assets named in config.assets.precompile" task :precompile do - ruby_rake_task "assets:precompile:all" + if ENV['RAILS_GROUPS'].to_s.empty? || ENV['RAILS_ENV'].to_s.empty? + # We are currently running with no explicit bundler group + # and/or no explicit environment - we have to reinvoke rake to + # execute this task. + ruby_rake_task "assets:precompile:all" + else + Rake::Task["assets:precompile:all"].invoke + end end namespace :precompile do @@ -58,7 +65,14 @@ namespace :assets do desc "Remove compiled assets" task :clean do - ruby_rake_task "assets:clean:all" + if ENV['RAILS_GROUPS'].to_s.empty? || ENV['RAILS_ENV'].to_s.empty? + # We are currently running with no explicit bundler group + # and/or no explicit environment - we have to reinvoke rake to + # execute this task. + ruby_rake_task "assets:clean:all" + else + Rake::Task["assets:clean:all"].invoke + end end namespace :clean do |