aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/commands
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2007-04-28 15:57:29 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2007-04-28 15:57:29 +0000
commit70ac560e42644938392381ecd52efd7fb0260323 (patch)
treedbc0bc73d480bf3af99aef2f4be16afa183f4850 /railties/lib/commands
parent1d5c34c2c27370356e8cd1ef478111802b6a5af4 (diff)
downloadrails-70ac560e42644938392381ecd52efd7fb0260323.tar.gz
rails-70ac560e42644938392381ecd52efd7fb0260323.tar.bz2
rails-70ac560e42644938392381ecd52efd7fb0260323.zip
Removed breakpointer and Binding.of_caller in favor of relying on ruby-debug by Kent Sibilev since the breakpointer has been broken since Ruby 1.8.4 and will not be coming back [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6611 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/lib/commands')
-rw-r--r--railties/lib/commands/breakpointer.rb1
-rw-r--r--railties/lib/commands/servers/base.rb12
-rw-r--r--railties/lib/commands/servers/mongrel.rb6
-rw-r--r--railties/lib/commands/servers/webrick.rb20
4 files changed, 30 insertions, 9 deletions
diff --git a/railties/lib/commands/breakpointer.rb b/railties/lib/commands/breakpointer.rb
deleted file mode 100644
index cc52010c32..0000000000
--- a/railties/lib/commands/breakpointer.rb
+++ /dev/null
@@ -1 +0,0 @@
-require 'breakpoint_client'
diff --git a/railties/lib/commands/servers/base.rb b/railties/lib/commands/servers/base.rb
index 25b2935524..ed32c3eea5 100644
--- a/railties/lib/commands/servers/base.rb
+++ b/railties/lib/commands/servers/base.rb
@@ -17,3 +17,15 @@ def tail(log_file)
end
tail_thread
end
+
+def start_debugger
+ begin
+ require_library_or_gem 'ruby-debug'
+ Debugger.start
+ # Debugger.settings[:autoirb] = true
+ 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 \ No newline at end of file
diff --git a/railties/lib/commands/servers/mongrel.rb b/railties/lib/commands/servers/mongrel.rb
index 995274f9a0..5eb14bce1e 100644
--- a/railties/lib/commands/servers/mongrel.rb
+++ b/railties/lib/commands/servers/mongrel.rb
@@ -12,13 +12,15 @@ OPTIONS = {
:port => 3000,
:ip => "0.0.0.0",
:environment => (ENV['RAILS_ENV'] || "development").dup,
- :detach => false
+ :detach => false,
+ :debugger => false
}
ARGV.clone.options do |opts|
opts.on("-p", "--port=port", Integer, "Runs Rails on the specified port.", "Default: 3000") { |v| OPTIONS[:port] = v }
opts.on("-b", "--binding=ip", String, "Binds Rails to the specified ip.", "Default: 0.0.0.0") { |v| OPTIONS[:ip] = v }
opts.on("-d", "--daemon", "Make server run as a Daemon.") { OPTIONS[:detach] = true }
+ opts.on("-u", "--debugger", "Enable ruby-debugging for the server.") { OPTIONS[:debugger] = true }
opts.on("-e", "--environment=name", String,
"Specifies the environment to run this server under (test/development/production).",
"Default: development") { |v| OPTIONS[:environment] = v }
@@ -46,6 +48,8 @@ else
ENV["RAILS_ENV"] = OPTIONS[:environment]
RAILS_ENV.replace(OPTIONS[:environment]) if defined?(RAILS_ENV)
+ start_debugger if OPTIONS[:debugger]
+
require 'initializer'
Rails::Initializer.run(:initialize_logger)
diff --git a/railties/lib/commands/servers/webrick.rb b/railties/lib/commands/servers/webrick.rb
index 3fddcc5459..0f06560457 100644
--- a/railties/lib/commands/servers/webrick.rb
+++ b/railties/lib/commands/servers/webrick.rb
@@ -2,13 +2,15 @@ require 'webrick'
require 'optparse'
OPTIONS = {
- :port => 3000,
- :ip => "0.0.0.0",
- :environment => (ENV['RAILS_ENV'] || "development").dup,
- :server_root => File.expand_path(RAILS_ROOT + "/public/"),
- :server_type => WEBrick::SimpleServer,
- :charset => "UTF-8",
- :mime_types => WEBrick::HTTPUtils::DefaultMimeTypes
+ :port => 3000,
+ :ip => "0.0.0.0",
+ :environment => (ENV['RAILS_ENV'] || "development").dup,
+ :server_root => File.expand_path(RAILS_ROOT + "/public/"),
+ :server_type => WEBrick::SimpleServer,
+ :charset => "UTF-8",
+ :mime_types => WEBrick::HTTPUtils::DefaultMimeTypes,
+ :debugger => false
+
}
ARGV.options do |opts|
@@ -34,6 +36,8 @@ ARGV.options do |opts|
"Make Rails run as a Daemon (only works if fork is available -- meaning on *nix)."
) { OPTIONS[:server_type] = WEBrick::Daemon }
+ opts.on("-u", "--debugger", "Enable ruby-debugging for the server.") { OPTIONS[:debugger] = true }
+
opts.on("-c", "--charset=charset", String,
"Set default charset for output.",
"Default: UTF-8") { |v| OPTIONS[:charset] = v }
@@ -46,6 +50,8 @@ ARGV.options do |opts|
opts.parse!
end
+start_debugger if OPTIONS[:debugger]
+
ENV["RAILS_ENV"] = OPTIONS[:environment]
RAILS_ENV.replace(OPTIONS[:environment]) if defined?(RAILS_ENV)