Sha256: 57761407ffe55dbb275f066ca604ba78a67ecf2a01f344b2aa1b12247928d0b8

Contents?: true

Size: 499 Bytes

Versions: 13

Compression:

Stored size: 499 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 = Ui.new(self, opts)
    end

    def abort(str)
      fail(str) if test?
      ui.error(str)
      exit 1
    end

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

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
cl-0.1.12 lib/cl/ctx.rb
cl-0.1.11 lib/cl/ctx.rb
cl-0.1.10 lib/cl/ctx.rb
cl-0.1.9 lib/cl/ctx.rb
cl-0.1.8 lib/cl/ctx.rb
cl-0.1.7 lib/cl/ctx.rb
cl-0.1.6 lib/cl/ctx.rb
cl-0.1.5 lib/cl/ctx.rb
cl-0.1.4 lib/cl/ctx.rb
cl-0.1.3 lib/cl/ctx.rb
cl-0.1.2 lib/cl/ctx.rb
cl-0.1.1 lib/cl/ctx.rb
cl-0.1.0 lib/cl/ctx.rb