class Unsub::Service::Chef::Config

Public Class Methods

location() click to toggle source
# 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.expand_path(loc)) }
  File.expand_path(location) unless location.nil?
end
new(path, options = {}) click to toggle source
Calls superclass method
# File lib/unsub/service/chef/config.rb, line 33
def initialize(path, options = {})
  super(path || self.class.location, options)
end