class R10K::Deployment::Config

Attributes

configfile[RW]

Public Class Methods

new(configfile, overrides={}) click to toggle source
# File lib/r10k/deployment/config.rb, line 16
def initialize(configfile, overrides={})
  @configfile = configfile
  @overrides = overrides

  load_config
end

Public Instance Methods

[](key)
Alias for: setting
load_config() click to toggle source

Load and store a config file, and set relevant options

@param [String] configfile The path to the YAML config file

# File lib/r10k/deployment/config.rb, line 37
def load_config
  loader = R10K::Settings::Loader.new
  hash = loader.read(@configfile)

  with_overrides = hash.merge(@overrides) do |key, oldval, newval|
    logger.debug2 "Overriding config file setting '#{key}': '#{oldval}' -> '#{newval}'"
    newval
  end

  @config = R10K::Settings.global_settings.evaluate(with_overrides)

  initializer = R10K::Initializers::GlobalInitializer.new(@config)
  initializer.call
end
setting(key) click to toggle source

Perform a scan for key and check for both string and symbol keys

# File lib/r10k/deployment/config.rb, line 24
def setting(key)
  @config[key]
end
Also aliased as: []
settings() click to toggle source
# File lib/r10k/deployment/config.rb, line 30
def settings
  @config
end