diff options
author | Joshua Peek <josh@joshpeek.com> | 2008-11-25 14:48:09 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2008-11-25 15:05:07 -0600 |
commit | c80fe1093deeb57eee8df11d3c4120158634cb81 (patch) | |
tree | 05e234c2eb291d72d453a7df8b27bb15fe79bac9 /railties/lib/rails | |
parent | 07abc5efe1bc71902b0c517ef97dcb36564f2336 (diff) | |
download | rails-c80fe1093deeb57eee8df11d3c4120158634cb81.tar.gz rails-c80fe1093deeb57eee8df11d3c4120158634cb81.tar.bz2 rails-c80fe1093deeb57eee8df11d3c4120158634cb81.zip |
Move debugger into middleware
Diffstat (limited to 'railties/lib/rails')
-rw-r--r-- | railties/lib/rails/rack.rb | 1 | ||||
-rw-r--r-- | railties/lib/rails/rack/debugger.rb | 21 |
2 files changed, 22 insertions, 0 deletions
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 |