mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Upgraded to breakpoint 92
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@721 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
ba309a3e38
commit
1402bb7a25
6 changed files with 746 additions and 714 deletions
|
@ -218,8 +218,7 @@ module Test #:nodoc:
|
|||
xml, matches = REXML::Document.new(response.body), []
|
||||
xml.elements.each(expression) { |e| matches << e.text }
|
||||
if matches.empty? then
|
||||
msg = build_message(message, "<?> not found in document",
|
||||
expression)
|
||||
msg = build_message(message, "<?> not found in document", expression)
|
||||
flunk(msg)
|
||||
return
|
||||
elsif matches.length < 2 then
|
||||
|
|
|
@ -1,3 +1,13 @@
|
|||
* Upgraded to breakpoint 92 which fixes:
|
||||
|
||||
* overload IRB.parse_opts(), fixes #443
|
||||
=> breakpoints in tests work even when running them via rake
|
||||
* untaint handlers, might fix an issue discussed on the Rails ML
|
||||
* added verbose mode to breakpoint_client
|
||||
* less noise caused by breakpoint_client by default
|
||||
* ignored TerminateLineInput exception in signal handler
|
||||
=> quiet exit on Ctrl-C
|
||||
|
||||
* Fixed Inflector for words like "news" and "series" that are the same in plural and singular #603 [echion], #615 [marcenuc]
|
||||
|
||||
* Added Hash#stringify_keys and Hash#stringify_keys!
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,5 +1,15 @@
|
|||
*SVN*
|
||||
|
||||
* Upgraded to breakpoint 92 which fixes:
|
||||
|
||||
* overload IRB.parse_opts(), fixes #443
|
||||
=> breakpoints in tests work even when running them via rake
|
||||
* untaint handlers, might fix an issue discussed on the Rails ML
|
||||
* added verbose mode to breakpoint_client
|
||||
* less noise caused by breakpoint_client by default
|
||||
* ignored TerminateLineInput exception in signal handler
|
||||
=> quiet exit on Ctrl-C
|
||||
|
||||
* Added support for independent components residing in /components. Example:
|
||||
|
||||
Controller: components/list/items_controller.rb
|
||||
|
|
|
@ -21,7 +21,7 @@ require 'drb'
|
|||
require 'drb/acl'
|
||||
|
||||
module Breakpoint
|
||||
id = %q$Id: breakpoint.rb 41 2005-01-22 20:22:10Z flgr $
|
||||
id = %q$Id: breakpoint.rb 92 2005-02-04 22:35:53Z flgr $
|
||||
Version = id.split(" ")[2].to_i
|
||||
|
||||
extend self
|
||||
|
@ -122,6 +122,7 @@ module Breakpoint
|
|||
# in the context of the client.
|
||||
class Client
|
||||
def initialize(eval_handler) # :nodoc:
|
||||
eval_handler.untaint
|
||||
@eval_handler = eval_handler
|
||||
end
|
||||
|
||||
|
@ -288,6 +289,8 @@ module Breakpoint
|
|||
def collision
|
||||
sleep(0.5) until @collision_handler
|
||||
|
||||
@collision_handler.untaint
|
||||
|
||||
@collision_handler.call
|
||||
end
|
||||
|
||||
|
@ -299,6 +302,7 @@ module Breakpoint
|
|||
|
||||
sleep(0.5) until @handler
|
||||
|
||||
@handler.untaint
|
||||
@handler.call(workspace, message)
|
||||
end
|
||||
|
||||
|
@ -456,6 +460,7 @@ module IRB # :nodoc:
|
|||
old_CurrentContext
|
||||
end
|
||||
end
|
||||
def IRB.parse_opts() end
|
||||
|
||||
class Context
|
||||
alias :old_evaluate :evaluate
|
||||
|
|
|
@ -1,193 +1,196 @@
|
|||
require 'breakpoint'
|
||||
require 'optparse'
|
||||
require 'timeout'
|
||||
|
||||
Options = {
|
||||
:ClientURI => nil,
|
||||
:ServerURI => "druby://localhost:42531",
|
||||
:RetryDelay => 3,
|
||||
:Permanent => true,
|
||||
:Verbose => false
|
||||
}
|
||||
|
||||
ARGV.options do |opts|
|
||||
script_name = File.basename($0)
|
||||
opts.banner = [
|
||||
"Usage: ruby #{script_name} [Options] [server uri]",
|
||||
"",
|
||||
"This tool lets you connect to a breakpoint service ",
|
||||
"which was started via Breakpoint.activate_drb.",
|
||||
"",
|
||||
"The server uri defaults to druby://localhost:42531"
|
||||
].join("\n")
|
||||
|
||||
opts.separator ""
|
||||
|
||||
opts.on("-c", "--client-uri=uri",
|
||||
"Run the client on the specified uri.",
|
||||
"This can be used to specify the port",
|
||||
"that the client uses to allow for back",
|
||||
"connections from the server.",
|
||||
"Default: Find a good URI automatically.",
|
||||
"Example: -c druby://localhost:12345"
|
||||
) { |Options[:ClientURI]| }
|
||||
|
||||
opts.on("-s", "--server-uri=uri",
|
||||
"Connect to the server specified at the",
|
||||
"specified uri.",
|
||||
"Default: druby://localhost:42531"
|
||||
) { |Options[:ServerURI]| }
|
||||
|
||||
opts.on("-R", "--retry-delay=delay", Integer,
|
||||
"Automatically try to reconnect to the",
|
||||
"server after delay seconds when the",
|
||||
"connection failed or timed out.",
|
||||
"A value of 0 disables automatical",
|
||||
"reconnecting completely.",
|
||||
"Default: 10"
|
||||
) { |Options[:RetryDelay]| }
|
||||
|
||||
opts.on("-P", "--[no-]permanent",
|
||||
"Run the breakpoint client in permanent mode.",
|
||||
"This means that the client will keep continue",
|
||||
"running even after the server has closed the",
|
||||
"connection. Useful for example in Rails."
|
||||
) { |Options[:Permanent]| }
|
||||
|
||||
opts.on("-V", "--[no-]verbose",
|
||||
"Run the breakpoint client in verbose mode.",
|
||||
"Will produce more messages, for example between",
|
||||
"individual breakpoints. This might help in seeing",
|
||||
"that the breakpoint client is still alive, but adds",
|
||||
"quite a bit of clutter."
|
||||
) { |Options[:Verbose]| }
|
||||
|
||||
opts.separator ""
|
||||
|
||||
opts.on("-h", "--help",
|
||||
"Show this help message."
|
||||
) { puts opts; exit }
|
||||
opts.on("-v", "--version",
|
||||
"Display the version information."
|
||||
) do
|
||||
id = %q$Id: breakpoint_client.rb 40 2005-01-22 20:05:00Z flgr $
|
||||
puts id.sub("Id: ", "")
|
||||
puts "(Breakpoint::Version = #{Breakpoint::Version})"
|
||||
exit
|
||||
end
|
||||
|
||||
opts.parse!
|
||||
end
|
||||
|
||||
Options[:ServerURI] = ARGV[0] if ARGV[0]
|
||||
|
||||
module Handlers
|
||||
extend self
|
||||
|
||||
def breakpoint_handler(workspace, message)
|
||||
puts message
|
||||
IRB.start(nil, nil, workspace)
|
||||
|
||||
puts ""
|
||||
if Options[:Verbose] then
|
||||
puts "Resumed execution. Waiting for next breakpoint...", ""
|
||||
end
|
||||
end
|
||||
|
||||
def eval_handler(code)
|
||||
result = eval(code, TOPLEVEL_BINDING)
|
||||
if result then
|
||||
DRbObject.new(result)
|
||||
else
|
||||
result
|
||||
end
|
||||
end
|
||||
|
||||
def collision_handler()
|
||||
msg = [
|
||||
" *** Breakpoint service collision ***",
|
||||
" Another Breakpoint service tried to use the",
|
||||
" port already occupied by this one. It will",
|
||||
" keep waiting until this Breakpoint service",
|
||||
" is shut down.",
|
||||
" ",
|
||||
" If you are using the Breakpoint library for",
|
||||
" debugging a Rails or other CGI application",
|
||||
" this likely means that this Breakpoint",
|
||||
" session belongs to an earlier, outdated",
|
||||
" request and should be shut down via 'exit'."
|
||||
].join("\n")
|
||||
|
||||
if RUBY_PLATFORM["win"] then
|
||||
# This sucks. Sorry, I'm not doing this because
|
||||
# I like funky message boxes -- I need to do this
|
||||
# because on Windows I have no way of displaying
|
||||
# my notification via puts() when gets() is still
|
||||
# being performed on STDIN. I have not found a
|
||||
# better solution.
|
||||
begin
|
||||
require 'tk'
|
||||
root = TkRoot.new { withdraw }
|
||||
Tk.messageBox('message' => msg, 'type' => 'ok')
|
||||
root.destroy
|
||||
rescue Exception
|
||||
puts "", msg, ""
|
||||
end
|
||||
else
|
||||
puts "", msg, ""
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Used for checking whether we are currently in the reconnecting loop.
|
||||
reconnecting = false
|
||||
|
||||
loop do
|
||||
DRb.start_service(Options[:ClientURI])
|
||||
|
||||
begin
|
||||
service = DRbObject.new(nil, Options[:ServerURI])
|
||||
|
||||
begin
|
||||
service.eval_handler = Handlers.method(:eval_handler)
|
||||
service.collision_handler = Handlers.method(:collision_handler)
|
||||
service.handler = Handlers.method(:breakpoint_handler)
|
||||
|
||||
reconnecting = false
|
||||
if Options[:Verbose] then
|
||||
puts "Connection established. Waiting for breakpoint...", ""
|
||||
end
|
||||
|
||||
loop do
|
||||
begin
|
||||
service.ping
|
||||
rescue DRb::DRbConnError => error
|
||||
puts "Server exited. Closing connection...", ""
|
||||
exit! unless Options[:Permanent]
|
||||
break
|
||||
end
|
||||
|
||||
sleep(0.5)
|
||||
end
|
||||
ensure
|
||||
service.eval_handler = nil
|
||||
service.collision_handler = nil
|
||||
service.handler = nil
|
||||
end
|
||||
rescue Exception => error
|
||||
if Options[:RetryDelay] > 0 then
|
||||
if not reconnecting then
|
||||
reconnecting = true
|
||||
puts "No connection to breakpoint service at #{Options[:ServerURI]} " +
|
||||
"(#{error.class})"
|
||||
puts error.backtrace if $DEBUG
|
||||
puts "Tries to connect will be made every #{Options[:RetryDelay]} seconds..."
|
||||
end
|
||||
|
||||
sleep Options[:RetryDelay]
|
||||
retry
|
||||
else
|
||||
raise
|
||||
end
|
||||
end
|
||||
end
|
||||
require 'breakpoint'
|
||||
require 'optparse'
|
||||
require 'timeout'
|
||||
|
||||
Options = {
|
||||
:ClientURI => nil,
|
||||
:ServerURI => "druby://localhost:42531",
|
||||
:RetryDelay => 3,
|
||||
:Permanent => false,
|
||||
:Verbose => false
|
||||
}
|
||||
|
||||
ARGV.options do |opts|
|
||||
script_name = File.basename($0)
|
||||
opts.banner = [
|
||||
"Usage: ruby #{script_name} [Options] [server uri]",
|
||||
"",
|
||||
"This tool lets you connect to a breakpoint service ",
|
||||
"which was started via Breakpoint.activate_drb.",
|
||||
"",
|
||||
"The server uri defaults to druby://localhost:42531"
|
||||
].join("\n")
|
||||
|
||||
opts.separator ""
|
||||
|
||||
opts.on("-c", "--client-uri=uri",
|
||||
"Run the client on the specified uri.",
|
||||
"This can be used to specify the port",
|
||||
"that the client uses to allow for back",
|
||||
"connections from the server.",
|
||||
"Default: Find a good URI automatically.",
|
||||
"Example: -c druby://localhost:12345"
|
||||
) { |Options[:ClientURI]| }
|
||||
|
||||
opts.on("-s", "--server-uri=uri",
|
||||
"Connect to the server specified at the",
|
||||
"specified uri.",
|
||||
"Default: druby://localhost:42531"
|
||||
) { |Options[:ServerURI]| }
|
||||
|
||||
opts.on("-R", "--retry-delay=delay", Integer,
|
||||
"Automatically try to reconnect to the",
|
||||
"server after delay seconds when the",
|
||||
"connection failed or timed out.",
|
||||
"A value of 0 disables automatical",
|
||||
"reconnecting completely.",
|
||||
"Default: 10"
|
||||
) { |Options[:RetryDelay]| }
|
||||
|
||||
opts.on("-P", "--[no-]permanent",
|
||||
"Run the breakpoint client in permanent mode.",
|
||||
"This means that the client will keep continue",
|
||||
"running even after the server has closed the",
|
||||
"connection. Useful for example in Rails."
|
||||
) { |Options[:Permanent]| }
|
||||
|
||||
opts.on("-V", "--[no-]verbose",
|
||||
"Run the breakpoint client in verbose mode.",
|
||||
"Will produce more messages, for example between",
|
||||
"individual breakpoints. This might help in seeing",
|
||||
"that the breakpoint client is still alive, but adds",
|
||||
"quite a bit of clutter."
|
||||
) { |Options[:Verbose]| }
|
||||
|
||||
opts.separator ""
|
||||
|
||||
opts.on("-h", "--help",
|
||||
"Show this help message."
|
||||
) { puts opts; exit }
|
||||
opts.on("-v", "--version",
|
||||
"Display the version information."
|
||||
) do
|
||||
id = %q$Id: breakpoint_client.rb 91 2005-02-04 22:34:08Z flgr $
|
||||
puts id.sub("Id: ", "")
|
||||
puts "(Breakpoint::Version = #{Breakpoint::Version})"
|
||||
exit
|
||||
end
|
||||
|
||||
opts.parse!
|
||||
end
|
||||
|
||||
Options[:ServerURI] = ARGV[0] if ARGV[0]
|
||||
|
||||
module Handlers
|
||||
extend self
|
||||
|
||||
def breakpoint_handler(workspace, message)
|
||||
puts message
|
||||
IRB.start(nil, nil, workspace)
|
||||
|
||||
puts ""
|
||||
if Options[:Verbose] then
|
||||
puts "Resumed execution. Waiting for next breakpoint...", ""
|
||||
end
|
||||
end
|
||||
|
||||
def eval_handler(code)
|
||||
result = eval(code, TOPLEVEL_BINDING)
|
||||
if result then
|
||||
DRbObject.new(result)
|
||||
else
|
||||
result
|
||||
end
|
||||
end
|
||||
|
||||
def collision_handler()
|
||||
msg = [
|
||||
" *** Breakpoint service collision ***",
|
||||
" Another Breakpoint service tried to use the",
|
||||
" port already occupied by this one. It will",
|
||||
" keep waiting until this Breakpoint service",
|
||||
" is shut down.",
|
||||
" ",
|
||||
" If you are using the Breakpoint library for",
|
||||
" debugging a Rails or other CGI application",
|
||||
" this likely means that this Breakpoint",
|
||||
" session belongs to an earlier, outdated",
|
||||
" request and should be shut down via 'exit'."
|
||||
].join("\n")
|
||||
|
||||
if RUBY_PLATFORM["win"] then
|
||||
# This sucks. Sorry, I'm not doing this because
|
||||
# I like funky message boxes -- I need to do this
|
||||
# because on Windows I have no way of displaying
|
||||
# my notification via puts() when gets() is still
|
||||
# being performed on STDIN. I have not found a
|
||||
# better solution.
|
||||
begin
|
||||
require 'tk'
|
||||
root = TkRoot.new { withdraw }
|
||||
Tk.messageBox('message' => msg, 'type' => 'ok')
|
||||
root.destroy
|
||||
rescue Exception
|
||||
puts "", msg, ""
|
||||
end
|
||||
else
|
||||
puts "", msg, ""
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Used for checking whether we are currently in the reconnecting loop.
|
||||
reconnecting = false
|
||||
|
||||
loop do
|
||||
DRb.start_service(Options[:ClientURI])
|
||||
|
||||
begin
|
||||
service = DRbObject.new(nil, Options[:ServerURI])
|
||||
|
||||
begin
|
||||
ehandler = Handlers.method(:eval_handler)
|
||||
chandler = Handlers.method(:collision_handler)
|
||||
handler = Handlers.method(:breakpoint_handler)
|
||||
service.eval_handler = ehandler
|
||||
service.collision_handler = chandler
|
||||
service.handler = handler
|
||||
|
||||
reconnecting = false
|
||||
if Options[:Verbose] then
|
||||
puts "Connection established. Waiting for breakpoint...", ""
|
||||
end
|
||||
|
||||
loop do
|
||||
begin
|
||||
service.ping
|
||||
rescue DRb::DRbConnError => error
|
||||
puts "Server exited. Closing connection...", ""
|
||||
exit! unless Options[:Permanent]
|
||||
break
|
||||
end
|
||||
|
||||
sleep(0.5)
|
||||
end
|
||||
ensure
|
||||
service.eval_handler = nil
|
||||
service.collision_handler = nil
|
||||
service.handler = nil
|
||||
end
|
||||
rescue Exception => error
|
||||
if Options[:RetryDelay] > 0 then
|
||||
if not reconnecting then
|
||||
reconnecting = true
|
||||
puts "No connection to breakpoint service at #{Options[:ServerURI]} " +
|
||||
"(#{error.class})"
|
||||
puts error.backtrace if $DEBUG
|
||||
puts "Tries to connect will be made every #{Options[:RetryDelay]} seconds..."
|
||||
end
|
||||
|
||||
sleep Options[:RetryDelay]
|
||||
retry
|
||||
else
|
||||
raise
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue