Consider automatically adding cookbook in pwd if ./metadata.rb exists
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 18
- Forks
- 23
- Avg merge
- 5d 17h
- Merged PRs (30d)
- 1
Description
Berkshelf has a syntax where for the 95% use case cookbooks all start with the same lines:
source "https://supermarket.chef.io"
metadata
The 'metadata' line is very nearly universally used, and the cases where it is not (the monolithic chef-repo with a top-level Berksfile outside of the cookbooks) this statement could be inverted into "no_metadata" or "metadata false" and not require it in the common case.
With Policyfile.rb's, this is slightly worse:
cookbook "test", path: "."
That accomplishes basically the same thing as the "metadata" line in the Berksfile but is much more verbose and contains the name of the cookbook so its not directly copy-pasta'able (although it is generate'able).
I'd propose that in very nearly the 100% use case we can determine the user intent and not require any configuration from the user just by determining if the pwd contains a metadata.rb or not. That would be correct both in the single-cookbook case where there is a metadata.rb and the policyfile should pretty much always read it, and the case of a monolithic repo with policies outside of cookbooks where there is no metdata.rb. The case where there isn't a metadata.rb but pwd should be considered a cookbook is not valid. The only edge case is where there is a metadata.rb but it should not be read. That seems unlikely and the only way I can think of would be a cookbook with multiple top-level policy files, which seems to be crossing the streams. Even in that case it could be addressed by having a way to override and turn off the automatic inclusion of the metadata.rb.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the proposed behavior for Policyfile.rb and Berksfile alongside the presence of metadata.rb in the current working directory. Determine how automatic metadata inclusion should interact with explicit cookbook configuration and whether an override is required. Done means the behavior and its exceptions are specified clearly enough to implement and verify.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100