50 Commits

Author SHA1 Message Date
Mike McQuaid
77c0d38c35
brew style --fix 2022-12-13 11:37:06 +00:00
Sam Ford
40b0070beb
Modify comments and other text
The `check_for_resources` code arguably speaks for itself, so it
doesn't feel like a necessary addition. Besides that, this cleans up
some other comments and text to better align with existing examples.
2022-09-27 00:18:20 -04:00
Mohammad Zain Abbas
03c372ef52 Minor fixes 2022-09-25 02:06:23 +02:00
Mohammad Zain Abbas
e058da1706 Merge branch 'master' into mohammad 2022-09-14 05:19:50 +02:00
Bo Anderson
15280ba107
test: avoid improper, late usage of formula DSL 2022-08-31 20:40:39 +01:00
Mohammad Zain Abbas
2ae583c836 Removed resource_name method 2022-08-11 21:50:54 +02:00
Mohammad Zain Abbas
54c9338ed4 Removed use_homebrew_curl? for resources 2022-08-11 21:25:24 +02:00
Mohammad Zain Abbas
d0355d7640 Fixed brew style issues with livecheck tests 2022-08-07 21:49:16 +02:00
Mohammad Zain Abbas
e15f0b22b9 Added resources' tests for use_homebrew_curl? method (brew tests --only=livecheck/livecheck) 2022-08-07 21:30:56 +02:00
Mohammad Zain Abbas
7ae71097ee Added tests for resources for livecheck_url_to_string 2022-08-07 21:10:10 +02:00
Mohammad Zain Abbas
eba3d5cf1c Added tests for resource when given a valid livecheck_url symbol 2022-08-07 20:58:10 +02:00
Mohammad Zain Abbas
5d90e0136a Added livecheck_url_to_string test for resources 2022-08-07 20:52:46 +02:00
Mohammad Zain Abbas
3476493583 Updated livecheck_spec.rb for resources 2022-08-07 20:47:17 +02: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
Issy Long
cb2a09e65e
Fix (auto-correct) more RSpec/BeNil offenses
- The `RSpec/BeEq` auto-corrections made more `RSpec/BeNil` offenses, so another go of `brew style --only=RSpec/BeNil --fix\` is needed.
2022-03-01 00:36:37 +00:00
Issy Long
72e48024f0
Fix (auto-correct) RuboCop Rspec/BeEq offenses 2022-03-01 00:10:14 +00: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
ddde0f7589
livecheck: allow inheriting from a formula/cask 2021-08-02 09:12:22 -04:00
Bo Anderson
323ff660fa rubocop: use consistent array/hash indentation 2021-02-11 13:27:42 +00:00
Sam Ford
703d59b521
livecheck: check stable before head by default 2021-02-04 15:44:09 -05:00
Seeker
feb45f1ce9 livecheck_version: add tests 2021-01-22 12:25:30 -08:00
Sam Ford
7bbd091fb1
Livecheck: Use let instead of constants in tests 2021-01-13 09:35:56 -05: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
Sam Ford
84e058f6ca
Livecheck: Refactor memoized helpers 2021-01-12 18:04:26 -05:00
Sam Ford
732e67d5db
Expand livecheck/livecheck tests 2020-12-19 23:45:26 -05:00
Sam Ford
3261bbc0bd
Reorganize livecheck/livecheck test variables 2020-12-19 22:26:37 -05:00
Mike McQuaid
4dfcf74fb2
Merge pull request #9478 from MikeMcQuaid/deprecate-disable-date
formula: deprecate!/disable!: deprecate missing or non-ISO 8601 dates.
2020-12-18 12:15:51 +00:00
Markus Reiter
f711352cfd Add audit for livecheck in casks. 2020-12-14 15:44:35 +01:00
Markus Reiter
3bde9d34a9
Remove version from Livecheck. 2020-12-12 17:43:25 -05:00
Seeker
6794a78087
livecheck: add support for casks 2020-12-12 17:43:21 -05:00
Mike McQuaid
f87ce3fffb
formula: deprecate!/disable!: deprecate missing or non-ISO 8601 dates.
As requested in https://github.com/Homebrew/homebrew-core/issues/66360
2020-12-11 14:03:21 +00:00
Sam Ford
5a007a4ec6
livecheck: expand #preprocess_url tests more 2020-11-26 13:34:16 -05:00
Sam Ford
1f40d84ab1
livecheck: expand #preprocess_url tests 2020-11-26 09:50:00 -05:00
Mike McQuaid
a83336db02
Merge pull request #9105 from samford/expand-livecheck-preprocess_url-tests
Expand Livecheck#preprocess_url tests
2020-11-16 12:54:05 +00:00
Sam Ford
e40932e261
livecheck: skip disabled formulae 2020-11-11 17:03:51 -05:00
Sam Ford
e5a8574332
Expand Livecheck#preprocess_url tests 2020-11-11 11:52:58 -05:00
Markus Reiter
24ae318a3d Move type annotations into files. 2020-10-10 14:59:39 +02:00
Mike McQuaid
2e5272d04c Deprecate/disable code for Homebrew 2.5.0.
Do the usual "disable deprecations" and "uncomment pending deprecations"
dance and delete/deprecate/disable relevant/related code.
2020-09-03 10:34:22 +01:00
nandahkrishna
8151016531
livecheck: remove test for livecheck_formulae 2020-08-31 16:37:37 +05:30
Nanda H Krishna
3cab6042d8
livecheck: update URL in test
Co-authored-by: Sam Ford <1584702+samford@users.noreply.github.com>
2020-08-29 03:23:10 +05:30
nandahkrishna
062156365b
livecheck: modified test 2020-08-29 02:18:18 +05:30
nandahkrishna
2550af57df
livecheck: changes made and improved test 2020-08-29 00:32:34 +05:30
nandahkrishna
4e0cc48b65
livecheck: changes made and tests added 2020-08-27 22:46:06 +05:30
nandahkrishna
c9f0642d45
livecheck migration: create Homebrew::Livecheck
Co-authored-by: Sam Ford <1584702+samford@users.noreply.github.com>
Co-authored-by: Thierry Moisan <thierry.moisan@gmail.com>
Co-authored-by: Dawid Dziurla <dawidd0811@gmail.com>
Co-authored-by: Maxim Belkin <maxim.belkin@gmail.com>
Co-authored-by: Issy Long <me@issyl0.co.uk>
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
Co-authored-by: Seeker <meaningseeking@protonmail.com>
2020-08-27 21:26:58 +05:30