Skip to content

Commit 93559da

Browse files
committed
Remove debugger support
bebugger doesn't work with Ruby 2.2 so we don't need to support it anymore
1 parent cf01d01 commit 93559da

File tree

14 files changed

+8
-138
lines changed

14 files changed

+8
-138
lines changed

Gemfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ group :test do
6868
gem 'stackprof'
6969
end
7070

71-
# platforms :mri_19, :mri_20 do
72-
# gem 'debugger'
71+
# platforms :mri do
72+
# gem 'byebug'
7373
# end
7474

7575
gem 'benchmark-ips'
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
require 'active_support/core_ext/kernel/agnostics'
22
require 'active_support/core_ext/kernel/concern'
3-
require 'active_support/core_ext/kernel/debugger' if RUBY_VERSION < '2.0.0'
43
require 'active_support/core_ext/kernel/reporting'
54
require 'active_support/core_ext/kernel/singleton_class'
Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
module Kernel
2-
unless respond_to?(:debugger)
3-
# Starts a debugging session if the +debugger+ gem has been loaded (call rails server --debugger to load it).
4-
def debugger
5-
message = "\n***** Debugger requested, but was not available (ensure the debugger gem is listed in Gemfile/installed as gem): Start server with --debugger to enable *****\n"
6-
defined?(Rails.logger) ? Rails.logger.info(message) : $stderr.puts(message)
7-
end
8-
alias breakpoint debugger unless respond_to?(:breakpoint)
9-
end
10-
end
1+
require 'active_support/deprecation'
2+
3+
ActiveSupport::Deprecation.warn("This file is deprecated and will be removed in Rails 5.1 with no replacement.")

activesupport/test/core_ext/kernel_test.rb

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -65,27 +65,3 @@ def write(message)
6565
puts(message)
6666
end
6767
end
68-
69-
class KernelDebuggerTest < ActiveSupport::TestCase
70-
def test_debugger_not_available_message_to_stderr
71-
old_stderr = $stderr
72-
$stderr = MockStdErr.new
73-
debugger
74-
assert_match(/Debugger requested/, $stderr.output.first)
75-
ensure
76-
$stderr = old_stderr
77-
end
78-
79-
def test_debugger_not_available_message_to_rails_logger
80-
rails = Class.new do
81-
def self.logger
82-
@logger ||= MockStdErr.new
83-
end
84-
end
85-
Object.const_set(:Rails, rails)
86-
debugger
87-
assert_match(/Debugger requested/, rails.logger.output.first)
88-
ensure
89-
Object.send(:remove_const, :Rails)
90-
end
91-
end if RUBY_VERSION < '2.0.0'

guides/source/rails_on_rack.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ Here's how it loads the middlewares:
6363
```ruby
6464
def middleware
6565
middlewares = []
66-
middlewares << [Rails::Rack::Debugger] if options[:debugger]
6766
middlewares << [::Rack::ContentLength]
6867
Hash.new(middlewares)
6968
end

railties/lib/rails/commands/console.rb

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,6 @@ def parse_arguments(arguments)
1818
opt.on("-e", "--environment=name", String,
1919
"Specifies the environment to run this console under (test/development/production).",
2020
"Default: development") { |v| options[:environment] = v.strip }
21-
opt.on("--debugger", 'Enables the debugger.') do |v|
22-
if RUBY_VERSION < '2.0.0'
23-
options[:debugger] = v
24-
else
25-
puts "=> Notice: debugger option is ignored since Ruby 2.0 and " \
26-
"it will be removed in future versions."
27-
end
28-
end
2921
opt.parse!(arguments)
3022
end
3123

@@ -76,25 +68,7 @@ def set_environment!
7668
Rails.env = environment
7769
end
7870

79-
if RUBY_VERSION < '2.0.0'
80-
def debugger?
81-
options[:debugger]
82-
end
83-
84-
def require_debugger
85-
require 'debugger'
86-
puts "=> Debugger enabled"
87-
rescue LoadError
88-
puts "You're missing the 'debugger' gem. Add it to your Gemfile, bundle it and try again."
89-
exit(1)
90-
end
91-
end
92-
9371
def start
94-
if RUBY_VERSION < '2.0.0'
95-
require_debugger if debugger?
96-
end
97-
9872
set_environment! if environment?
9973

10074
if sandbox?

railties/lib/rails/commands/server.rb

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,6 @@ def option_parser(options)
2828
opts.on("-c", "--config=file", String,
2929
"Uses a custom rackup configuration.") { |v| options[:config] = v }
3030
opts.on("-d", "--daemon", "Runs server as a Daemon.") { options[:daemonize] = true }
31-
opts.on("-u", "--debugger", "Enables the debugger.") do
32-
if RUBY_VERSION < '2.0.0'
33-
options[:debugger] = true
34-
else
35-
puts "=> Notice: debugger option is ignored since Ruby 2.0 and " \
36-
"it will be removed in future versions."
37-
end
38-
end
3931
opts.on("-e", "--environment=name", String,
4032
"Specifies the environment to run this server under (test/development/production).",
4133
"Default: development") { |v| options[:environment] = v }
@@ -86,9 +78,6 @@ def start
8678

8779
def middleware
8880
middlewares = []
89-
if RUBY_VERSION < '2.0.0'
90-
middlewares << [Rails::Rack::Debugger] if options[:debugger]
91-
end
9281
middlewares << [::Rack::ContentLength]
9382

9483
# FIXME: add Rack::Lock in the case people are using webrick.
@@ -112,7 +101,6 @@ def default_options
112101
DoNotReverseLookup: true,
113102
environment: (ENV['RAILS_ENV'] || ENV['RACK_ENV'] || "development").dup,
114103
daemonize: false,
115-
debugger: false,
116104
pid: File.expand_path("tmp/pids/server.pid"),
117105
config: File.expand_path("config.ru")
118106
})

railties/lib/rails/generators/rails/app/templates/Gemfile

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,8 @@ source 'https://rubygems.org'
2323
2424
group :development, :test do
2525
<% if RUBY_ENGINE == 'ruby' -%>
26-
<%- if RUBY_VERSION < '2.0.0' -%>
27-
# Call 'debugger' anywhere in the code to stop execution and get a debugger console
28-
gem 'debugger'
29-
<%- else -%>
3026
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
3127
gem 'byebug'
32-
<%- end -%>
3328
3429
# Access an IRB console on exception pages or by using <%%= console %> in views
3530
<%- if options.dev? || options.edge? -%>

railties/lib/rails/generators/rails/plugin/templates/Gemfile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,7 @@ end
3939
<% end -%>
4040
<% if RUBY_ENGINE == 'ruby' -%>
4141
# To use a debugger
42-
<%- if RUBY_VERSION < '2.0.0' -%>
43-
# gem 'debugger', group: [:development, :test]
44-
<%- else -%>
4542
# gem 'byebug', group: [:development, :test]
46-
<%- end -%>
4743
<% end -%>
4844
4945
<% if RUBY_PLATFORM.match(/bccwin|cygwin|emx|mingw|mswin|wince|java/) -%>

railties/lib/rails/rack.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
module Rails
22
module Rack
3-
autoload :Debugger, "rails/rack/debugger" if RUBY_VERSION < '2.0.0'
4-
autoload :Logger, "rails/rack/logger"
3+
autoload :Logger, "rails/rack/logger"
54
end
65
end

0 commit comments

Comments
 (0)