203 Commits

Author SHA1 Message Date
Mohammad Zain Abbas
8e3e9743ac Basic structure completed for livecheckable resources 2022-07-27 16:37:31 +02:00
Mohammad Zain Abbas
73cf8fd205 Updated latest version for resources 2022-07-27 15:24:33 +02:00
Mohammad Zain Abbas
e72487c8b0 Updated for current and latest versions for resources 2022-07-27 15:13:55 +02:00
Mohammad Zain Abbas
2777610095 Work in progress for resource_version 2022-07-27 13:54:20 +02:00
Mohammad Zain Abbas
e84cc8d116 Work in progress for livecheckable resources 2022-07-27 13:27:21 +02:00
Mohammad Zain Abbas
7ce15eaa60 Basic debug info 2022-07-25 00:56:36 +02:00
Mohammad Zain Abbas
a60cd00973 Minor: added version_info for resources 2022-07-24 19:54:00 +02:00
Mohammad Zain Abbas
1ee4f1a696 Work in progress for extending livecheck command for resources 2022-07-24 17:39:07 +02:00
Mohammad Zain Abbas
f4a42d7d66 Added method resource_version to check for resources 2022-07-24 15:47:40 +02:00
Mohammad Zain Abbas
7575170a0b Work in progress for livecheckable resources 2022-07-21 20:02:54 +02:00
Sam Ford
2194f6e12b
Only require livecheck block URL when appropriate
`ExtractPlist` doesn't require a URL like other strategies (it takes
a `Cask` instead) but we've had to provide one in existing
`livecheck` blocks to get past this requirement in livecheck. This
commit makes it so this requirement is only enforced when a
strategy's `#find_versions` method has a required `url` parameter
(not an optional one, as in `ExtractPlist`).
2022-06-24 00:08:54 -04:00
Sam Ford
52cd5dde9c
Respect --newer-only and --quiet in JSON output 2022-06-08 15:50:11 -04:00
Sam Ford
802a430300
livecheck: omit skipped when --newer-only is used 2022-06-08 15:50:11 -04:00
Bo Anderson
38ae98cbcd
livecheck: improve host checks to instead check domains 2022-05-20 01:43:00 +01:00
Sam Ford
2f0a53c0da
Livecheck: Use Homebrew curl based on root domain
At the moment, `#use_homebrew_curl?` can only be true for a
`homepage` or `stable`/cask `url` with `using: :homebrew_curl`. If
the checked URL differs from these URLs, livecheck won't use brewed
curl. This limitation prevents livecheck from using brewed curl for a
`livecheck` block URL that's a string literal (not a symbol for a
`#checkable_url` like `:stable`, `:head`, `:url`). `libzip` was the
original formula referenced in the related brew issue and it meets
this criterion, so it doesn't appear to be handled by the existing
`#use_homebrew_curl?` implementation.

Additionally, the existing behavior can cause livecheck to
unnecessarily use brewed curl for a completely different website
(e.g., `cubelib`, `otf2`). For example, if the `stable` URL has
`using: :homebrew_curl` and the `livecheck` block has `url
:homepage`, livecheck will use brewed curl when checking the
`homepage`. If these are completely different domains/servers, it's
unlikely that we would need to use brewed curl when checking the
`homepage`, so this particular behavior may not be beneficial.

This commit reimplements `use_homebrew_curl?` to apply brewed curl
when the checked URL's root domain is the same as the root domain of
an aforementioned formula/cask URL with `using: :homebrew_curl`. For
example, this looser approach would allow a `livecheck` block
checking `https://www.example.com/downloads/` to use brewed curl if
the `stable` URL was `https://downloads.example.com/example.zip` with
`using: :homebrew_curl`. These could be different servers but, based
on related formulae, this looseness is necessary for the moment.

This approach aims to resolve both issues, allowing brewed curl to be
applied to a slightly broader range of URLs (i.e., not limited to
just the `#checkable_urls`) while also helping to avoid unnecessarily
applying brewed curl when it's less likely to be useful (completely
different domains). Neither approach is perfect but this one may be
more useful in the interim time.

Depending on how this looser approach works in practice, we may want
to consider returning to a stricter approach once we have something
like `using: :homebrew_curl` in `livecheck` blocks (this is
forthcoming). Being explicit in a `livecheck` block is the most
reliable approach (i.e., only use brewed curl when needed), so we
could favor that and pare down the automated approach to only what's
needed to support implicit checks (i.e., with no `livecheck` block).
Of course, it's also possible to drop the automated approach entirely
and simply require a `livecheck` block in this scenario but we can
decide on how to handle this when the time comes.
2022-05-18 18:48:17 -04:00
Mike McQuaid
95213893a6
Revert "Livecheck: Use Homebrew curl based on root domain" 2022-05-18 15:36:12 -04:00
Sam Ford
fb8a4e5658
Livecheck: Use Homebrew curl based on root domain
At the moment, `#use_homebrew_curl?` can only be true for a
`homepage` or `stable`/cask `url` with `using: :homebrew_curl`. If
the checked URL differs from these URLs, livecheck won't use brewed
curl. This limitation prevents livecheck from using brewed curl for a
`livecheck` block URL that's a string literal (not a symbol for a
`#checkable_url` like `:stable`, `:head`, `:url`). `libzip` was the
original formula referenced in the related brew issue and it meets
this criterion, so it doesn't appear to be handled by the existing
`#use_homebrew_curl?` implementation.

Additionally, the existing behavior can cause livecheck to
unnecessarily use brewed curl for a completely different website
(e.g., `cubelib`, `otf2`). For example, if the `stable` URL has
`using: :homebrew_curl` and the `livecheck` block has `url
:homepage`, livecheck will use brewed curl when checking the
`homepage`. If these are completely different domains/servers, it's
unlikely that we would need to use brewed curl when checking the
`homepage`, so this particular behavior may not be beneficial.

This commit reimplements `use_homebrew_curl?` to apply brewed curl
when the checked URL's root domain is the same as the root domain of
an aforementioned formula/cask URL with `using: :homebrew_curl`. For
example, this looser approach would allow a `livecheck` block
checking `https://www.example.com/downloads/` to use brewed curl if
the `stable` URL was `https://downloads.example.com/example.zip` with
`using: :homebrew_curl`. These could be different servers but, based
on related formulae, this looseness is necessary for the moment.

This approach aims to resolve both issues, allowing brewed curl to be
applied to a slightly broader range of URLs (i.e., not limited to
just the `#checkable_urls`) while also helping to avoid unnecessarily
applying brewed curl when it's less likely to be useful (completely
different domains). Neither approach is perfect but this one may be
more useful in the interim time.

Depending on how this looser approach works in practice, we may want
to consider returning to a stricter approach once we have something
like `using: :homebrew_curl` in `livecheck` blocks (this is
forthcoming). Being explicit in a `livecheck` block is the most
reliable approach (i.e., only use brewed curl when needed), so we
could favor that and pare down the automated approach to only what's
needed to support implicit checks (i.e., with no `livecheck` block).
Of course, it's also possible to drop the automated approach entirely
and simply require a `livecheck` block in this scenario but we can
decide on how to handle this when the time comes.
2022-05-17 00:34:32 -04:00
mhmdanas
37c46e1acd Remove space before colon in livecheck output 2022-04-27 01:09:16 +03:00
Sam Ford
bd4124c10f
Livecheck: Avoid duplicate URLs
Some formulae/casks contain duplicate checkable URLs or contain
URLs that become duplicates after `#preprocess_url` is used. With
the former, a formula's `stable` and `head` URLs can be the same if
they both use the Git repository. With the latter, a formula's
`homepage` and `stable` URLs are different but `#preprocess_url` can
return the same Git repository URL for each (which can also be
a duplicate of the `head` URL).

The `fabric-completion` formula is a worst case scenario, as it
contains both of these conditions but the repository has no tags.
By default, livecheck would needlessly check the repository three
times (i.e., no versions are found so livecheck tries the next URL,
which happens to be the same URL).

This commit avoids duplicate URLs in `#checkable_urls` and keeps
track of checked URLs in `#latest_version` to avoid a duplicate
caused by `#preprocess_url`. This should effectively resolve the
issue of checking the same URL more than once for a given
formula/cask. Checking the same URL only once across all the
formulae/casks in a given livecheck run will be handled in a later
commit (though I've done most of the groundwork already in previous
PRs).
2021-12-14 10:31:15 -05:00
EricFromCanada
ed3042c37a
livecheck: use brewed curl if called for by download URL 2021-11-28 12:57:24 -05:00
Sam Ford
f8ded0a435
PageMatch: Enforce requirements in #find_versions
This aligns `PageMatch` with how cask strategies handle requirements
in their `#find_versions` methods. This moves related logic from
`Livecheck#latest_version` into the `PageMatch` strategy, which feels
a bit more appropriate.
2021-11-20 00:39:00 -05:00
Sam Ford
e73524b093
livecheck: Fix debug strategy info printing
The `ExtractPlist` strategy doesn't return certain values (e.g.,
`:url`), so it's necessary to also ensure these values are present
before printing related debug info. Without these changes, we end up
printing info for a blank value (e.g., "URL (strategy):").
2021-11-19 23:58:55 -05:00
Sam Ford
13b349b4ae
Refactor #find_versions parameters in strategies 2021-08-16 12:01:32 -04:00
Sam Ford
cf79ced740
Rework how strategy constants are identified
Up to this point, we've had to rely on making `Strategy` constants
private to ensure that the only available constants are strategies.
With the current setup, the existence of a constant that's not a
strategy would break `Strategy#strategies` and
`Livecheck#livecheck_strategy_names`.

Instead, we can achieve the same goal by skipping over constants
that aren't a class. Other than saving us from having to make these
constants private, this is necessary to be able to create a
`Strategy` constant that can be used in all strategies.
2021-08-11 18:25:34 -04:00
Sam Ford
ddde0f7589
livecheck: allow inheriting from a formula/cask 2021-08-02 09:12:22 -04:00
Mike McQuaid
30a65342e8
Deprecate, disable, delete code for Homebrew 3.2.0
Do the usual deprecation, disable, delete dance for Homebrew 3.2.0.
2021-06-17 11:34:32 +01:00
Mike McQuaid
6f071a06f8
Use JSON.pretty_generate
It's dramatically more human readable for very little difference in
space.
2021-04-09 15:44:37 +01:00
Mike McQuaid
d5733a4133
Remove some premature odisabled
See https://github.com/Homebrew/brew/pull/11075#discussion_r610602507
2021-04-09 14:12:40 +01:00
Mike McQuaid
d73351251c
Deprecate, disable, delete code for next major/minor version.
Do the usual dance for bumping our major/minor version.
2021-04-09 09:30:36 +01:00
Markus Reiter
a210b1a04e
Add extract_plist strategy. 2021-04-07 04:58:31 +02:00
nandahkrishna
8ddf9b37bd
Apply suggestions from code review
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2021-03-05 18:55:51 +05:30
nandahkrishna
ab0e427d3e
Disambiguate formulae/casks from different taps 2021-03-04 23:56:04 +05:30
nandahkrishna
7d5216c500
Improve formula/cask disambiguation 2021-03-04 23:56:04 +05:30
nandahkrishna
f11786d63d
Apply suggestions from code review
Co-authored-by: Sam Ford <1584702+samford@users.noreply.github.com>
2021-03-04 23:56:04 +05:30
nandahkrishna
22cc750c66
livecheck and bump: formula/cask disambiguation 2021-03-04 23:56:04 +05:30
Sam Ford
703d59b521
livecheck: check stable before head by default 2021-02-04 15:44:09 -05:00
EricFromCanada
a427de5bee capitalization fixes
"curl" is the binary, while "cURL" is the umbrella project.
2021-01-26 15:36:44 -05:00
Seeker
a308c6da73
Merge pull request #10376 from SeekingMeaning/livecheck-multi-version
livecheck: split cask versions into sub-versions
2021-01-25 10:08:27 -08:00
nandahkrishna
138f7de18f
Refactor brew bump: apply suggestions from code review
Co-authored-by: Sam Ford <1584702+samford@users.noreply.github.com>
2021-01-24 19:10:47 +05:30
nandahkrishna
e2ddf9894a
Refactor brew bump 2021-01-24 19:10:46 +05:30
Seeker
d9da53044e livecheck: rename version.rb to livecheck_version.rb 2021-01-22 12:25:13 -08:00
Seeker
9edb648869 livecheck: split cask versions into sub-versions 2021-01-21 08:56:50 -08:00
Seeker
e42e98108b
Merge pull request #10348 from SeekingMeaning/livecheck-actual-version
livecheck: compare actual version for casks
2021-01-20 07:44:33 -08:00
Seeker
fbafaff4fe rubocop: require braces for Sorbet sig 2021-01-18 16:52:45 -08:00
Seeker
94a33b1d2e livecheck: compare actual version for casks 2021-01-17 11:24:52 -08:00
Sam Ford
6c4041c026
Livecheck: Do not convert URL symbol to string 2021-01-13 09:35:54 -05:00
Sam Ford
12e5f4dce1
Livecheck: Refactor #skip_conditions into a module
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2021-01-12 18:34:33 -05:00
Sam Ford
aae91cacae
Livecheck: Skip Internet Archive stable URLs 2021-01-12 18:04:26 -05:00
Sam Ford
f36d1a7fb6
Livecheck: Skip Google Code Archive stable URLs 2021-01-12 18:04:26 -05:00
Markus Reiter
41a8fa4efc
Merge pull request #10235 from reitermarkus/livecheck-header
Don't preprocess URL for `:header_match` strategy.
2021-01-07 15:01:31 +01:00