Class: Kitchen::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/kitchen/config.rb

Overview

Base configuration class for Kitchen. This class exposes configuration such as the location of the Kitchen config file, instances, log_levels, etc.

Author:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Config

Creates a new configuration.

Parameters:

  • options (Hash) (defaults to: {})

    configuration

Options Hash (options):

  • :loader (#read)
  • :kitchen_root (String)
  • :log_root (String)
  • :test_base_path (String)
  • :log_level (Symbol)


41
42
43
44
45
46
47
# File 'lib/kitchen/config.rb', line 41

def initialize(options = {})
  @loader         = options.fetch(:loader) { Kitchen::Loader::YAML.new }
  @kitchen_root   = options.fetch(:kitchen_root) { Dir.pwd }
  @log_level      = options.fetch(:log_level) { Kitchen::DEFAULT_LOG_LEVEL }
  @log_root       = options.fetch(:log_root) { default_log_root }
  @test_base_path = options.fetch(:test_base_path) { default_test_base_path }
end

Instance Attribute Details

#kitchen_rootObject (readonly)

Returns the value of attribute kitchen_root.



27
28
29
# File 'lib/kitchen/config.rb', line 27

def kitchen_root
  @kitchen_root
end

#loaderObject (readonly)

Returns the value of attribute loader.



30
31
32
# File 'lib/kitchen/config.rb', line 30

def loader
  @loader
end

#log_levelObject

Returns the value of attribute log_level.



31
32
33
# File 'lib/kitchen/config.rb', line 31

def log_level
  @log_level
end

#log_rootObject (readonly)

Returns the value of attribute log_root.



28
29
30
# File 'lib/kitchen/config.rb', line 28

def log_root
  @log_root
end

#test_base_pathObject (readonly)

Returns the value of attribute test_base_path.



29
30
31
# File 'lib/kitchen/config.rb', line 29

def test_base_path
  @test_base_path
end

Instance Method Details

#instancesArray<Instance>

Returns all instances, resulting from all platform and suite combinations.

Returns:

  • (Array<Instance>)

    all instances, resulting from all platform and suite combinations



51
52
53
# File 'lib/kitchen/config.rb', line 51

def instances
  @instances ||= Collection.new(build_instances)
end

#platformsArray<Platform>

Returns all defined platforms which will be used in convergence integration.

Returns:

  • (Array<Platform>)

    all defined platforms which will be used in convergence integration



57
58
59
60
# File 'lib/kitchen/config.rb', line 57

def platforms
  @platforms ||= Collection.new(
    data.platform_data.map { |pdata| Platform.new(pdata) })
end

#suitesArray<Suite>

Returns all defined suites which will be used in convergence integration.

Returns:

  • (Array<Suite>)

    all defined suites which will be used in convergence integration



64
65
66
67
# File 'lib/kitchen/config.rb', line 64

def suites
  @suites ||= Collection.new(
    data.suite_data.map { |sdata| Suite.new(sdata) })
end