From d7396b5ca9c066cb16158c02b976dab01f522344 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Tue, 14 Apr 2009 17:06:32 -0500 Subject: Move reloader middleware in ActionDispatch --- actionpack/lib/action_controller.rb | 1 - actionpack/lib/action_controller/dispatch/dispatcher.rb | 4 ++-- actionpack/lib/action_controller/reloader.rb | 14 -------------- actionpack/lib/action_dispatch.rb | 1 + actionpack/lib/action_dispatch/middleware/reloader.rb | 14 ++++++++++++++ 5 files changed, 17 insertions(+), 17 deletions(-) delete mode 100644 actionpack/lib/action_controller/reloader.rb create mode 100644 actionpack/lib/action_dispatch/middleware/reloader.rb (limited to 'actionpack') diff --git a/actionpack/lib/action_controller.rb b/actionpack/lib/action_controller.rb index 9eb7474b55..e52690ebf6 100644 --- a/actionpack/lib/action_controller.rb +++ b/actionpack/lib/action_controller.rb @@ -57,7 +57,6 @@ module ActionController autoload :PolymorphicRoutes, 'action_controller/routing/generation/polymorphic_routes' autoload :RecordIdentifier, 'action_controller/record_identifier' autoload :Redirector, 'action_controller/base/redirect' - autoload :Reloader, 'action_controller/reloader' autoload :Renderer, 'action_controller/base/render' autoload :RequestForgeryProtection, 'action_controller/base/request_forgery_protection' autoload :Rescue, 'action_controller/dispatch/rescue' diff --git a/actionpack/lib/action_controller/dispatch/dispatcher.rb b/actionpack/lib/action_controller/dispatch/dispatcher.rb index 8ed7de4788..bb9d8bd063 100644 --- a/actionpack/lib/action_controller/dispatch/dispatcher.rb +++ b/actionpack/lib/action_controller/dispatch/dispatcher.rb @@ -5,8 +5,8 @@ module ActionController class << self def define_dispatcher_callbacks(cache_classes) unless cache_classes - unless self.middleware.include?(Reloader) - self.middleware.insert_after(ActionDispatch::Failsafe, Reloader) + unless self.middleware.include?(ActionDispatch::Reloader) + self.middleware.insert_after(ActionDispatch::Failsafe, ActionDispatch::Reloader) end ActionView::Helpers::AssetTagHelper.cache_asset_timestamps = false diff --git a/actionpack/lib/action_controller/reloader.rb b/actionpack/lib/action_controller/reloader.rb deleted file mode 100644 index 46789309cd..0000000000 --- a/actionpack/lib/action_controller/reloader.rb +++ /dev/null @@ -1,14 +0,0 @@ -module ActionController - class Reloader - def initialize(app) - @app = app - end - - def call(env) - Dispatcher.reload_application - @app.call(env) - ensure - Dispatcher.cleanup_application - end - end -end diff --git a/actionpack/lib/action_dispatch.rb b/actionpack/lib/action_dispatch.rb index f36e655c16..bd5a38cc82 100644 --- a/actionpack/lib/action_dispatch.rb +++ b/actionpack/lib/action_dispatch.rb @@ -46,6 +46,7 @@ module ActionDispatch autoload :Failsafe, 'action_dispatch/middleware/failsafe' autoload :ParamsParser, 'action_dispatch/middleware/params_parser' + autoload :Reloader, 'action_dispatch/middleware/reloader' autoload :RewindableInput, 'action_dispatch/middleware/rewindable_input' autoload :MiddlewareStack, 'action_dispatch/middleware/stack' diff --git a/actionpack/lib/action_dispatch/middleware/reloader.rb b/actionpack/lib/action_dispatch/middleware/reloader.rb new file mode 100644 index 0000000000..67313e30e4 --- /dev/null +++ b/actionpack/lib/action_dispatch/middleware/reloader.rb @@ -0,0 +1,14 @@ +module ActionDispatch + class Reloader + def initialize(app) + @app = app + end + + def call(env) + ActionController::Dispatcher.reload_application + @app.call(env) + ensure + ActionController::Dispatcher.cleanup_application + end + end +end -- cgit v1.2.3