bin/probe in utils-0.0.61 vs bin/probe in utils-0.0.62
- old
+ new
@@ -4,10 +4,11 @@
require 'tins/xt'
require 'tins/lines_file'
include Tins::GO
require 'utils'
include Utils
+require 'drb/drb'
def usage
puts <<-EOT
Usage: #{File.basename($0)} [OPTS] FILENAME[:LINENO] [FILENAME]
@@ -39,12 +40,41 @@
testrunner_args.concat ARGV[(i + 1)..-1]
args = ARGV[0...i]
else
args = ARGV.dup
end
-$opt = go 't:n:h', args
-args.empty? and fail "require filename or filename:linenumber as arguments"
+$opt = go 'lcp:t:n:h', args
$opt['h'] and usage
+
+uri = "druby://localhost:#{$opt['p'] || 6623}"
+
+if $opt['l']
+ class ProbeServer
+ def run(args)
+ fork do
+ exec $0, *args
+ end
+ end
+ end
+ puts "Starting probe server listening to #{uri.inspect}."
+ DRb.start_service(uri, ProbeServer.new)
+ begin
+ DRb.thread.join
+ rescue Interrupt
+ warn " *** Interrupted ***"
+ exit
+ end
+end
+
+args.empty? and fail "require filename or filename:linenumber as arguments"
+
+if $opt['c']
+ puts "Connecting probe server on #{uri.inspect}."
+ DRb.start_service
+ probe_server = DRbObject.new_with_uri(uri)
+ opts = $opt.subhash('n', 't').map { |k, v| v.full? { "-#{k} #{v.inspect}" } }.compact
+ probe_server.run opts + args
+end
puts "Running tests in #{args.inspect}"
case ($opt['t'] || $config.probe.test_framework).to_sym
when :rspec