From 80130d1201c3bf9dc17b0e1fcd81c6b22e893b0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sat, 23 Jan 2010 15:05:13 +0100 Subject: Extract routes reloading responsibilities from application and load them just upon a request. --- actionpack/lib/action_dispatch/railtie.rb | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'actionpack/lib/action_dispatch/railtie.rb') diff --git a/actionpack/lib/action_dispatch/railtie.rb b/actionpack/lib/action_dispatch/railtie.rb index e4bd143e78..bd15ca9b3b 100644 --- a/actionpack/lib/action_dispatch/railtie.rb +++ b/actionpack/lib/action_dispatch/railtie.rb @@ -5,22 +5,14 @@ module ActionDispatch class Railtie < Rails::Railtie plugin_name :action_dispatch + # Initialize route files to an array + config.action_dispatch.route_files = [] + # Prepare dispatcher callbacks and run 'prepare' callbacks initializer "action_dispatch.prepare_dispatcher" do |app| # TODO: This used to say unless defined?(Dispatcher). Find out why and fix. require 'rails/dispatcher' - - unless app.config.cache_classes - # Setup dev mode route reloading - routes_last_modified = app.routes_changed_at - reload_routes = lambda do - unless app.routes_changed_at == routes_last_modified - routes_last_modified = app.routes_changed_at - app.reload_routes! - end - end - ActionDispatch::Callbacks.before { |callbacks| reload_routes.call } - end + ActionDispatch::Callbacks.to_prepare { app.routes_reloader.reload_if_changed } end end end \ No newline at end of file -- cgit v1.2.3 From 2fde9d774b322fc708990675671231c64c691a33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sun, 24 Jan 2010 09:00:18 +0100 Subject: Solve some pendencies. --- actionpack/lib/action_dispatch/railtie.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack/lib/action_dispatch/railtie.rb') diff --git a/actionpack/lib/action_dispatch/railtie.rb b/actionpack/lib/action_dispatch/railtie.rb index bd15ca9b3b..9cc47e53ed 100644 --- a/actionpack/lib/action_dispatch/railtie.rb +++ b/actionpack/lib/action_dispatch/railtie.rb @@ -6,7 +6,7 @@ module ActionDispatch plugin_name :action_dispatch # Initialize route files to an array - config.action_dispatch.route_files = [] + config.action_dispatch.route_paths = [] # Prepare dispatcher callbacks and run 'prepare' callbacks initializer "action_dispatch.prepare_dispatcher" do |app| -- cgit v1.2.3 From e548f96b1d5cb6529dd6fbc6544f03a3a840b48c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sun, 24 Jan 2010 12:23:21 +0100 Subject: Rename plugin_name to railtie_name and engine_name. --- actionpack/lib/action_dispatch/railtie.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack/lib/action_dispatch/railtie.rb') diff --git a/actionpack/lib/action_dispatch/railtie.rb b/actionpack/lib/action_dispatch/railtie.rb index 9cc47e53ed..979679712a 100644 --- a/actionpack/lib/action_dispatch/railtie.rb +++ b/actionpack/lib/action_dispatch/railtie.rb @@ -3,7 +3,7 @@ require "rails" module ActionDispatch class Railtie < Rails::Railtie - plugin_name :action_dispatch + railtie_name :action_dispatch # Initialize route files to an array config.action_dispatch.route_paths = [] -- cgit v1.2.3 From 84ebfa4550b2325c6c89bc13aa6f904ff88d0db7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sun, 24 Jan 2010 14:48:00 +0100 Subject: Ensure metals and initializers in plugins are loaded. --- actionpack/lib/action_dispatch/railtie.rb | 3 --- 1 file changed, 3 deletions(-) (limited to 'actionpack/lib/action_dispatch/railtie.rb') diff --git a/actionpack/lib/action_dispatch/railtie.rb b/actionpack/lib/action_dispatch/railtie.rb index 979679712a..335daafc01 100644 --- a/actionpack/lib/action_dispatch/railtie.rb +++ b/actionpack/lib/action_dispatch/railtie.rb @@ -5,9 +5,6 @@ module ActionDispatch class Railtie < Rails::Railtie railtie_name :action_dispatch - # Initialize route files to an array - config.action_dispatch.route_paths = [] - # Prepare dispatcher callbacks and run 'prepare' callbacks initializer "action_dispatch.prepare_dispatcher" do |app| # TODO: This used to say unless defined?(Dispatcher). Find out why and fix. -- cgit v1.2.3