Class: AbbreviatedConsoleOutput

Inherits:
ColoredConsoleOutput show all
Defined in:
lib/ui-auto-monkey/tuneup/test_runner/abbreviated_console_output.rb

Constant Summary

Constants inherited from ColoredConsoleOutput

ColoredConsoleOutput::COLORS, ColoredConsoleOutput::STATUS_COLORS

Instance Method Summary collapse

Methods inherited from ColoredConsoleOutput

#colorize

Methods inherited from ConsoleOutput

#add, #close

Instance Method Details

#add_status(status, date, time, time_zone, msg) ⇒ Object



3
4
5
6
7
8
# File 'lib/ui-auto-monkey/tuneup/test_runner/abbreviated_console_output.rb', line 3

def add_status(status, date, time, time_zone, msg)
  message = format(status, msg)
  if !message.nil?
    puts message
  end
end

#format(status, msg) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/ui-auto-monkey/tuneup/test_runner/abbreviated_console_output.rb', line 10

def format(status, msg)
  output = nil
  if status
      output = self.message_for_status(status, msg);
      output = colorize(output, STATUS_COLORS[status]) if STATUS_COLORS[status]
  end
  output
end

#message_for_status(status, msg) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/ui-auto-monkey/tuneup/test_runner/abbreviated_console_output.rb', line 19

def message_for_status(status, msg)
  message = nil
  case status
    when /^default/
      message = "    > #{msg}"
    when /^start/
      message = "\n> #{status.to_s.capitalize}: #{msg}"
    when /^fail/
      message = "X #{status.to_s.capitalize}: #{msg}"
    when /^pass/
      message = "#{status.to_s.capitalize}: #{msg}"
    when /^warning/
      message = "    ! #{status.to_s.capitalize}: #{msg}"
    when /^issue/
      message = "    ! #{status.to_s.capitalize}: #{msg}"
  end

  message
end