aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/sprockets/assets.rake31
1 files changed, 14 insertions, 17 deletions
diff --git a/actionpack/lib/sprockets/assets.rake b/actionpack/lib/sprockets/assets.rake
index e2536e4ac1..a801050084 100644
--- a/actionpack/lib/sprockets/assets.rake
+++ b/actionpack/lib/sprockets/assets.rake
@@ -2,25 +2,29 @@ require "fileutils"
namespace :assets do
def ruby_rake_task(task)
- env = ENV['RAILS_ENV'] || 'production'
+ env = ENV['RAILS_ENV'] || 'production'
groups = ENV['RAILS_GROUPS'] || 'assets'
- args = [$0, task,"RAILS_ENV=#{env}","RAILS_GROUPS=#{groups}"]
+ args = [$0, task,"RAILS_ENV=#{env}","RAILS_GROUPS=#{groups}"]
args << "--trace" if Rake.application.options.trace
ruby *args
end
- desc "Compile all the assets named in config.assets.precompile"
- task :precompile do
+ # We are currently running with no explicit bundler group
+ # and/or no explicit environment - we have to reinvoke rake to
+ # execute this task.
+ def invoke_or_reboot_rake_task(task)
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"
+ ruby_rake_task task
else
- Rake::Task["assets:precompile:all"].invoke
+ Rake::Task[task].invoke
end
end
+ desc "Compile all the assets named in config.assets.precompile"
+ task :precompile do
+ invoke_or_reboot_rake_task "assets:precompile:all"
+ end
+
namespace :precompile do
def internal_precompile(digest=nil)
unless Rails.application.config.assets.enabled
@@ -70,14 +74,7 @@ namespace :assets do
desc "Remove compiled assets"
task :clean do
- 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
+ invoke_or_reboot_rake_task "assets:clean:all"
end
namespace :clean do