Class: Unsub::Service::Chef::Config
- Inherits:
-
Buff::Config::Ruby
- Object
- Buff::Config::Ruby
- Unsub::Service::Chef::Config
- Defined in:
- lib/unsub/service/chef/config.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(path, options = {}) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(path, options = {}) ⇒ Config
Returns a new instance of Config.
33 34 35 |
# File 'lib/unsub/service/chef/config.rb', line 33 def initialize(path, = {}) super(path || self.class.location, ) end |
Class Method Details
.location ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/unsub/service/chef/config.rb', line 11 def location possibles = [] possibles << ENV['CHEF_CONFIG'] if ENV['CHEF_CONFIG'] possibles << File.join(ENV['KNIFE_HOME'], 'knife.rb') if ENV['KNIFE_HOME'] possibles << File.join(Dir.pwd, 'knife.rb') possibles << File.join(ENV['HOME'], '.chef', 'knife.rb') if ENV['HOME'] possibles.compact! location = possibles.find { |loc| File.exists?(File.(loc)) } File.(location) unless location.nil? end |