-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
livecheck: move #preprocess_url into strategies
`Livecheck#preprocess_url` only contains logic for rewriting Git URLs, so it makes more sense for this code to be part of the `Git` strategy instead. Outside of better code organization, this saves us from having to maintain the list of strategies to skip processing (which is sometimes forgotten when a new strategy is added) and makes it easier to do something similar in other strategies as needed. One thing to note is that `Livecheck#preprocess_url` was previously called on the URL before each strategy's `#match?` method was called. To maintain the existing behavior, this calls `Git#preprocess_url` in `Git#match?`. However, we need the processed URL when we use the `Git` strategy, so we have to call `Git#preprocess_url` again. To avoid duplicating effort, I've added a `@processed_urls` hash to the `Git` strategy and have set up `Git#preprocess_url` to cache processed URLs, so we only do the work once. There may be a better way of handling it but this seems to work as expected.
- Loading branch information
Showing
4 changed files
with
163 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.