Class: Babelyoda::Logger
- Inherits:
-
Object
- Object
- Babelyoda::Logger
- Includes:
- Term::ANSIColor
- Defined in:
- lib/babelyoda/logger.rb
Instance Method Summary collapse
- #error(msg, heading = true, do_exit = true) ⇒ Object
- #escape_cmd_args(args) ⇒ Object
- #exe(cmd) ⇒ Object
- #putcmd(cmd) ⇒ Object
- #status(msg) ⇒ Object
- #success(msg, heading = true) ⇒ Object
Instance Method Details
#error(msg, heading = true, do_exit = true) ⇒ Object
11 |
# File 'lib/babelyoda/logger.rb', line 11 def error(msg, heading = true, do_exit = true) ; print red, bold, (heading ? 'ERROR: ' : ''), msg, reset, "\n" ; exit 1 if do_exit; end |
#escape_cmd_args(args) ⇒ Object
12 |
# File 'lib/babelyoda/logger.rb', line 12 def escape_cmd_args(args) ; args.collect{ |arg| "'#{arg}'"}.join(' ') ; end |
#exe(cmd) ⇒ Object
7 |
# File 'lib/babelyoda/logger.rb', line 7 def exe(cmd) ; putcmd cmd ; system cmd ; end |
#putcmd(cmd) ⇒ Object
8 |
# File 'lib/babelyoda/logger.rb', line 8 def putcmd(cmd) ; print magenta, "CMD: #{cmd}", reset, "\n" ; end |
#status(msg) ⇒ Object
9 |
# File 'lib/babelyoda/logger.rb', line 9 def status(msg) ; print blue, "--- #{msg} ---", reset, "\n" ; end |
#success(msg, heading = true) ⇒ Object
10 |
# File 'lib/babelyoda/logger.rb', line 10 def success(msg, heading = true) ; print green, bold, (heading ? 'SUCCESS: ' : ''), msg, reset, "\n" ; end |