Module: Kitchen::Binding

Defined in:
lib/kitchen/binding.rb,
lib/kitchen/binding/base.rb,
lib/kitchen/binding/pry_remote.rb

Overview

A binding is responsible for generating the commands necessary to install, set up and use a interactive ruby shell for debugging called from a Provisioner (e.g. Chef Cookbook during Chef Run)

Author:

Defined Under Namespace

Classes: Base, PryRemote

Constant Summary collapse

DEFAULT_PLUGIN =

Default provisioner to use

'pry_remote'.freeze

Class Method Summary collapse

Class Method Details

.for_plugin(plugin, config) ⇒ Binding::Base

Returns an instance of a binding given a plugin type string.

Parameters:

  • plugin (String)

    a binding plugin type, to be constantized

  • config (Hash)

    a configuration hash to initialize the provisioner

Returns:

Raises:

  • (ClientError)

    if a provisioner instance could not be created



37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/kitchen/binding.rb', line 37

def self.for_plugin(plugin, config)
  require("kitchen/binding/#{plugin}")

  str_const = Thor::Util.camel_case(plugin)
  klass = const_get(str_const)
  klass.new(config)
rescue LoadError, NameError
  raise ClientError,
    "Could not load the '#{plugin}' binding from the load path." \
      " Please ensure that your binding is installed as a gem or" \
      " included in your Gemfile if using Bundler."
end