Closed majori closed 1 year ago
Yeah, this was the idea I had in mind also! Also for now we probably want to block execution of a recipe if it touches the same files as the previous ones:
Scenario: New recipe conflicts with the previous recipe
Given a project directory
And a recipe "foo" that generates file "README.md"
And a recipe "bar" that generates file "README.md"
When I execute recipe "foo"
And I execute recipe "bar"
Then the project directory should contain file "README.md"
And the project directory should contain file ".jalapeno/1-foo.yml"
And execution of recipe "bar" has failed with error ...
Currently the way rendered recipe loading works is that for the Files list, all the files in the project directory are loaded. This means that the recipe doesn't really know if a file was rendered by itself or if it was added by the user manually, and in the case of multiple recipes, it could not know which recipe it is conflicting with, which might be nice to show to the user.
I'm thinking that while we're working on this, we could make the Files list be an array of structs, with e.g. filenames and hashes, and make it also be serializable, except for the file content. The content would be added by rendering, and could still be loaded from the project directory too, except it wouldn't be a file tree walk, it would instead look at the rendered files list in the metadata and load those.
That would then let us do things like
Actually we should probably just put all the rendered recipes in one recipes.yaml separated by the YAML file separator mechanism.
Could this be the start of this? Does there need to be some central metadata file in addition to these?