499 Commits

Author SHA1 Message Date
Sam Ford
6b66ec9e62
Strategy: Improve curl error message finding
The existing regex wasn't able to match errors like:
  curl: option --something: is unknown

Additionally, the existing approach wouldn't capture multi-line
errors, whereas this captures all the `curl:` lines from `stderr`.
2021-09-07 00:15:08 -04:00
Sam Ford
e65c9d02ab
PageMatch: Expand #find_versions tests 2021-08-19 16:07:53 -04:00
Sam Ford
b4adf2a42e
PageMatch#find_versions: Fix return conditions 2021-08-19 09:01:11 -04:00
Sam Ford
8940d198fe
Make tarball extension regex explicit 2021-08-17 19:15:07 -04:00
Sam Ford
26821301e7
livecheck: move url/regex generation into methods 2021-08-17 18:03:40 -04:00
Sam Ford
13b349b4ae
Refactor #find_versions parameters in strategies 2021-08-16 12:01:32 -04:00
Sam Ford
c59d5db631
Remove unnecessary require statements 2021-08-11 19:06:00 -04:00
Sam Ford
c936a9420e
Improve documentation comments 2021-08-11 19:05:59 -04:00
Sam Ford
f2bd39ccef
Add additional method signatures to strategies 2021-08-11 19:05:59 -04:00
Sam Ford
56dd89114d
Standardize valid strategy block return types
Valid `strategy` block return types currently vary between
strategies. Some only accept a string whereas others accept a string
or array of strings. [`strategy` blocks also accept a `nil` return
(to simplify early returns) but this was already standardized across
strategies.]

While some strategies only identify one version by default (where a
string is an appropriate return type), it could be that a strategy
block identifies more than one version. In this situation, the
strategy would need to be modified to accept (and work with) an
array from a `strategy` block.

Rather than waiting for this to become a problem, this modifies all
strategies to standardize on allowing `strategy` blocks to return a
string or array of strings (even if only one of these is currently
used in practice). Standardizing valid return types helps to further
simplify the mental model for `strategy` blocks and reduce cognitive
load.

This commit extracts related logic from `#find_versions` into
methods like `#versions_from_content`, which is conceptually similar
to `PageMatch#page_matches` (renamed to `#versions_from_content`
for consistency). This allows us to write tests for the related code
without having to make network requests (or stub them) at this point.
In general, this also helps to better align the structure of
strategies and how the various `#find_versions` methods work with
versions.

There's still more planned work to be done here but this is a step
in the right direction.
2021-08-11 19:05:57 -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
83f261b6f2
HeaderMatch: Refactor default header logic 2021-08-02 18:33:59 -04:00
Sam Ford
af2c45b297
Git: compact, uniq array from strategy block 2021-08-02 18:33:59 -04:00
Sam Ford
a970780851
livecheck: allow nil return from strategy blocks 2021-08-02 18:33:34 -04:00
Sam Ford
ddde0f7589
livecheck: allow inheriting from a formula/cask 2021-08-02 09:12:22 -04:00
Bevan Kay
c28db0424d
livecheck: allow query parameter in electron_builder strategy url
Co-authored-by: Sam Ford <1584702+samford@users.noreply.github.com>
2021-07-28 13:20:15 +10:00
Sam Ford
7b864e0aaa
Sourceforge: Do not modify RSS URLs
This allows a `livecheck` block to check the RSS feed for a given
path in a SourceForge project. For example:
https://sourceforge.net/projects/example/rss?path=/directory
2021-07-19 15:15:27 -04:00
Sam Ford
87564b6ccb
Sparkle: Use OS::Mac::Version#prerelease? 2021-06-28 16:54:53 -04:00
Sam Ford
4433f4a985
Sparkle: Update minimumSystemVersion condition 2021-06-28 15:48:35 -04:00
Michael Cho
823dc28c21
livecheck/strategy/sparkle: check minimumSystemVersion for compatibility 2021-06-28 15:39:19 -04:00
Sam Ford
2c4a7ae2cb
Sparkle: Replace Nokogiri with REXML 2021-06-25 17:45:25 -04:00
Sam Ford
23f8cb9f4a
Sparkle: Handle ArgumentError from Time#parse 2021-06-22 10:02:57 -04:00
Sam Ford
a5768de0c3
Sparkle: Account for empty pubDate 2021-06-22 09:23:56 -04:00
Sam Ford
e7d3b2cb31
Sparkle: Move default pub_date value 2021-06-22 09:14:56 -04:00
hyuraku
6720f8bd1e
repair pub-date in livecheck 2021-06-22 09:14:55 -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
nthumann
e6a18803ea
Try getting page content with both headers 2021-06-10 00:12:26 +02:00
Sam Ford
a6769ae7cd
Strategy: Better align curl usage in methods 2021-06-04 16:16:06 -04:00
Sam Ford
793ea17749
Strategy: Create constant for HTTP separator 2021-06-04 16:16:06 -04:00
Sam Ford
ccfd01ba38
Strategy: Replace open-uri with curl 2021-06-04 16:16:05 -04:00
Nanda H Krishna
b920949693
Improve Gnome strategy explanatory comment
Co-authored-by: Sam Ford <1584702+samford@users.noreply.github.com>
2021-05-31 19:47:08 +05:30
Nanda H Krishna
471ce1541d
Modify Gnome strategy and update comments
Co-authored-by: Sam Ford <1584702+samford@users.noreply.github.com>
2021-05-31 16:07:56 +05:30
Nanda H Krishna
e5cfc0f37b
livecheck/strategy/gnome: handle new GNOME versioning 2021-05-30 22:23:07 +05:30
Nanda H Krishna
1182440f80
livecheck/strategy/sparkle: install bundler gems 2021-05-20 19:58:17 +05:30
Markus Reiter
9bb1ba324f
Always take latest item in Sparkle strategy. 2021-04-17 01:32:19 +02:00
Markus Reiter
bbf8a10f2c
Always take first item in Sparkle strategy. 2021-04-15 01:15:59 +02: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
15102a3234
livecheck/strategy/electron_builder: address changes from review
Co-authored-by: Sam Ford <1584702+samford@users.noreply.github.com>
2021-03-22 12:52:43 +05:30
nandahkrishna
f422b6cdc4
livecheck/strategy: add ElectronBuilder strategy 2021-03-20 15:23:09 +05:30
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
nandahkrishna
8e5451df2f
style: use parentheses for assignment in conditions 2021-02-12 18:33:37 +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