Class: MotherBrain::Chef::Config

Inherits:
Hash
  • Object
show all
Defined in:
lib/mb/chef/config.rb

Overview

Handles loading configuration values from a Chef config file

Constant Summary collapse

DEFAULT_PATHS =
%w[
  ./.chef/knife.rb
  ~/.chef/knife.rb
  /etc/chef/solo.rb
  /etc/chef/client.rb
]

Instance Method Summary collapse

Constructor Details

#initialize(path = nil) ⇒ Config

Returns a new instance of Config.

Parameters:

  • path (String) (defaults to: nil)


13
14
15
# File 'lib/mb/chef/config.rb', line 13

def initialize(path = nil)
  @path = path
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(key, value = nil) ⇒ Object (private)



37
38
39
# File 'lib/mb/chef/config.rb', line 37

def method_missing(key, value = nil)
  store key.to_sym, value
end

Instance Method Details

#parseKnife

Parse the file for the path and store symbolicated keys for knife configuration options.

Returns:

  • (Knife)

    self



21
22
23
24
# File 'lib/mb/chef/config.rb', line 21

def parse
  parse_file
  self
end