visevol / GithubVisualisation

PFE028 Été 2024
MIT License
0 stars 1 forks source link

[Backend] Cleanup temp directory created by GitRepository #36

Closed zergov closed 6 days ago

zergov commented 6 days ago

Change the interface of GitRepository so that it accepts a directory in its initializer. The class will force Git to execute in this directory.

Add a new .temporary class methods that instantiates a GitRepository instance with a temp directory and yields the instance. Once the block terminates, the temp directory is removed.

Example:

GitRepository.temporary do |git|
  git.clone("https://github.com/rails/rails")
  git.logs(since: DateTime.parse("2024-01-01")) { |logs| parse_logs(logs) }
end