diff --git a/Gemfile b/Gemfile index 821a7b914ed86326900089b8c2cc2bdf9cfba0b4..eb0a324ab2a5faf9e70d37adb0550560d9adb356 100644 --- a/Gemfile +++ b/Gemfile @@ -68,8 +68,8 @@ group :test do gem 'stackprof' end - # platforms :mri_19, :mri_20 do - # gem 'debugger' + # platforms :mri do + # gem 'byebug' # end gem 'benchmark-ips' diff --git a/activesupport/lib/active_support/core_ext/kernel.rb b/activesupport/lib/active_support/core_ext/kernel.rb index 293a3b2619e1cf7503366bd32395626182ca5d4a..364ed9d65fdb3a3a112456076fcaefc82eedb5f1 100644 --- a/activesupport/lib/active_support/core_ext/kernel.rb +++ b/activesupport/lib/active_support/core_ext/kernel.rb @@ -1,5 +1,4 @@ require 'active_support/core_ext/kernel/agnostics' require 'active_support/core_ext/kernel/concern' -require 'active_support/core_ext/kernel/debugger' if RUBY_VERSION < '2.0.0' require 'active_support/core_ext/kernel/reporting' require 'active_support/core_ext/kernel/singleton_class' diff --git a/activesupport/lib/active_support/core_ext/kernel/debugger.rb b/activesupport/lib/active_support/core_ext/kernel/debugger.rb index ddf66b20225dc34db86c16c79c054a1fade28aeb..1fde3db070670ce544e208ca660916b015a6a6c2 100644 --- a/activesupport/lib/active_support/core_ext/kernel/debugger.rb +++ b/activesupport/lib/active_support/core_ext/kernel/debugger.rb @@ -1,10 +1,3 @@ -module Kernel - unless respond_to?(:debugger) - # Starts a debugging session if the +debugger+ gem has been loaded (call rails server --debugger to load it). - def debugger - 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" - defined?(Rails.logger) ? Rails.logger.info(message) : $stderr.puts(message) - end - alias breakpoint debugger unless respond_to?(:breakpoint) - end -end +require 'active_support/deprecation' + +ActiveSupport::Deprecation.warn("This file is deprecated and will be removed in Rails 5.1 with no replacement.") diff --git a/activesupport/test/core_ext/kernel_test.rb b/activesupport/test/core_ext/kernel_test.rb index 8abbd6c69b87bd6c2739211d8af3b91e01962868..503e6595cbc2ca102a816f7bf15dfdfff7c1f176 100644 --- a/activesupport/test/core_ext/kernel_test.rb +++ b/activesupport/test/core_ext/kernel_test.rb @@ -65,27 +65,3 @@ def write(message) puts(message) end end - -class KernelDebuggerTest < ActiveSupport::TestCase - def test_debugger_not_available_message_to_stderr - old_stderr = $stderr - $stderr = MockStdErr.new - debugger - assert_match(/Debugger requested/, $stderr.output.first) - ensure - $stderr = old_stderr - end - - def test_debugger_not_available_message_to_rails_logger - rails = Class.new do - def self.logger - @logger ||= MockStdErr.new - end - end - Object.const_set(:Rails, rails) - debugger - assert_match(/Debugger requested/, rails.logger.output.first) - ensure - Object.send(:remove_const, :Rails) - end -end if RUBY_VERSION < '2.0.0' diff --git a/guides/source/rails_on_rack.md b/guides/source/rails_on_rack.md index bfe4ced87be2126230ef8ee2dbeb5fcdb5580577..561a3d9392d7fe2f66404fe32a5b279830684604 100644 --- a/guides/source/rails_on_rack.md +++ b/guides/source/rails_on_rack.md @@ -63,7 +63,6 @@ Here's how it loads the middlewares: ```ruby def middleware middlewares = [] - middlewares << [Rails::Rack::Debugger] if options[:debugger] middlewares << [::Rack::ContentLength] Hash.new(middlewares) end diff --git a/railties/lib/rails/commands/console.rb b/railties/lib/rails/commands/console.rb index 96ced3c2f9622e99c126c441e0764390870a795f..35a815a34ff845a608ecd6719f41150e6c10aa51 100644 --- a/railties/lib/rails/commands/console.rb +++ b/railties/lib/rails/commands/console.rb @@ -18,14 +18,6 @@ def parse_arguments(arguments) opt.on("-e", "--environment=name", String, "Specifies the environment to run this console under (test/development/production).", "Default: development") { |v| options[:environment] = v.strip } - opt.on("--debugger", 'Enables the debugger.') do |v| - if RUBY_VERSION < '2.0.0' - options[:debugger] = v - else - puts "=> Notice: debugger option is ignored since Ruby 2.0 and " \ - "it will be removed in future versions." - end - end opt.parse!(arguments) end @@ -76,25 +68,7 @@ def set_environment! Rails.env = environment end - if RUBY_VERSION < '2.0.0' - def debugger? - options[:debugger] - end - - def require_debugger - require 'debugger' - puts "=> Debugger enabled" - rescue LoadError - puts "You're missing the 'debugger' gem. Add it to your Gemfile, bundle it and try again." - exit(1) - end - end - def start - if RUBY_VERSION < '2.0.0' - require_debugger if debugger? - end - set_environment! if environment? if sandbox? diff --git a/railties/lib/rails/commands/server.rb b/railties/lib/rails/commands/server.rb index 3f14910edf1c66c7e85c8b2407118ea3c1ccee16..bc8f1a8dea34a31299bed9f25649e9cac9fb0efc 100644 --- a/railties/lib/rails/commands/server.rb +++ b/railties/lib/rails/commands/server.rb @@ -28,14 +28,6 @@ def option_parser(options) opts.on("-c", "--config=file", String, "Uses a custom rackup configuration.") { |v| options[:config] = v } opts.on("-d", "--daemon", "Runs server as a Daemon.") { options[:daemonize] = true } - opts.on("-u", "--debugger", "Enables the debugger.") do - if RUBY_VERSION < '2.0.0' - options[:debugger] = true - else - puts "=> Notice: debugger option is ignored since Ruby 2.0 and " \ - "it will be removed in future versions." - end - end opts.on("-e", "--environment=name", String, "Specifies the environment to run this server under (test/development/production).", "Default: development") { |v| options[:environment] = v } @@ -86,9 +78,6 @@ def start def middleware middlewares = [] - if RUBY_VERSION < '2.0.0' - middlewares << [Rails::Rack::Debugger] if options[:debugger] - end middlewares << [::Rack::ContentLength] # FIXME: add Rack::Lock in the case people are using webrick. @@ -112,7 +101,6 @@ def default_options DoNotReverseLookup: true, environment: (ENV['RAILS_ENV'] || ENV['RACK_ENV'] || "development").dup, daemonize: false, - debugger: false, pid: File.expand_path("tmp/pids/server.pid"), config: File.expand_path("config.ru") }) diff --git a/railties/lib/rails/generators/rails/app/templates/Gemfile b/railties/lib/rails/generators/rails/app/templates/Gemfile index ecaec618dc50b2afc28fb33dd7825a12f1e93b33..3659edcfcd05cd98308cc69289d849bea37caf69 100644 --- a/railties/lib/rails/generators/rails/app/templates/Gemfile +++ b/railties/lib/rails/generators/rails/app/templates/Gemfile @@ -23,13 +23,8 @@ source 'https://rubygems.org' group :development, :test do <% if RUBY_ENGINE == 'ruby' -%> - <%- if RUBY_VERSION < '2.0.0' -%> - # Call 'debugger' anywhere in the code to stop execution and get a debugger console - gem 'debugger' - <%- else -%> # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug' - <%- end -%> # Access an IRB console on exception pages or by using <%%= console %> in views <%- if options.dev? || options.edge? -%> diff --git a/railties/lib/rails/generators/rails/plugin/templates/Gemfile b/railties/lib/rails/generators/rails/plugin/templates/Gemfile index 84cef9525e11065b481719c3c3558a13f62a5e05..f325455bac199412c363b2b70c3b7a71ee151e88 100644 --- a/railties/lib/rails/generators/rails/plugin/templates/Gemfile +++ b/railties/lib/rails/generators/rails/plugin/templates/Gemfile @@ -39,11 +39,7 @@ end <% end -%> <% if RUBY_ENGINE == 'ruby' -%> # To use a debugger - <%- if RUBY_VERSION < '2.0.0' -%> -# gem 'debugger', group: [:development, :test] - <%- else -%> # gem 'byebug', group: [:development, :test] - <%- end -%> <% end -%> <% if RUBY_PLATFORM.match(/bccwin|cygwin|emx|mingw|mswin|wince|java/) -%> diff --git a/railties/lib/rails/rack.rb b/railties/lib/rails/rack.rb index f34bf2fd4135daa18050a2026ca431c1ae5f5afe..a4c4527a7220d07b8bba0681ae56e683b7abe8d5 100644 --- a/railties/lib/rails/rack.rb +++ b/railties/lib/rails/rack.rb @@ -1,6 +1,5 @@ module Rails module Rack - autoload :Debugger, "rails/rack/debugger" if RUBY_VERSION < '2.0.0' - autoload :Logger, "rails/rack/logger" + autoload :Logger, "rails/rack/logger" end end diff --git a/railties/lib/rails/rack/debugger.rb b/railties/lib/rails/rack/debugger.rb index f7b77bcb3b9046862352247537c67b3bf8595d3b..1fde3db070670ce544e208ca660916b015a6a6c2 100644 --- a/railties/lib/rails/rack/debugger.rb +++ b/railties/lib/rails/rack/debugger.rb @@ -1,24 +1,3 @@ -module Rails - module Rack - class Debugger - def initialize(app) - @app = app +require 'active_support/deprecation' - ARGV.clear # clear ARGV so that rails server options aren't passed to IRB - - require 'debugger' - - ::Debugger.start - ::Debugger.settings[:autoeval] = true if ::Debugger.respond_to?(:settings) - puts "=> Debugger enabled" - rescue LoadError - puts "You're missing the 'debugger' gem. Add it to your Gemfile, bundle it and try again." - exit(1) - end - - def call(env) - @app.call(env) - end - end - end -end +ActiveSupport::Deprecation.warn("This file is deprecated and will be removed in Rails 5.1 with no replacement.") diff --git a/railties/test/commands/console_test.rb b/railties/test/commands/console_test.rb index 4aea3e980f0cd25d6da5a908a879c94efaf545b2..de0cf0ba9e49a6729cc1a00cf6b0be7ff707101e 100644 --- a/railties/test/commands/console_test.rb +++ b/railties/test/commands/console_test.rb @@ -46,28 +46,6 @@ def test_start_with_sandbox assert_match(/Loading \w+ environment in sandbox \(Rails/, output) end - if RUBY_VERSION < '2.0.0' - def test_debugger_option - console = Rails::Console.new(app, parse_arguments(["--debugger"])) - assert console.debugger? - end - - def test_no_options_does_not_set_debugger_flag - console = Rails::Console.new(app, parse_arguments([])) - assert !console.debugger? - end - - def test_start_with_debugger - stubbed_console = Class.new(Rails::Console) do - def require_debugger - end - end - - rails_console = stubbed_console.new(app, parse_arguments(["--debugger"])) - silence_stream(STDOUT) { rails_console.start } - end - end - def test_console_with_environment start ["-e production"] assert_match(/\sproduction\s/, output) diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index e30c9a7b2f889fe0db491600d7c4c56e9988da7d..40fd7b77f13fa937d994bb776d54713f7da6b33c 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -403,10 +403,7 @@ def test_inclusion_of_a_debugger if defined?(JRUBY_VERSION) || RUBY_ENGINE == "rbx" assert_file "Gemfile" do |content| assert_no_match(/byebug/, content) - assert_no_match(/debugger/, content) end - elsif RUBY_VERSION < '2.0.0' - assert_gem 'debugger' else assert_gem 'byebug' end diff --git a/railties/test/generators/plugin_generator_test.rb b/railties/test/generators/plugin_generator_test.rb index e9f06a1fd7a55dc54f4ee5996eecad1e3761ac54..318ea5b2cb96ef8e035dfc9a5892b5fd2dce5dd2 100644 --- a/railties/test/generators/plugin_generator_test.rb +++ b/railties/test/generators/plugin_generator_test.rb @@ -74,10 +74,7 @@ def test_inclusion_of_a_debugger if defined?(JRUBY_VERSION) || RUBY_ENGINE == "rbx" assert_file "Gemfile" do |content| assert_no_match(/byebug/, content) - assert_no_match(/debugger/, content) end - elsif RUBY_VERSION < '2.0.0' - assert_file "Gemfile", /# gem 'debugger'/ else assert_file "Gemfile", /# gem 'byebug'/ end