aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Pohlenz <sam@sampohlenz.com>2011-10-03 16:06:04 +1030
committerJosé Valim <jose.valim@gmail.com>2011-10-03 11:18:49 +0200
commit6f429f375e43529f2dd1a2f37cbaabeef40c6ea9 (patch)
treebdb2cf52470e847547311b82efdd48e3b616639d
parent0e1f7e0058bc06d9a9356f5b2a1e06447c024f46 (diff)
downloadrails-6f429f375e43529f2dd1a2f37cbaabeef40c6ea9.tar.gz
rails-6f429f375e43529f2dd1a2f37cbaabeef40c6ea9.tar.bz2
rails-6f429f375e43529f2dd1a2f37cbaabeef40c6ea9.zip
Ensure that enhancements to assets:precompile task are only run once
Signed-off-by: José Valim <jose.valim@gmail.com>
-rw-r--r--actionpack/lib/sprockets/assets.rake2
-rw-r--r--railties/test/application/assets_test.rb6
2 files changed, 8 insertions, 0 deletions
diff --git a/actionpack/lib/sprockets/assets.rake b/actionpack/lib/sprockets/assets.rake
index 7b86d84a27..ff678426ab 100644
--- a/actionpack/lib/sprockets/assets.rake
+++ b/actionpack/lib/sprockets/assets.rake
@@ -7,6 +7,7 @@ namespace :assets do
ENV["RAILS_GROUPS"] ||= "assets"
ENV["RAILS_ENV"] ||= "production"
ruby $0, *ARGV
+ exit
else
require "fileutils"
Rake::Task["tmp:cache:clear"].invoke
@@ -42,6 +43,7 @@ namespace :assets do
end
ENV["RAILS_ASSETS_NONDIGEST"] = "true"
ruby $0, *ARGV
+ exit
end
end
end
diff --git a/railties/test/application/assets_test.rb b/railties/test/application/assets_test.rb
index d0713620bd..6fd8808aaa 100644
--- a/railties/test/application/assets_test.rb
+++ b/railties/test/application/assets_test.rb
@@ -419,6 +419,12 @@ module ApplicationTests
assert_equal "NoPost;\n", File.read("#{app_path}/public/assets/application.js")
end
+ test "enhancements to assets:precompile should only run once" do
+ app_file "lib/tasks/enhance.rake", "Rake::Task['assets:precompile'].enhance { puts 'enhancement' }"
+ output = precompile!
+ assert_equal 1, output.scan("enhancement").size
+ end
+
private
def app_with_assets_in_view