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