opscode/chef — pull request #1790 by danielsdeleo (2014-08-10 20:12:41+00:00)
Title: Make `name` attribute required in cookbook metadata, and respect it

* Respect metadata `name` attribute (prefer it over cookbook's dirname). CHEF-3307
* Make `name` attribute *required* CHEF-3490
* Addresses the issue in CHEF-4336 by evaluating all cookbook metadata up-front and addressing cookbooks by metadata name everywhere (but see caveat below).
* Preserves behavior where errors in unrelated cookbook metadata do not prevent upload with `knife cookbook upload` (CHEF-2923), however we may want to revisit this design choice. In particular, `knife cookbook upload example`, where the cookbook "example" has an error in the metadata.rb file, may claim that the cookbook "example" doesn't exist depending on whether chef was able to evaluate enough of the metadata to read the name.
* **DOES NOT** address CHEF-4811, metadata.json should be preferred over metadata.rb. Chef still evaluates all metadata files present when loading a cookbook.
* **DOES NOT** make the version number a required attribute in metadata, though it would be easy to do so.
* **DOES NOT** Remove cookbook overlay merging behavior, though that feature has been deprecated since Chef 0.10.something (or earlier?) and increases complexity in many areas of the code.

Internally there are some changes to the relationship between the `CookbookVersionLoader`, `CookbookVersion`, and `Metadata` classes. In particular, the `Metadata` class is no longer initialized with a `CookbookVersion` object, because metadata must be evaluated first in order to determine the name (which is a required argument to the constructor for `CookbookVersion`). `Metadata` also had some somewhat bizarre options for the constructor around author settings that were unused in the Chef code base (I also found no example of them being used on GitHub anywhere), so I removed those, too. I think authorship/license stuff is generally handled in code generation anyway.

/cc @opscode/client-engineers