Class: ColoredConsoleOutput

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

Direct Known Subclasses

AbbreviatedConsoleOutput

Constant Summary collapse

COLORS =
{
  :red => 31,
  :green => 32,
  :yellow => 33,
  :cyan => 36
}
STATUS_COLORS =
{
  :start => :cyan,
  :pass => :green,
  :fail => :red,
  :error => :red,
  :warning => :yellow,
  :issue => :yellow
}

Instance Method Summary collapse

Methods inherited from ConsoleOutput

#add, #add_status, #close

Instance Method Details

#colorize(text, color) ⇒ Object



24
25
26
# File 'lib/ui-auto-monkey/tuneup/test_runner/colored_console_output.rb', line 24

def colorize(text, color)
  "\e[#{COLORS[color]}m#{text}\e[0m"
end

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



18
19
20
21
22
# File 'lib/ui-auto-monkey/tuneup/test_runner/colored_console_output.rb', line 18

def format(status, date, time, time_zone, msg)
  output = super
  output = colorize(output, STATUS_COLORS[status]) if STATUS_COLORS[status]
  output
end