Sha256: 309b5c995e5841e5ab9a7055f1bbd09e75c40f81fcfea0a66781f47723b124b1

Contents?: true

Size: 518 Bytes

Versions: 8

Compression:

Stored size: 518 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, :ui

    def initialize(name, opts = {})
      @config = Config.new(name).to_h
      @ui = opts[:ui] || Ui.new(self, opts)
      @name = name
    end

    def abort(error, *strs)
      ui.abort(error, *strs)
    end

    def test?
      ENV['ENV'] == 'test'
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
cl-1.0.2 lib/cl/ctx.rb
cl-1.0.1 lib/cl/ctx.rb
cl-1.0.0 lib/cl/ctx.rb
cl-0.1.28 lib/cl/ctx.rb
cl-0.1.27 lib/cl/ctx.rb
cl-0.1.26 lib/cl/ctx.rb
cl-0.1.25 lib/cl/ctx.rb
cl-0.1.24 lib/cl/ctx.rb