class Cucumber::Chef::Provider

Constants

PROXY_METHODS

Public Class Methods

new(ui=ZTK::UI.new) click to toggle source
# File lib/cucumber/chef/provider.rb, line 34
def initialize(ui=ZTK::UI.new)
  @ui = ui

  @provider = case Cucumber::Chef::Config.provider
  when :aws then
    Cucumber::Chef::Provider::AWS.new(@ui)
  when :vagrant then
    Cucumber::Chef::Provider::Vagrant.new(@ui)
  end
end

Public Instance Methods

ip() click to toggle source
# File lib/cucumber/chef/provider.rb, line 74
def ip
  (Cucumber::Chef.lab_ip || @provider.ip)
end
method_missing(method_name, *method_args) click to toggle source
Calls superclass method
# File lib/cucumber/chef/provider.rb, line 84
def method_missing(method_name, *method_args)
  if Cucumber::Chef::Provider::PROXY_METHODS.include?(method_name.to_s)
    result = @provider.send(method_name.to_sym, *method_args)
    splat = [method_name, *method_args].flatten.compact
    @ui.logger.debug { "Provider: #{splat.inspect}=#{result.inspect}" }
    result
  else
    super(method_name, *method_args)
  end
end
port() click to toggle source
# File lib/cucumber/chef/provider.rb, line 78
def port
  (Cucumber::Chef.lab_ssh_port || @provider.port)
end
status() click to toggle source
# File lib/cucumber/chef/provider.rb, line 47
def status
  if exists?

    headers = %w(provider id state username ip_address ssh_port).map(&:to_sym)
    results = ZTK::Report.new.list([nil], headers) do |noop|

      OpenStruct.new(
        :provider => @provider.class,
        :id => self.id,
        :state => self.state,
        :username => self.username,
        :ip_address => self.ip,
        :ssh_port => self.port
      )
    end
  else
    raise ProviderError, "No test labs exists!"
  end

rescue Exception => e
  @ui.logger.fatal { e.message }
  @ui.logger.fatal { e.backtrace.join("\n") }
  raise ProviderError, e.message
end