aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Rodríguez de Dios <deivid.rodriguez@gmail.com>2014-04-08 20:55:23 +0200
committerDavid Rodríguez de Dios <deivid.rodriguez@gmail.com>2014-04-08 20:55:23 +0200
commit7901ae13a1d8187c1b620b51df7d840818fd759d (patch)
tree23aa668fe744dad54b3f2bbd787726aff00c60ec
parent75e0ee861f78d6b76ca8d6f7bf74b9dc1ca03bc3 (diff)
downloadrails-7901ae13a1d8187c1b620b51df7d840818fd759d.tar.gz
rails-7901ae13a1d8187c1b620b51df7d840818fd759d.tar.bz2
rails-7901ae13a1d8187c1b620b51df7d840818fd759d.zip
Keep debugger support only for rubies < 2.0.0
-rw-r--r--activesupport/lib/active_support/core_ext/kernel.rb2
-rw-r--r--activesupport/test/core_ext/kernel_test.rb2
-rw-r--r--railties/lib/rails/commands/console.rb18
-rw-r--r--railties/lib/rails/commands/server.rb13
-rw-r--r--railties/lib/rails/rack.rb2
-rw-r--r--railties/test/commands/console_test.rb6
6 files changed, 31 insertions, 12 deletions
diff --git a/activesupport/lib/active_support/core_ext/kernel.rb b/activesupport/lib/active_support/core_ext/kernel.rb
index aa19aed43b..293a3b2619 100644
--- a/activesupport/lib/active_support/core_ext/kernel.rb
+++ b/activesupport/lib/active_support/core_ext/kernel.rb
@@ -1,5 +1,5 @@
require 'active_support/core_ext/kernel/agnostics'
require 'active_support/core_ext/kernel/concern'
-require 'active_support/core_ext/kernel/debugger'
+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/test/core_ext/kernel_test.rb b/activesupport/test/core_ext/kernel_test.rb
index 18b251173f..d8bf81d02b 100644
--- a/activesupport/test/core_ext/kernel_test.rb
+++ b/activesupport/test/core_ext/kernel_test.rb
@@ -137,4 +137,4 @@ class KernelDebuggerTest < ActiveSupport::TestCase
ensure
Object.send(:remove_const, :Rails)
end
-end
+end if RUBY_VERSION < '2.0.0'
diff --git a/railties/lib/rails/commands/console.rb b/railties/lib/rails/commands/console.rb
index f6bdf129d6..fdc8662bcd 100644
--- a/railties/lib/rails/commands/console.rb
+++ b/railties/lib/rails/commands/console.rb
@@ -18,7 +18,14 @@ module Rails
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", 'Enable the debugger.') { |v| options[:debugger] = v }
+ opt.on("--debugger", 'Enable 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
@@ -71,10 +78,13 @@ module Rails
def debugger?
options[:debugger]
- end
+ end if RUBY_VERSION < '2.0.0'
def start
- require_debugger if debugger?
+ if RUBY_VERSION < '2.0.0'
+ require_debugger if debugger?
+ end
+
set_environment! if environment?
if sandbox?
@@ -96,6 +106,6 @@ module Rails
rescue LoadError
puts "You're missing the 'debugger' gem. Add it to your Gemfile, bundle it and try again."
exit(1)
- end
+ end if RUBY_VERSION < '2.0.0'
end
end
diff --git a/railties/lib/rails/commands/server.rb b/railties/lib/rails/commands/server.rb
index fec4962fb5..6146b6c1db 100644
--- a/railties/lib/rails/commands/server.rb
+++ b/railties/lib/rails/commands/server.rb
@@ -18,7 +18,14 @@ module Rails
opts.on("-c", "--config=file", String,
"Use custom rackup configuration file") { |v| options[:config] = v }
opts.on("-d", "--daemon", "Make server run as a Daemon.") { options[:daemonize] = true }
- opts.on("-u", "--debugger", "Enable the debugger") { options[:debugger] = true }
+ opts.on("-u", "--debugger", "Enable 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 }
@@ -75,7 +82,9 @@ module Rails
def middleware
middlewares = []
- middlewares << [Rails::Rack::Debugger] if options[:debugger]
+ 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.
diff --git a/railties/lib/rails/rack.rb b/railties/lib/rails/rack.rb
index d1ee96f7fd..886f0e52e1 100644
--- a/railties/lib/rails/rack.rb
+++ b/railties/lib/rails/rack.rb
@@ -1,6 +1,6 @@
module Rails
module Rack
- autoload :Debugger, "rails/rack/debugger"
+ autoload :Debugger, "rails/rack/debugger" if RUBY_VERSION < '2.0.0'
autoload :Logger, "rails/rack/logger"
autoload :LogTailer, "rails/rack/log_tailer"
end
diff --git a/railties/test/commands/console_test.rb b/railties/test/commands/console_test.rb
index a34beaedb3..87c5527b81 100644
--- a/railties/test/commands/console_test.rb
+++ b/railties/test/commands/console_test.rb
@@ -22,11 +22,11 @@ class Rails::ConsoleTest < ActiveSupport::TestCase
def test_debugger_option
console = Rails::Console.new(app, parse_arguments(["--debugger"]))
assert console.debugger?
- end
+ end if RUBY_VERSION < '2.0.0'
def test_no_options
console = Rails::Console.new(app, parse_arguments([]))
- assert !console.debugger?
+ assert !console.debugger? if RUBY_VERSION < '2.0.0'
assert !console.sandbox?
end
@@ -41,7 +41,7 @@ class Rails::ConsoleTest < ActiveSupport::TestCase
rails_console.expects(:require_debugger).returns(nil)
silence_stream(STDOUT) { rails_console.start }
- end
+ end if RUBY_VERSION < '2.0.0'
def test_start_with_sandbox
app.expects(:sandbox=).with(true)