bin/probe in utils-0.2.0 vs bin/probe in utils-0.2.1
- old
+ new
@@ -15,14 +15,12 @@
Options are
-n TESTNAME run the test TESTNAME in file FILENAME
-t FRAMEWORK use test framework FRAMEWORK (rspec, test-unit or cucumber)
-c start probe as a client
- -C start probe as a client console
-l start probe as a server
-p PORT listen on/connect to local port PORT
- -z use zeus
-h display this help
Version is #{File.basename($0)} #{Utils::VERSION}.
EOT
exit 1
@@ -37,30 +35,28 @@
cmds.map { |c| `which #{c}`.full?(:chomp) }.compact.first or
raise fail "no #{cmds * '|'} command found"
end
def zeus?
- $config.probe.zeus && !`which zeus`.empty?
+ !`which zeus`.empty? && test(?S, '.zeus.sock')
end
+singleton_class.class_eval do
+ memoize_function :zeus?
+end
def start_server
Thread.abort_on_exception = $DEBUG
+ zeus? and
+ puts "Found a zeus socket file, I'll try to use it for running tests."
begin
DRb.start_service
DRbObject.new_with_uri($uri).shutdown
rescue DRb::DRbConnError
end
- puts "Starting probe server listening to #{$uri.inspect}."
- DRb.start_service($uri, Utils::ProbeServer.new)
- begin
- DRb.thread.join
- rescue Interrupt
- warn " *** Interrupted ***"
- exit
- end
+ Utils::ProbeServer.new($uri).start
end
def connect_server
Utils::ProbeServer::Job.colorize = true
puts "Connecting probe server on #{$uri.inspect}."
@@ -70,14 +66,10 @@
opts = $opt.subhash('n', 't').each_with_object([]) { |(k, v), a|
v.full? and a.concat [ "-#{k}", v ]
}
probe_server.enqueue opts + $args
exit
- elsif $opt['C']
- ARGV.clear
- Tins::IRB.examine probe_server
- exit
end
end
$config = Utils::Config::ConfigFile.new
$config.configure_from_paths
@@ -86,22 +78,19 @@
testrunner_args.concat ARGV[(i + 1)..-1]
$args = ARGV[0...i]
else
$args = ARGV.dup
end
-$opt = go 'zlcCp:t:n:h', $args
+$opt = go 'lcp:t:n:h', $args
$opt['h'] and usage
-$opt['z'] ||= $config.probe.zeus
-if $opt['z'] && !zeus?
- warn "Zeus support was enabled, but is not installed!"
-end
$uri = "druby://localhost:#{$opt['p'] || 6623}"
case
when $opt['l']
start_server
-when $opt['c'], $opt['C']
+ exit
+when $opt['c']
connect_server
end
$args.empty? and fail "require filename or filename:linenumber as arguments"
puts "Running tests in #{$args.inspect}"