Module: Gemkeeper::Output

Defined in:
lib/gemkeeper/output.rb

Constant Summary collapse

COLORS =
{
  green: "\e[32m",
  yellow: "\e[33m",
  red: "\e[31m",
  dim: "\e[2m",
  reset: "\e[0m"
}.freeze

Class Method Summary collapse

Class Method Details

.colorize(text, color) ⇒ Object



15
16
17
18
19
# File 'lib/gemkeeper/output.rb', line 15

def colorize(text, color)
  return text unless $stdout.tty?

  "#{COLORS[color]}#{text}#{COLORS[:reset]}"
end

.failure(msg) ⇒ Object



24
# File 'lib/gemkeeper/output.rb', line 24

def failure(msg) = warn colorize(msg, :red)

.skip(msg) ⇒ Object



23
# File 'lib/gemkeeper/output.rb', line 23

def skip(msg)    = puts colorize(msg, :yellow)

.step(msg) ⇒ Object



21
# File 'lib/gemkeeper/output.rb', line 21

def step(msg)    = puts colorize("  #{msg}", :dim)

.success(msg) ⇒ Object



22
# File 'lib/gemkeeper/output.rb', line 22

def success(msg) = puts colorize(msg, :green)