diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2008-11-25 18:48:46 -0800 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2008-11-25 18:48:46 -0800 |
commit | 8d2ca7dde1993dea6f01ea504e7c1e154a09dbd0 (patch) | |
tree | c68b0a9a12b4079ad375a1172b3186a83755cabf /railties/lib | |
parent | d9c95c82e5d522f42ac866462773ee078afcddf2 (diff) | |
parent | c80fe1093deeb57eee8df11d3c4120158634cb81 (diff) | |
download | rails-8d2ca7dde1993dea6f01ea504e7c1e154a09dbd0.tar.gz rails-8d2ca7dde1993dea6f01ea504e7c1e154a09dbd0.tar.bz2 rails-8d2ca7dde1993dea6f01ea504e7c1e154a09dbd0.zip |
Merge branch 'master' of git@github.com:rails/rails
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/commands/server.rb | 16 | ||||
-rw-r--r-- | railties/lib/rails/rack.rb | 1 | ||||
-rw-r--r-- | railties/lib/rails/rack/debugger.rb | 21 |
3 files changed, 25 insertions, 13 deletions
diff --git a/railties/lib/commands/server.rb b/railties/lib/commands/server.rb index f9a444e208..a4bb52592f 100644 --- a/railties/lib/commands/server.rb +++ b/railties/lib/commands/server.rb @@ -1,6 +1,7 @@ require 'active_support' +require 'action_controller' + require 'fileutils' -require 'action_controller/vendor/rack' require 'optparse' # TODO: Push Thin adapter upstream so we don't need worry about requiring it @@ -82,22 +83,11 @@ else app = Rack::Builder.new { use Rails::Rack::Logger use Rails::Rack::Static + use Rails::Rack::Debugger if options[:debugger] run ActionController::Dispatcher.new }.to_app end -if options[:debugger] - begin - require_library_or_gem 'ruby-debug' - Debugger.start - Debugger.settings[:autoeval] = true if Debugger.respond_to?(:settings) - puts "=> Debugger enabled" - rescue Exception - puts "You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'" - exit - end -end - puts "=> Call with -d to detach" trap(:INT) { exit } diff --git a/railties/lib/rails/rack.rb b/railties/lib/rails/rack.rb index b4f32c2d95..90535674e9 100644 --- a/railties/lib/rails/rack.rb +++ b/railties/lib/rails/rack.rb @@ -1,5 +1,6 @@ module Rails module Rack + autoload :Debugger, "rails/rack/debugger" autoload :Logger, "rails/rack/logger" autoload :Static, "rails/rack/static" end diff --git a/railties/lib/rails/rack/debugger.rb b/railties/lib/rails/rack/debugger.rb new file mode 100644 index 0000000000..aa2711c616 --- /dev/null +++ b/railties/lib/rails/rack/debugger.rb @@ -0,0 +1,21 @@ +module Rails + module Rack + class Debugger + def initialize(app) + @app = app + + require_library_or_gem 'ruby-debug' + ::Debugger.start + ::Debugger.settings[:autoeval] = true if ::Debugger.respond_to?(:settings) + puts "=> Debugger enabled" + rescue Exception + puts "You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'" + exit + end + + def call(env) + @app.call(env) + end + end + end +end |