Class: Berkshelf::ChefConfigCompat
- Inherits:
-
Object
- Object
- Berkshelf::ChefConfigCompat
- Defined in:
- lib/berkshelf/chef_config_compat.rb
Class Method Summary collapse
-
.from_file(file) ⇒ Object
Load from a file.
Instance Method Summary collapse
-
#cookbook_copyright(*args, &block) ⇒ Object
Keep defaults that aren’t in ChefConfig::Config.
- #cookbook_email(*args, &block) ⇒ Object
- #cookbook_license(*args, &block) ⇒ Object
-
#initialize(path, options = {}) ⇒ ChefConfigCompat
constructor
Create a new Chef Config object.
-
#method_missing(name, *args, &block) ⇒ Object
Behave just like ChefConfig::Config in general.
- #respond_to_missing?(name) ⇒ Boolean
-
#to_hash ⇒ Object
The configuration as a hash.
Constructor Details
#initialize(path, options = {}) ⇒ ChefConfigCompat
Create a new Chef Config object.
12 13 14 15 16 17 |
# File 'lib/berkshelf/chef_config_compat.rb', line 12 def initialize(path, = {}) ChefConfig::WorkstationConfigLoader.new(path).load ChefConfig::Config.merge!() ChefConfig::Config.export_proxies # Set proxy settings as environment variables ChefConfig::Config.init_openssl # setup openssl + fips mode end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
Behave just like ChefConfig::Config in general
43 44 45 |
# File 'lib/berkshelf/chef_config_compat.rb', line 43 def method_missing(name, *args, &block) ChefConfig::Config.send(name, *args, &block) end |
Class Method Details
.from_file(file) ⇒ Object
Load from a file
38 39 40 |
# File 'lib/berkshelf/chef_config_compat.rb', line 38 def self.from_file(file) new(file) end |
Instance Method Details
#cookbook_copyright(*args, &block) ⇒ Object
Keep defaults that aren’t in ChefConfig::Config
20 21 22 |
# File 'lib/berkshelf/chef_config_compat.rb', line 20 def cookbook_copyright(*args, &block) ChefConfig::Config.cookbook_copyright(*args, &block) || "YOUR_NAME" end |
#cookbook_email(*args, &block) ⇒ Object
24 25 26 |
# 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) ⇒ Object
28 29 30 |
# File 'lib/berkshelf/chef_config_compat.rb', line 28 def cookbook_license(*args, &block) ChefConfig::Config.cookbook_license(*args, &block) || "reserved" end |
#respond_to_missing?(name) ⇒ Boolean
47 48 49 |
# File 'lib/berkshelf/chef_config_compat.rb', line 47 def respond_to_missing?(name) ChefConfig::Config.respond_to?(name) end |
#to_hash ⇒ Object
The configuration as a hash
33 34 35 |
# File 'lib/berkshelf/chef_config_compat.rb', line 33 def to_hash ChefConfig::Config.save(true) end |