diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2012-01-10 16:33:26 -0200 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2012-01-10 16:33:26 -0200 |
commit | 2e8dac660f097c0fca7e76f76eeff0aea852ee51 (patch) | |
tree | d8eb9324ccf3d8a6f3c4e398879234db979583af | |
parent | 5301f6d7b4671690b54cc063ec6b2abbdf17beee (diff) | |
download | rails-2e8dac660f097c0fca7e76f76eeff0aea852ee51.tar.gz rails-2e8dac660f097c0fca7e76f76eeff0aea852ee51.tar.bz2 rails-2e8dac660f097c0fca7e76f76eeff0aea852ee51.zip |
Rails initialization with initialize_on_precompile = false should set assets_dir
-rw-r--r-- | actionpack/lib/action_controller/railtie.rb | 5 | ||||
-rw-r--r-- | railties/test/application/assets_test.rb | 6 |
2 files changed, 10 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/railtie.rb b/actionpack/lib/action_controller/railtie.rb index 7af256fd99..fb810c41b1 100644 --- a/actionpack/lib/action_controller/railtie.rb +++ b/actionpack/lib/action_controller/railtie.rb @@ -17,11 +17,14 @@ module ActionController ActiveSupport.on_load(:action_controller) { self.cache_store ||= RAILS_CACHE } end + initializer "action_controller.assets_config", :group => :all do |app| + app.config.action_controller.assets_dir ||= app.config.paths["public"].first + end + initializer "action_controller.set_configs" do |app| paths = app.config.paths options = app.config.action_controller - options.assets_dir ||= paths["public"].first options.javascripts_dir ||= paths["public/javascripts"].first options.stylesheets_dir ||= paths["public/stylesheets"].first options.page_cache_directory ||= paths["public"].first diff --git a/railties/test/application/assets_test.rb b/railties/test/application/assets_test.rb index c18e56a606..9e2cd02d64 100644 --- a/railties/test/application/assets_test.rb +++ b/railties/test/application/assets_test.rb @@ -427,6 +427,12 @@ module ApplicationTests assert_equal "NoPost;\n", File.read("#{app_path}/public/assets/application.js") end + test "initialization on the assets group should set assets_dir" do + require "#{app_path}/config/application" + Rails.application.initialize!(:assets) + assert_not_nil Rails.application.config.action_controller.assets_dir + 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! |