1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

set env to let rails know we're precompiling

This commit is contained in:
Terence Lee 2011-09-22 12:03:59 -05:00 committed by José Valim
parent 1de89e5e07
commit 9d46823b5d
2 changed files with 12 additions and 0 deletions

View file

@ -1,6 +1,9 @@
namespace :assets do
desc "Compile all the assets named in config.assets.precompile"
task :precompile do
# let rails know we're precompiling assets
ENV["RAILS_ASSETS_PRECOMPILE"] = 'true'
# 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_ENV"].to_s.empty?

View file

@ -102,6 +102,15 @@ module ApplicationTests
assert !File.exists?("#{app_path}/public/assets/something.min.css")
end
test "precompile sets flag notifying rails its precompiling" do
compile = <<COMPILE
raise "ENV RAILS_ASSETS_PRECOMPILE not set" unless ENV["RAILS_ASSETS_PRECOMPILE"]
COMPILE
app_file "config/initializers/compile.rb", compile
Dir.chdir(app_path){ `bundle exec rake assets:precompile` }
assert $?.success?
end
test "asset pipeline should use a Sprockets::Index when config.assets.digest is true" do
add_to_config "config.assets.digest = true"
add_to_config "config.action_controller.perform_caching = false"