diff options
author | José Valim <jose.valim@gmail.com> | 2012-08-01 20:54:22 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2012-08-21 14:47:19 -0300 |
commit | 2801786e1a51b7cf7d7c3fd72b5fc9974f83f435 (patch) | |
tree | 2bc2efda7c5d724ba4d85373879e75d9709355df /actionpack | |
parent | a1687e48cba2f0447f02248939cde05502562e87 (diff) | |
download | rails-2801786e1a51b7cf7d7c3fd72b5fc9974f83f435.tar.gz rails-2801786e1a51b7cf7d7c3fd72b5fc9974f83f435.tar.bz2 rails-2801786e1a51b7cf7d7c3fd72b5fc9974f83f435.zip |
Get rid of config.preload_frameworks in favor of config.eager_load_namespaces
The new option allows any Ruby namespace to be registered and set
up for eager load. We are effectively exposing the structure existing
in Rails since v3.0 for all developers in order to make their applications
thread-safe and CoW friendly.
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_controller.rb | 6 | ||||
-rw-r--r-- | actionpack/lib/action_controller/railtie.rb | 2 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch.rb | 8 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/railtie.rb | 2 | ||||
-rw-r--r-- | actionpack/lib/action_view.rb | 6 | ||||
-rw-r--r-- | actionpack/lib/action_view/railtie.rb | 2 |
6 files changed, 22 insertions, 4 deletions
diff --git a/actionpack/lib/action_controller.rb b/actionpack/lib/action_controller.rb index ceb90f8cee..31df9d605c 100644 --- a/actionpack/lib/action_controller.rb +++ b/actionpack/lib/action_controller.rb @@ -48,6 +48,12 @@ module ActionController eager_autoload do autoload :RecordIdentifier end + + def self.eager_load! + super + ActionController::Caching.eager_load! + HTML.eager_load! + end end # All of these simply register additional autoloads diff --git a/actionpack/lib/action_controller/railtie.rb b/actionpack/lib/action_controller/railtie.rb index 851a2c4aee..3ecc105e22 100644 --- a/actionpack/lib/action_controller/railtie.rb +++ b/actionpack/lib/action_controller/railtie.rb @@ -9,6 +9,8 @@ module ActionController class Railtie < Rails::Railtie #:nodoc: config.action_controller = ActiveSupport::OrderedOptions.new + config.eager_load_namespaces << ActionController + initializer "action_controller.assets_config", :group => :all do |app| app.config.action_controller.assets_dir ||= app.config.paths["public"].first end diff --git a/actionpack/lib/action_dispatch.rb b/actionpack/lib/action_dispatch.rb index b382997052..57b4678add 100644 --- a/actionpack/lib/action_dispatch.rb +++ b/actionpack/lib/action_dispatch.rb @@ -38,9 +38,11 @@ module ActionDispatch class IllegalStateError < StandardError end - autoload_under 'http' do - autoload :Request - autoload :Response + eager_autoload do + autoload_under 'http' do + autoload :Request + autoload :Response + end end autoload_under 'middleware' do diff --git a/actionpack/lib/action_dispatch/railtie.rb b/actionpack/lib/action_dispatch/railtie.rb index 5aad8dd23a..ccc0435a39 100644 --- a/actionpack/lib/action_dispatch/railtie.rb +++ b/actionpack/lib/action_dispatch/railtie.rb @@ -25,6 +25,8 @@ module ActionDispatch 'X-Content-Type-Options' => 'nosniff' } + config.eager_load_namespaces << ActionDispatch + initializer "action_dispatch.configure" do |app| ActionDispatch::Http::URL.tld_length = app.config.action_dispatch.tld_length ActionDispatch::Request.ignore_accept_header = app.config.action_dispatch.ignore_accept_header diff --git a/actionpack/lib/action_view.rb b/actionpack/lib/action_view.rb index 4bd72c5520..9d11c284f5 100644 --- a/actionpack/lib/action_view.rb +++ b/actionpack/lib/action_view.rb @@ -38,7 +38,6 @@ module ActionView autoload :PathSet autoload :Template - autoload_under "renderer" do autoload :Renderer autoload :AbstractRenderer @@ -77,6 +76,11 @@ module ActionView autoload :TestCase ENCODING_FLAG = '#.*coding[:=]\s*(\S+)[ \t]*' + + def self.eager_load! + super + ActionView::Template.eager_load! + end end require 'active_support/core_ext/string/output_safety' diff --git a/actionpack/lib/action_view/railtie.rb b/actionpack/lib/action_view/railtie.rb index 9f5e3be454..2d36deaa78 100644 --- a/actionpack/lib/action_view/railtie.rb +++ b/actionpack/lib/action_view/railtie.rb @@ -9,6 +9,8 @@ module ActionView config.action_view.javascript_expansions = { :defaults => %w(jquery jquery_ujs) } config.action_view.embed_authenticity_token_in_remote_forms = false + config.eager_load_namespaces << ActionView + initializer "action_view.embed_authenticity_token_in_remote_forms" do |app| ActiveSupport.on_load(:action_view) do ActionView::Helpers::FormTagHelper.embed_authenticity_token_in_remote_forms = |