Okay, I kind of took it easy today, mostly because I was pretty tired. Not much to show off, but I figured I'd work through what I want to accomplish with a project that I'm not sure when I'll be able to get it to a working state.
The basic idea is similar to Cruft, but trying to leverage Pijul instead of Git. One thing that's different is, if I'm understanding the documentatation correctly, Cruft is most meant to overwrite and add files that don't get edited during the course of development. What I want from my tool is, a few things:
- Handling changes of the template
- Handling changes of the values
- Expanding a template anywhere in a repository; in particular, having a root templated directory, with arbitrarily many templated directories directly underneath it.
- Automatically running commands after all templated directories are updated. (It might be possible to bootstrap this from post-generate hooks)
These requirements suggest a few things:
- I need a flexible in-memory representation of a diff between strings. In particular, it must be possible to grow and shrink the diff sections by moving unchanged characters across the boundary.
- I need custom Jinja filters for rendering diff data. (Alternatively, maybe it's possible to pass template data incrementally, and assign the output directly into an in-memory diff, but I don't know if Jinja would let me do that.)
- I need to be able to introspect Jinja syntax enough to convert a diff of a template into a template of a diff, by growing the diff the minimum amount needed.
- I need to be able to write Pijul diffs. I believe the format isn't fully documented, but I'm not sure.
- Tool-specific data about a templated directory should be stored relative to the repository, not relative to the templated directory.
- Maybe something vaguely make-like.
I'm not sure if Pijul is ready to have this tool targeting it, but I'm a ways off from implementing all the parts that don't depend on Pijul, so it basically evens out. I'll be researching some of the Jinja stuff while I publish this.