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
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: