class Tork::CLIApp
Constants
- BACKTRACE_CENSOR
- COMMANDS
Public Instance Methods
loop()
click to toggle source
Calls superclass method
# File lib/tork/cliapp.rb, line 6 def loop tell @clients, 'Absorbing test execution overhead...' @driver = popen('tork-driver') super ensure pclose @driver end
Protected Instance Methods
join(client)
click to toggle source
Calls superclass method
# File lib/tork/cliapp.rb, line 16 def join client super help client end
recv(client, message)
click to toggle source
# File lib/tork/cliapp.rb, line 28 def recv client, message case client when @driver event, *details = message case event_sym = event.to_sym when :boot tell @clients, 'Test execution overhead absorbed; ready to test!' when :boot! tell @clients, 'Test execution overhead changed; re-absorbing...' when :test, :pass, :fail test_file, line_numbers, log_file, worker_number, exit_status = details message = [event.upcase, [test_file, *line_numbers].join(':'), exit_status].compact.join(' ') color = case event_sym when :pass then "\e[34m%s\e[0m" # blue when :fail then "\e[31m%s\e[0m" # red end message = color % message if color and STDOUT.tty? if event_sym == :fail # censor Tork internals from test failure backtraces log = File.read(log_file).gsub(BACKTRACE_CENSOR, '') message = [message, log, message] end tell @clients, message, false when :done tested, passed, failed = details.map(&:length) tell @clients, "#{tested} tested, #{passed} passed, #{failed} failed" end else key = message.shift.lstrip[0,1].downcase cmd = Array(COMMANDS.fetch(key, [:help, client])) + message if respond_to? cmd.first, true __send__(*cmd) else tell @clients, "Sending #{cmd.inspect} command..." send @driver, cmd end end end
Private Instance Methods
help(client)
click to toggle source
# File lib/tork/cliapp.rb, line 90 def help client tell client, <<HELP Type a then ENTER to run all available test files. Type t then SPACE then a filename then ENTER to run a specific test file. Type s then ENTER to stop currently running test files. Type k then ENTER to kill currently running test files. Type p then ENTER to re-run currently passing test files. Type f then ENTER to re-run currently failing test files. Type l then ENTER to list currently failing test files. Type b then ENTER to re-absorb test execution overhead. Type h then ENTER to see this help message. Type q then ENTER to quit. HELP end