class Berkshelf::ChefConfigCompat

Public Class Methods

from_file(file) click to toggle source

Load from a file

# File lib/berkshelf/chef_config_compat.rb, line 38
def self.from_file(file)
  new(file)
end
new(path, options = {}) click to toggle source

Create a new Chef Config object.

@param [#to_s] path

the path to the configuration file

@param [Hash] options

# File lib/berkshelf/chef_config_compat.rb, line 12
def initialize(path, options = {})
  ChefConfig::WorkstationConfigLoader.new(path).load
  ChefConfig::Config.merge!(options)
  ChefConfig::Config.export_proxies # Set proxy settings as environment variables
  ChefConfig::Config.init_openssl # setup openssl + fips mode
end

Public Instance Methods

cookbook_email(*args, &block) click to toggle source
# File lib/berkshelf/chef_config_compat.rb, line 24
def cookbook_email(*args, &block)
  ChefConfig::Config.cookbook_email(*args, &block) || "YOUR_EMAIL"
end
cookbook_license(*args, &block) click to toggle source
# File lib/berkshelf/chef_config_compat.rb, line 28
def cookbook_license(*args, &block)
  ChefConfig::Config.cookbook_license(*args, &block) || "reserved"
end
method_missing(name, *args, &block) click to toggle source

Behave just like ChefConfig::Config in general

# File lib/berkshelf/chef_config_compat.rb, line 43
def method_missing(name, *args, &block)
  ChefConfig::Config.send(name, *args, &block)
end
respond_to_missing?(name) click to toggle source
# File lib/berkshelf/chef_config_compat.rb, line 47
def respond_to_missing?(name)
  ChefConfig::Config.respond_to?(name)
end
to_hash() click to toggle source

The configuration as a hash

# File lib/berkshelf/chef_config_compat.rb, line 33
def to_hash
  ChefConfig::Config.save(true)
end