manifests.Parse("metadata.rb", ...) and manifests.Parse("Berksfile", ...) currently return UnknownFileError. Add static Chef cookbook parsers for both files. They are Ruby DSL files, but parsing must not execute Ruby, load adjacent code, expand constants, or interpolate strings.
For metadata.rb, return the cookbook's literal name, version, and license values in ParseResult. Return literal depends calls as direct runtime dependencies, preserving an omitted constraint as empty and a supplied constraint as written. Chef's metadata documentation defines these fields and the supported version operators. Chef's own code defines the Metadata DSL and depends behavior, and its end-to-end cookbook metadata contains a useful mix of unconstrained and constrained dependencies.
For Berksfile, parse literal source and cookbook calls, including an optional version constraint and explicit git or path source. Chef's Berkshelf documentation documents the syntax, ordered Supermarket sources, path locations, Git locations, and GitHub shorthand. The Berkshelf source has the corresponding cookbook, metadata, and source DSL methods, a small Berksfile fixture, and path and Git examples in its install scenarios.
The result model needs to preserve source declarations without claiming that resolution has occurred. A Berksfile may contain several ordered source entries, and a cookbook may override them with a Git repository or local path. Dependency.RegistryURL alone cannot represent that faithfully because a path is not a registry and the first configured source is not necessarily the source that contains a cookbook. Keep the ordered sources and explicit dependency locations as raw declarations, adding result fields if needed.
The initial literal grammar should accept single- or double-quoted strings, optional parentheses, normal whitespace, and trailing comments. It should skip a field or dependency when a required value uses interpolation, a variable, a method call, concatenation, a loop, or another expression. A dynamic line must not make the rest of the file fail. A bare metadata directive should not cause file access during a normal single-file parse.
Generated PURLs should follow accepted Chef type rules. Chef remains a candidate PURL type, so this work should not invent a name or namespace mapping before that definition is accepted.
Add parser registration, unit tests, fixtures, and README entries. Tests should cover cookbook name, version and license, unconstrained and pessimistic dependencies, multiple literal constraints, public and private Supermarket sources, explicit Git and path sources, comments, optional parentheses, and dynamic expressions mixed with valid literal declarations.
manifests.Parse("metadata.rb", ...)andmanifests.Parse("Berksfile", ...)currently returnUnknownFileError. Add static Chef cookbook parsers for both files. They are Ruby DSL files, but parsing must not execute Ruby, load adjacent code, expand constants, or interpolate strings.For
metadata.rb, return the cookbook's literalname,version, andlicensevalues inParseResult. Return literaldependscalls as direct runtime dependencies, preserving an omitted constraint as empty and a supplied constraint as written. Chef's metadata documentation defines these fields and the supported version operators. Chef's own code defines theMetadataDSL anddependsbehavior, and its end-to-end cookbook metadata contains a useful mix of unconstrained and constrained dependencies.For
Berksfile, parse literalsourceandcookbookcalls, including an optional version constraint and explicitgitorpathsource. Chef's Berkshelf documentation documents the syntax, ordered Supermarket sources, path locations, Git locations, and GitHub shorthand. The Berkshelf source has the correspondingcookbook,metadata, andsourceDSL methods, a small Berksfile fixture, and path and Git examples in its install scenarios.The result model needs to preserve source declarations without claiming that resolution has occurred. A Berksfile may contain several ordered
sourceentries, and a cookbook may override them with a Git repository or local path.Dependency.RegistryURLalone cannot represent that faithfully because a path is not a registry and the first configured source is not necessarily the source that contains a cookbook. Keep the ordered sources and explicit dependency locations as raw declarations, adding result fields if needed.The initial literal grammar should accept single- or double-quoted strings, optional parentheses, normal whitespace, and trailing comments. It should skip a field or dependency when a required value uses interpolation, a variable, a method call, concatenation, a loop, or another expression. A dynamic line must not make the rest of the file fail. A bare
metadatadirective should not cause file access during a normal single-file parse.Generated PURLs should follow accepted Chef type rules. Chef remains a candidate PURL type, so this work should not invent a name or namespace mapping before that definition is accepted.
Add parser registration, unit tests, fixtures, and README entries. Tests should cover cookbook name, version and license, unconstrained and pessimistic dependencies, multiple literal constraints, public and private Supermarket sources, explicit Git and path sources, comments, optional parentheses, and dynamic expressions mixed with valid literal declarations.