Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce Services #395

Merged
merged 14 commits into from
Nov 5, 2021
Merged

Introduce Services #395

merged 14 commits into from
Nov 5, 2021

Conversation

mscottford
Copy link
Member

Converts usage of ManifestFinder and FileHistoryFinder into "services" that can be used to obtain finder instances. Also introduces ManifestFinderRegistry and FileHistoryFinderRegistry to separate that responsibility from the service. Also changes the way that the service is interacted with, to make it less aware of some implementation details. Also starts laying the groundwork for using Dependency Injection more broadly.

Dependent on #298 and is branched off of its branch. Will be rebased against main when that PR is merged.

@mscottford
Copy link
Member Author

Since there are still some things that need to be worked out with date-time-offest branch, I’m going to change the point that this pull request branches from so that it doesn’t depend on PR #298.

When the `Runner` and `ManifestService` changed to use `yield return`,
it seems to have accidentally resulted in producing outputs for
multiple manifest files from multiple providers. That something that we
ultimately want, and I'm trying to keep this pull request more tightly
scoped than that.
When I moved the LibYearCalculator creation logic out of the
ManifestFinder (now ManifestService) class, I incorrectly passed the
single manifest file in to the `RepositoryFor` and `ManifestFor`
methods, when those methods are expecting to work on directories.
mscottford and others added 8 commits November 4, 2021 23:59
This will be changed by the date-time-offset branch when it's ready, so
it's okay to accept this change here.
This will be fixed when multiple-manifest support is added, so we can
defer this for now.
Introduces `FileHistoryFinderRegistry` that's responsible for keeping
track of the diffrent `IFileHistoryFinder` instances that have been
registered.

Renames `FileHistoryFinder` class to `FileHistoryService` to better
match the role that it plays. Also moves time-intensive tasks out of the
class's construct. This is to support the shift to `asnyc` calls that
will come later. Constructors cannot run in an `async` fashion, so
anything that might to be `await`ed on needs to be moved out of the
constructor.
Before the registy class was introduced, there was an assumption that
the `LocalFileHistoryFinder` was always registered. This default
behavior has been removed. Also took an incremental step towards more
dependency injection. This is causing more setup logic to appear in the
tests. That logic can be centralized at a later time.
The `LocalFileHistoryFinder` needs to be registered last. This is
because it always reports that it can work with the specified path. This
makes it closer to an implementation of the Null Object pattern.
@mscottford mscottford marked this pull request as ready for review November 5, 2021 04:27
@mscottford mscottford merged commit 82d3994 into main Nov 5, 2021
@mscottford mscottford deleted the introduce-services branch November 5, 2021 04:27
@github-actions github-actions bot locked and limited conversation to collaborators Nov 5, 2021
@mscottford mscottford added the enhancement New feature or request label Nov 14, 2021
@mscottford mscottford added this to the v0.5.0 milestone Sep 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant