Class: Chef::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/tvdinner.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.bundler_config(more_paths = []) ⇒ Object



43
44
45
46
47
48
49
50
51
# File 'lib/tvdinner.rb', line 43

def self.bundler_config more_paths=[]
  # look in bundler gems for cookbooks, which are peers to lib/
  # for every gem/xxx/lib, look for gem/xxx/cookbooks
  bundler_paths = $:.collect do |x|
    File.join(File.expand_path("..", x), "cookbooks")
  end.select {|x| File.directory? x } # return existing directories

  cookbook_path Array(more_paths).concat(bundler_paths)
end

.local_config(shome) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/tvdinner.rb', line 8

def self.local_config shome
  sandbox_path platform_specific_path("#{shome}/var/chef/sandboxes")
  ensure_mkdir sandbox_path

  checksum_path platform_specific_path("#{shome}/var/chef/checksums")
  ensure_mkdir checksum_path

  file_cache_path platform_specific_path("#{shome}/var/chef/cache")
  ensure_mkdir file_cache_path

  file_backup_path platform_specific_path("#{shome}/var/chef/backup")
  ensure_mkdir file_backup_path

  node_path platform_specific_path("#{shome}/var/chef/node")
  ensure_mkdir node_path

  role_path platform_specific_path("#{shome}/var/chef/roles")
  ensure_mkdir role_path

  cache_options({ :path => platform_specific_path("#{shome}/var/chef/cache/checksums") })
  ensure_mkdir cache_options[:path]

  #data_bag_path platform_specific_path("#{shome}/var/chef/data_bags")
  #client_key platform_specific_path("#{shome}/etc/chef/client.pem")
  #validation_key platform_specific_path("#{shome}/etc/chef/validation.pem")
  #signing_ca_cert platform_specific_path("#{shome}/var/chef/ca/cert.pem")
  #signing_ca_key platform_specific_path("#{shome}/var/chef/ca/key.pem")
end

Instance Method Details

#ensure_mkdir(d) ⇒ Object



37
38
39
40
41
# File 'lib/tvdinner.rb', line 37

def ensure_mkdir d
  unless File.exists? d
    FileUtils.mkdir_p d
  end
end