TODO:
- implement custom variables
- regex based (using named capture groups)
- simple (string)
- script
- integrate external templating library
- file content filter
- download action; struct Download { to: PathBuf, url: String?, if_exists: ConflictOption, confirm: bool}
- write action to write files based on some content
- compressed file extraction action
- refactor
- refactor logger so all logs are put into one file. debug logs should not be written to stout unless a --verbose option is provided. each run should have its own log file in a folder named with the time the program was run
- create a resource struct that represents a file and holds a context for that specific file, so operations can be parallelized without affecting the Tera context; get rid of global context. Take the list of rule variables in constructor
- look for configs at git repo root
- Add comprehensive test suite
- Implement robust data validation
- A watch command
- A corresponding file watcher synchronization service that keeps the known_files cache in sync with the fs
- Undo capabilities
- backups
- Comprehensive testing using
rstest,proptest,mockall, andinsta. - Data validation with
garde.
This project will use a combination of testing libraries to ensure code quality and correctness.
rstest will be the primary framework for writing unit and integration tests. Its fixture-based approach allows for writing clean, readable, and maintainable tests by decoupling test setup from the test logic.
For more robust testing of functions, especially those with complex inputs, proptest will be used. Property-based testing helps in finding edge cases by generating a wide range of inputs and asserting that certain properties hold true for all of them.
To isolate components and test them independently, mockall will be used for creating mock objects. This is particularly useful for mocking external dependencies and services, allowing for more controlled and predictable tests.
Insta will be used for snapshot testing. This is ideal for testing complex data structures and the output of the templating engine. Snapshots are stored in files and are reviewed and approved manually. Any changes in the output will cause the test to fail, preventing unintended regressions.
To ensure the integrity of data throughout the application, especially when parsing configuration files and user input, garde will be used.
Garde is a validation library that allows for defining validation rules directly on structs and enums using derive macros. This will help in catching invalid data early and providing clear error messages. It supports a wide range of validation rules, including length, range, and custom validators.