Sha256: fcdeca55826c17086ad67370b9c2c85b0fee2fbe4801311904df90bb35676453
Contents?: true
Size: 647 Bytes
Versions: 15
Compression:
Stored size: 647 Bytes
Contents
require 'forwardable' require 'cl/config' require 'cl/ui' class Cl class Ctx extend Forwardable def_delegators :ui, :puts, :stdout, :announce, :info, :notice, :warn, :error, :success, :cmd attr_accessor :config, :name, :opts def initialize(name, opts = {}) @config = Config.new(name).to_h @opts = opts @name = name end def ui @ui ||= opts[:ui] || Ui.new(self, opts) end def abort(error, *strs) abort? ? ui.abort(error, *strs) : raise(error) end def abort? !opts[:abort].is_a?(FalseClass) end def test? ENV['ENV'] == 'test' end end end
Version data entries
15 entries across 15 versions & 2 rubygems