kowainik / summoner

🔮 🔧 Tool for scaffolding batteries-included production-level Haskell projects
https://kowainik.github.io/projects/summoner
Mozilla Public License 2.0
694 stars 73 forks source link

[#519] Implement a golden generator executable #549

Closed chshersh closed 2 years ago

chshersh commented 2 years ago

This PR implements gg — a golden generator executable. It regenerates and updates on disk the content of all projects, scripts and default TOML config. It is useful when doing some massive boring updates (e.g. adding/removing GHC version support). With gg you can just change the main Summoner code and just run crun gg to update all the projects.

The second commit in this PR shows an example of updating years in all projects using gg.

It might be counter-intuitive to use gg to generate tests and then test against tests themselves. But the main idea is that you usually don't use gg after each change. Golden tests ensure that nothing changes unexpectedly. However, when changing e.g. GHC version you expect changes in golden tests. So you can quickly regenerate them, check the diff to verify that the changes look ok and submit them 🙂 If gg generated some unexpected results, you can always clean the mess with git because all the projects under the version control :octocat: