Handles loading configuration values from a Chef config file
@author Justin Campbell <justin.campbell@riotgames.com>
@param [String] path
# File lib/chef_zero/cookbook_data.rb, line 68 def initialize(cookbook) self.name(cookbook.name) self.recipes(cookbook.fully_qualified_recipe_names) %w(attributes grouping dependencies supports recommendations suggestions conflicting providing replacing recipes).each do |hash_arg| self[hash_arg.to_sym] = Hashie::Mash.new end end
# File lib/chef_zero/cookbook_data.rb, line 76 def from_json(json) self.merge!(JSON.parse(json)) end
# File lib/chef_zero/cookbook_data.rb, line 114 def attribute(name, options) self[:attributes][name] = options end
# File lib/chef_zero/cookbook_data.rb, line 98 def conflicts(cookbook, *version_constraints) cookbook_arg(:conflicting, cookbook, version_constraints) end
# File lib/chef_zero/cookbook_data.rb, line 122 def cookbook_arg(key, cookbook, version_constraints) self[key][cookbook] = version_constraints.first || ">= 0.0.0" end
# File lib/chef_zero/cookbook_data.rb, line 82 def depends(cookbook, *version_constraints) cookbook_arg(:dependencies, cookbook, version_constraints) end
# File lib/chef_zero/cookbook_data.rb, line 118 def grouping(name, options) self[:grouping][name] = options end
# File lib/chef_zero/cookbook_data.rb, line 126 def method_missing(key, value = nil) if value.nil? self[key.to_sym] else store key.to_sym, value end end
# File lib/chef_zero/cookbook_data.rb, line 102 def provides(cookbook, *version_constraints) cookbook_arg(:providing, cookbook, version_constraints) end
# File lib/chef_zero/cookbook_data.rb, line 110 def recipe(recipe, description) self[:recipes][recipe] = description end
# File lib/chef_zero/cookbook_data.rb, line 90 def recommends(cookbook, *version_constraints) cookbook_arg(:recommendations, cookbook, version_constraints) end
# File lib/chef_zero/cookbook_data.rb, line 106 def replaces(cookbook, *version_constraints) cookbook_arg(:replacing, cookbook, version_constraints) end
# File lib/chef_zero/cookbook_data.rb, line 94 def suggests(cookbook, *version_constraints) cookbook_arg(:suggestions, cookbook, version_constraints) end
# File lib/chef_zero/cookbook_data.rb, line 86 def supports(cookbook, *version_constraints) cookbook_arg(:supports, cookbook, version_constraints) end