Class: HealthInspector::Checklists::Cookbooks
- Inherits:
-
Base
- Object
- Base
- HealthInspector::Checklists::Cookbooks
show all
- Defined in:
- lib/health_inspector/checklists/cookbooks.rb
Instance Method Summary
collapse
Methods inherited from Base
#banner, #indent, #initialize, #load_ruby_or_json_from_local, #load_validate, option, #print_failures, #print_failures_from_hash, #print_key, #print_success, #print_value_diff, #run, run, title, #ui, underscored_class, #validate_item
#color
Instance Method Details
#all_item_names ⇒ Object
123
124
125
|
# File 'lib/health_inspector/checklists/cookbooks.rb', line 123
def all_item_names
(server_items.keys + local_items.keys).uniq.sort
end
|
#load_item(name) ⇒ Object
98
99
100
101
102
103
|
# File 'lib/health_inspector/checklists/cookbooks.rb', line 98
def load_item(name)
Cookbook.new(@context,
name: name,
server: server_items[name],
local: local_items[name])
end
|
#local_items ⇒ Object
112
113
114
115
116
117
118
119
120
121
|
# File 'lib/health_inspector/checklists/cookbooks.rb', line 112
def local_items
cl = Chef::CookbookLoader.new(@context.cookbook_path)
cl.load_cookbooks
cl.inject({}) do |hash, (name, cookbook_version)|
hash[name] = Chef::Version.new(cookbook_version.version)
hash
end
end
|
#server_items ⇒ Object
105
106
107
108
109
110
|
# File 'lib/health_inspector/checklists/cookbooks.rb', line 105
def server_items
Chef::CookbookVersion.list.reduce({}) do |hsh, (name, version)|
hsh[name] = Chef::Version.new(version['versions'].first['version'])
hsh
end
end
|