class Providence::BaseWatchr

Public Class Methods

alert_message() click to toggle source
# File lib/providence/base_watchr.rb, line 38
def alert_message; 'Cannot determine test status'; end
fail_message() click to toggle source
# File lib/providence/base_watchr.rb, line 36
def fail_message; 'Failed'; end
pass_message() click to toggle source
# File lib/providence/base_watchr.rb, line 35
def pass_message; 'Passed'; end
pending_message() click to toggle source
# File lib/providence/base_watchr.rb, line 37
def pending_message; 'Pending further work'; end
run(path) click to toggle source
# File lib/providence/base_watchr.rb, line 4
def run(path)  
  cmd = "#{command} #{path}"
  
  Eye.growl "Running #{name}"
  system('clear')
  puts(cmd)
  
  status = parse_test_status(run_command(cmd))
  Eye.growl send("#{status}_message".to_sym), Eye.send("#{status}_image".to_sym)
end
run_command(cmd) click to toggle source
# File lib/providence/base_watchr.rb, line 15
def run_command(cmd)
  last_output = []
  stdin, stdout, stderr = Open3.popen3(cmd)
  while !stdout.eof? || !stderr.eof
    err = stderr.gets
    puts err unless err.nil? || err.strip.empty?
    
    line = stdout.gets
    last_output.replace([]) if line.nil? || line.strip.empty?
    last_output.push(line)
    puts line         
  end

  stdin.close
  stdout.close
  stderr.close
  
  last_output
end