Sha256: 83f58b9b9cfb4aa2d04fafc1e962fb20d43e2c691808372aa8c233d866ab6d57

Contents?: true

Size: 589 Bytes

Versions: 9

Compression:

Stored size: 589 Bytes

Contents

require 'ostruct'

module CapUtil
  class FakeCap

    attr_reader :roles, :cmds_run

    def initialize(*args)
      @struct = OpenStruct.new
      @roles = []
      @cmds_run = []
    end

    def method_missing(method, *args, &block)
      @struct.send(method, *args, &block)
    end

    def respond_to?(method)
      @struct.respond_to?(method) ? true : super
    end

    def run(*args)
      @cmds_run << args
    end

    def fetch(var_name)
      self.send("fetch_#{var_name}")
    end

    def role(name, hostname, opts)
      @roles << [name, hostname, opts]
    end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
cap-util-1.0.0 lib/cap-util/fake_cap.rb
cap-util-1.0.0.rc1 lib/cap-util/fake_cap.rb
cap-util-0.4.0 lib/cap-util/fake_cap.rb
cap-util-0.3.0 lib/cap-util/fake_cap.rb
cap-util-0.2.1 lib/cap-util/fake_cap.rb
cap-util-0.2.0 lib/cap-util/fake_cap.rb
cap-util-0.1.2 lib/cap-util/fake_cap.rb
cap-util-0.1.1 lib/cap-util/fake_cap.rb
cap-util-0.1.0 lib/cap-util/fake_cap.rb