module Cucumber::Formatter::ANSIColor
def self.define_grey #:nodoc:
def self.define_grey #:nodoc: begin gem 'genki-ruby-terminfo' require 'terminfo' case TermInfo.default_object.tigetnum("colors") when 0 raise "Your terminal doesn't support colours" when 1 ::Term::ANSIColor.coloring = false alias grey white when 2..8 alias grey white else define_real_grey end rescue Exception => e if e.class.name == 'TermInfo::TermInfoError' STDERR.puts "*** WARNING ***" STDERR.puts "You have the genki-ruby-terminfo gem installed, but you haven't set your TERM variable." STDERR.puts "Try setting it to TERM=xterm-256color to get grey colour in output" STDERR.puts "\n" alias grey white else define_real_grey end end end
def self.define_real_grey #:nodoc:
def self.define_real_grey #:nodoc: def grey(m) #:nodoc: if ::Term::ANSIColor.coloring? "\e[90m#{m}\e[0m" else m end end end
def cukes(n)
def cukes(n) ("(::) " * n).strip end
def green_cukes(n)
def green_cukes(n) blink(green(cukes(n))) end
def grey(m) #:nodoc:
:nodoc:
def grey(m) #:nodoc: if ::Term::ANSIColor.coloring? "\e[90m#{m}\e[0m" else m end end
def red_cukes(n)
def red_cukes(n) blink(red(cukes(n))) end
def yellow_cukes(n)
def yellow_cukes(n) blink(yellow(cukes(n))) end