exercism / rust

Exercism exercises in Rust.
https://exercism.org/tracks/rust
MIT License
1.46k stars 519 forks source link

exercise util: use templates instead of manually modifying files #698

Closed coriolinus closed 1 year ago

coriolinus commented 5 years ago

Currently many operations in this utility operate at the file level, directly appending strings and bytes. We'll get better results with higher-level abstractions: never directly appending to Config.toml, for example, but using a toml-parsing crate instead. Likewise, writing the tests file will be much easier using a template system like handlebars. Note that this mention of handlebars isn't a requirement to use that particular crate, just an example of a plausible templating engine.

It is not necessary to implement this before #679 or #686, but those issues will probably be easier to fix after the fix for this has been implemented.

ZapAnton commented 5 years ago

If by Config.toml you mean Cargo.toml, then it is already parsed with the toml crate and there is no appending: the content of the file is parsed, modified and then the new content fully overrides the old one. What should be added to this behavior in the context of this issue?

coriolinus commented 5 years ago

See the changes here. There are some other changes in that diff, mostly due to some necessary macro refactoring, but that file has the most important ones.

senekor commented 1 year ago

exercise util has been deleted since, see this thread for more context.