class Mjolnir

Thor’s hammer! Like Thor with better logging

Constants

COMMON_OPTIONS

Common options for Thor commands

Public Class Methods

include_common_options() click to toggle source

Decorate Thor commands with the options above

# File lib/bender/mjolnir.rb, line 25
def self.include_common_options
  COMMON_OPTIONS.each do |name, spec|
    option name, spec
  end
end

Public Instance Methods

log() click to toggle source

Construct a Logger given the command-line options

# File lib/bender/mjolnir.rb, line 35
def log
  return @logger if defined? @logger
  level = :info
  level = :debug if options.debug?
  device = options.log || $stderr
  pretty = device.tty? rescue false
  @logger = Slog.new \
    out: device,
    level: level,
    colorize: pretty,
    prettify: pretty
end