Sha256: d9fe7abd95da1dc8f2ec5e3881d52b177e02d60ccc0aea89cb788e45e62daac3

Contents?: true

Size: 492 Bytes

Versions: 11

Compression:

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

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

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

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

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
cl-0.1.23 lib/cl/ctx.rb
cl-0.1.22 lib/cl/ctx.rb
cl-0.1.21 lib/cl/ctx.rb
cl-0.1.20 lib/cl/ctx.rb
cl-0.1.19 lib/cl/ctx.rb
cl-0.1.18 lib/cl/ctx.rb
cl-0.1.17 lib/cl/ctx.rb
cl-0.1.16 lib/cl/ctx.rb
cl-0.1.15 lib/cl/ctx.rb
cl-0.1.14 lib/cl/ctx.rb
cl-0.1.13 lib/cl/ctx.rb