Refactor #3778
Tool's approach to encoding metadata should be reviewed
| Status: | Closed | Start date: | 05/15/2010 | |
|---|---|---|---|---|
| Priority: | Low | Due date: | ||
| Assignee: | - | % Done: | 0% |
|
| Category: | module tool | Spent time: | - | |
| Target version: | - | |||
| Keywords: | Affected URL: | |||
| Branch: | ||||
| Votes: | 0 |
Description
((( Everything below is copied from a recent email thread )))
When a module is created, a “Modulefile” is generated. It’s a Ruby DSL for describing the module and looks like this:
name 'MyUsername-MyModule'
version '0.4.2'
dependency 'SomeUser-SomeModule', '>= 0.2'
dependency 'AntherUser-AnotherModule', '0.7'
When a user builds a module, the tool does an “eval” on the above code and uses it to generate a “metadata.json” file that canonically describes the contents of a release. The resulting JSON file isn’t meant for human use. The tool compiles a bunch of other data into it during the build, ranging from checksums to the details about the Puppet types and dependencies, and clobbers it each time a module’s built.
Maintaining this JSON file by hand would be possible, but would be tedious unless we make the tool powerful enough to update it’s contents — e.g., updating the file checksums, Puppet types/params/docs, etc.
Do we really want to have two different file? A Ruby-based “Modulefile” and the the JSON-based “metadata.json”? I don’t know. I’ve got it working well enough and definitely think the JSON file must be kept because we need a format that the server can safely parse. However, the Ruby “Modulefile” DSL makes logical sense to keep because it eliminates some tedious coding and enforces a complete split what the user enters and what’s generated for them during a build.
At this point, I’d argue for keeping the current arrangement because it works and it’d take at least a day to replace it. However, if you and/or Luke are annoyed enough by this approach, we should address it soon.
History
Updated by Igal Koshevoy over 1 year ago
Updated by Igal Koshevoy over 1 year ago
- Priority changed from Normal to Urgent
I’m upgrading this to “Urgent” priority because much relies on this and changing course will have significant impacts.
Updated by James Turnbull over 1 year ago
I think we should have one file – metadata.json and have the tool interact and populate the file to save users having to fiddle with json.
Updated by Igal Koshevoy over 1 year ago
- Status changed from Unreviewed to Needs Decision
Updated by Anonymous over 1 year ago
- Status changed from Needs Decision to Closed
- Priority changed from Urgent to Low
The user doesn’t need to fiddle with the JSON, the ruby file creates the json and that’s all the user sees.
That’s sufficient and was the conclusion of the mail thread.
The Ruby is only evaluated on the client and generates many more fields than what’s in the ruby.