Class: Berkshelf::Vagrant::BerksConfig
- Inherits:
-
Vagrant::Util::HashWithIndifferentAccess
- Object
- Vagrant::Util::HashWithIndifferentAccess
- Berkshelf::Vagrant::BerksConfig
- Defined in:
- lib/berkshelf/vagrant/berks_config.rb
Class Method Summary collapse
-
.instance ⇒ Config
Instantiate and return or just return the currently instantiated Berkshelf configuration.
- .local_location ⇒ String
- .path ⇒ String
- .store_location ⇒ String
Instance Method Summary collapse
- #chef ⇒ Object
-
#initialize ⇒ BerksConfig
constructor
A new instance of BerksConfig.
- #ssl ⇒ Object
Constructor Details
#initialize ⇒ BerksConfig
Returns a new instance of BerksConfig.
35 36 37 |
# File 'lib/berkshelf/vagrant/berks_config.rb', line 35 def initialize super(chef: ChefConfig.instance, ssl: ::Vagrant::Util::HashWithIndifferentAccess.new(verify: false)) end |
Class Method Details
.instance ⇒ Config
Instantiate and return or just return the currently instantiated Berkshelf configuration
26 27 28 29 30 31 32 |
# File 'lib/berkshelf/vagrant/berks_config.rb', line 26 def instance @instance ||= if File.exists?(path) && File.readable?(path) JSON.parse(File.read(path)) else new end end |
.local_location ⇒ String
12 13 14 |
# File 'lib/berkshelf/vagrant/berks_config.rb', line 12 def local_location ENV['BERKSHELF_CONFIG'] || File.join('.', '.berkshelf', 'config.json') end |
.path ⇒ String
17 18 19 20 |
# File 'lib/berkshelf/vagrant/berks_config.rb', line 17 def path path = File.exists?(local_location) ? local_location : store_location File.(path) end |
.store_location ⇒ String
7 8 9 |
# File 'lib/berkshelf/vagrant/berks_config.rb', line 7 def store_location File.join(Berkshelf.berkshelf_path, 'config.json') end |
Instance Method Details
#chef ⇒ Object
39 40 41 |
# File 'lib/berkshelf/vagrant/berks_config.rb', line 39 def chef self[:chef] end |
#ssl ⇒ Object
43 44 45 |
# File 'lib/berkshelf/vagrant/berks_config.rb', line 43 def ssl self[:ssl] end |