Class: Koine::TestRunner::CommandExecuter

Inherits:
Object
  • Object
show all
Defined in:
lib/koine/test_runner/command_executer.rb

Instance Method Summary collapse

Instance Method Details

#execute(command) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/koine/test_runner/command_executer.rb', line 4

def execute(command)
  start = Time.now
  system(command.to_s)
  finish = Time.now
  elapsed = finish - start
  logger.info("#{command} => elapsed time: #{elapsed.round(2)}")
  puts "\nTook #{elapsed.round(2)} seconds"
  $?.exitstatus
end

#execute_and_exit(command) ⇒ Object



19
20
21
22
# File 'lib/koine/test_runner/command_executer.rb', line 19

def execute_and_exit(command)
  puts command
  exit(execute(command))
end

#fail(reason) ⇒ Object



14
15
16
17
# File 'lib/koine/test_runner/command_executer.rb', line 14

def fail(reason)
  puts reason
  exit(1)
end

#loggerObject



24
25
26
# File 'lib/koine/test_runner/command_executer.rb', line 24

def logger
  @logger ||= Logger.new('/tmp/test_runner.log')
end