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

livecheck: move #preprocess_url into strategies #18455

Commits on Sep 28, 2024

  1. 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.
    samford committed Sep 28, 2024
    Configuration menu
    Copy the full SHA
    9e47fc9 View commit details
    Browse the repository at this point in the history