Sha256: b2eb26c2fc9ae57139a0ff5362cee8c4552cb917e0185403be8b55d6893866e8

Contents?: true

Size: 656 Bytes

Versions: 1

Compression:

Stored size: 656 Bytes

Contents

require 'term/ansicolor'

module Babelyoda
  class Logger
    include Term::ANSIColor
    
    def exe(cmd) ; putcmd cmd ; system cmd ; end
    def putcmd(cmd) ; print magenta, "CMD: #{cmd}", reset, "\n" ; end
    def status(msg) ; print blue, "--- #{msg} ---", reset, "\n" ; end
    def success(msg, heading = true) ; print green, bold, (heading ? 'SUCCESS: ' : ''), msg, reset, "\n" ; end
    def error(msg, heading = true, do_exit = true) ; print red, bold, (heading ? 'ERROR: ' : ''), msg, reset, "\n" ; exit 1 if do_exit; end
    def escape_cmd_args(args) ; args.collect{ |arg| "'#{arg}'"}.join(' ') ; end
  end
end

$logger ||= Babelyoda::Logger.new

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
babelyoda-2.0.2 lib/babelyoda/logger.rb