From 49d5cadbb2de988b1e9662f16f26d82e86c9a473 Mon Sep 17 00:00:00 2001 From: Nicholas Seckar Date: Wed, 31 Aug 2005 00:47:51 +0000 Subject: Only load breakpoint in development mode and when BREAKPOINT_SERVER_PORT is defined. Closes #1957 git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2079 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- railties/CHANGELOG | 2 ++ railties/lib/dispatcher.rb | 13 ++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'railties') diff --git a/railties/CHANGELOG b/railties/CHANGELOG index a1360b18ce..90b7e240e0 100644 --- a/railties/CHANGELOG +++ b/railties/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Only load breakpoint in development mode and when BREAKPOINT_SERVER_PORT is defined. + * Allow the --toggle-spin switch on process/reaper to be negated * Replace render_partial with render :partial in scaffold generator [Nicholas Seckar] diff --git a/railties/lib/dispatcher.rb b/railties/lib/dispatcher.rb index aaea8dd277..58f00d7604 100644 --- a/railties/lib/dispatcher.rb +++ b/railties/lib/dispatcher.rb @@ -21,8 +21,6 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #++ -require 'breakpoint' - class Dispatcher class << self def dispatch(cgi = CGI.new, session_options = ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS, output = $stdout) @@ -47,7 +45,7 @@ class Dispatcher private def prepare_application ActionController::Routing::Routes.reload if Dependencies.load? - Breakpoint.activate_drb("druby://localhost:#{BREAKPOINT_SERVER_PORT}", nil, !defined?(FastCGI)) if defined?(BREAKPOINT_SERVER_PORT) rescue nil + prepare_breakpoint Controllers.const_load!(:ApplicationController, "application") unless Controllers.const_defined?(:ApplicationController) end @@ -55,5 +53,14 @@ class Dispatcher reset_application! if Dependencies.load? Breakpoint.deactivate_drb if defined?(BREAKPOINT_SERVER_PORT) end + + def prepare_breakpoint + return unless defined?(BREAKPOINT_SERVER_PORT) + require 'breakpoint' + Breakpoint.activate_drb("druby://localhost:#{BREAKPOINT_SERVER_PORT}", nil, !defined?(FastCGI)) + true + rescue + nil + end end end -- cgit v1.2.3