lib/rspactor/interactor.rb in guillaumegentil-rspactor-0.3.4 vs lib/rspactor/interactor.rb in guillaumegentil-rspactor-0.4
- old
+ new
@@ -1,17 +1,19 @@
require 'timeout'
module RSpactor
class Interactor
- def initialize(dir)
+ def initialize(dir, options = {})
@root = dir
+ @options = options
ticker
end
- def wait_for_enter_key(msg, seconds_to_wait)
+ def wait_for_enter_key(msg, seconds_to_wait, clear = false)
begin
Timeout::timeout(seconds_to_wait) do
+ system("clear;") if clear
ticker(:start => true, :msg => msg)
$stdin.gets
return true
end
rescue Timeout::Error
@@ -25,10 +27,10 @@
@main_thread = Thread.current
Thread.new do
loop do
sleep 0.5
if $stdin.gets
- if wait_for_enter_key("** Running all specs.. Hit <enter> again to exit RSpactor", 3)
+ if wait_for_enter_key("** Running all specs.. Hit <enter> again to exit RSpactor", 3, @options[:clear])
@main_thread.exit
exit
end
Runner.new(@root).run_all_specs
end
\ No newline at end of file