177 Commits

Author SHA1 Message Date
Markus Reiter
480e264d9a
Lint Ruby docs. 2024-05-01 11:35:21 +02:00
Markus Reiter
caf87c0336
Warn about undocumented non-private APIs. 2024-05-01 11:35:20 +02:00
Markus Reiter
0f0055ede4
Make documentation @api private by default. 2024-04-26 19:04:20 +02:00
Markus Reiter
c76170a456
Hide #to_s in docs. 2024-04-26 14:04:55 +02:00
Markus Reiter
fe4ef62aa9
Hide #inspect in docs. 2024-04-26 13:20:05 +02:00
Mike McQuaid
ea2892f8ee
brew.rb: handle missing args. 2024-03-07 16:20:20 +00:00
Mike McQuaid
03e583e746
cask: read bundle version from Info.plist when sensible.
If you're trying to use `brew info --json=v2` to get an installed
version and figure out if it is outdated: you're going to have a bad
time with `auto_updates` casks because `installed_version` alone is not
enough to get the actually currently installed version of the app.

Instead, in these cases, try to read from `Info.plist` if there is one
and use that version.

While we're here, add a `blank?` method to `Version` so we can use it
for `present?` checks (making a `null?` `Version` object `blank?`).

Co-authored-by: Markus Reiter <me@reitermark.us>
2024-03-06 15:52:16 +00:00
Issy Long
f682147598
Fix RuboCop Style/RedundantFreeze offenses 2024-01-18 22:20:01 +00:00
Bo Anderson
b42256d286
Deprecate, disable & delete code for Homebrew 4.2.0 2023-12-07 23:42:13 +00:00
Sam Ford
2298b74fed
Version: Improve date version parsing
The existing date version parsing regex only matches file names that
have a prefix (e.g., `ltopers-v2017-04-14.tar.gz`), so it doesn't
match files like `2023-09-28.tar.gz`. There are a handful of formulae
that have to manually specify the version as a result (e.g.,
`marksman`, `sqtop`, etc.). `bootloadhid` is also affected but that's
because the filename uses a dot as the prefix delimiter (e.g.,
`bootloadHID.2012-12-08.tar.gz`) and the regex only matches a hyphen.

This addresses these shortcomings by using `[._-]` as the prefix
delimiter and making it optional.

Co-authored-by: Markus Reiter <me@reitermark.us>
2023-10-07 16:37:23 -04:00
Francois-Xavier Coudert
748f060e1b Revert "Version: Improve date version parsing"
This reverts commit 7626bdd1fd84cc5f70c4cb9f7bdf323bb771cf59.
2023-10-04 19:56:21 +02:00
Sam Ford
7626bdd1fd
Version: Improve date version parsing
The existing date version parsing regex only matches file names that
have a prefix (e.g., `ltopers-v2017-04-14.tar.gz`), so it doesn't
match files like `2023-09-28.tar.gz`. There are a handful of formulae
that have to manually specify the version as a result (e.g.,
`marksman`, `sqtop`, etc.). `bootloadhid` is also affected but that's
because the filename uses a dot as the prefix delimiter (e.g.,
`bootloadHID.2012-12-08.tar.gz`) and the regex only matches a hyphen.

This addresses these shortcomings by using `[._-]` as the prefix
delimiter and making it optional.
2023-10-04 11:58:25 -04:00
Mike McQuaid
8775465872
Enable Sorbet after running a developer command
We have no commands with Sorbet disabled and have had Sorbet enabled
for developers for a decent amount of time. As a result, we can enable
it for everyone who has run a developer command.

This also allows a bunch of `raise TypeError`s to be removed in favour
of relying on Sorbet here instead.
2023-09-02 08:39:28 -04:00
Douglas Eichelberger
33d9dc63b0 Fix type errors when HOMEBREW_SORBET_RUNTIME=1 2023-07-18 10:22:51 -07:00
Mike McQuaid
7da934f7e2
Deprecate/disable/delete code.
The next release after this is merged will be 4.1.0.

Co-authored-by: Markus Reiter <me@reitermark.us>
2023-07-06 16:56:20 +01:00
Markus Reiter
5c9c089b68
Improve #to_str and #to_json for Version::NULL. 2023-05-11 19:16:42 +02:00
Markus Reiter
8274920217
Rename OS::Mac::Version to MacOSVersion. 2023-05-09 05:08:38 +02:00
Markus Reiter
4bbf120630
Add note about Version constructor. 2023-05-09 01:13:55 +02:00
Markus Reiter
fe19ddc3a7
Remove Version#empty?. 2023-05-09 01:13:55 +02:00
Markus Reiter
a1efaf1864
Merge HeadVersion and NullVersion into Version. 2023-05-09 01:13:54 +02:00
Douglas Eichelberger
24cf6076e8 brew style --fix 2023-04-24 20:42:39 -07:00
Douglas Eichelberger
c0092c2fd2 Move and re-namespace HeadVersion 2023-04-04 18:14:54 -07:00
Douglas Eichelberger
0ca4f7eebb Add Version#compare 2023-04-04 18:14:54 -07:00
Issy Long
60d93310af
rubocop: Drop "a" and "b" from Naming/MethodParameterName allowlist 2023-03-11 00:17:28 +00:00
Carlo Cabrera
93fd448c6c
version: fix bad regexps in version parsers
The character class `[.-v]` is interpreted as all the characters between
`.` and `v`, which is clearly not what is intended here.

Here's an example of what this fixes. Before:

    ❯ brew ruby -e 'puts Version.detect("https://github.com/llvm/llvm-project/releases/download/llvmorg-16.0.0-rc1/llvm-project-16.0.0rc1.src.tar.xz")'
    6.0.0rc1

After:

    ❯ brew ruby -e 'puts Version.detect("https://github.com/llvm/llvm-project/releases/download/llvmorg-16.0.0-rc1/llvm-project-16.0.0rc1.src.tar.xz")'
    16.0.0rc1

The problem here is that `1` is a match for `/[.-v]/`.

    ❯ brew ruby -e 'puts /[.-v]/.match("1")'
    1
2023-02-01 10:48:45 +08:00
Bo Anderson
24717a8ac3
version: tokenize prior to freezing 2022-06-02 03:25:55 +01:00
Bo Anderson
cee86846ce
Fix Sorbet violations. 2021-08-06 14:03:00 +01:00
EricFromCanada
5519a0b379
version: check for both cases in suffix 2021-07-16 08:28:15 -04:00
Sam Ford
d4c15a6d9d
Version: Add parser for hyphenated filenames 2021-06-16 14:16:57 -04:00
nandahkrishna
8e5451df2f
style: use parentheses for assignment in conditions 2021-02-12 18:33:37 +05:30
Bo Anderson
71d81a8611 version: handle subclasses in major_minor and major_minor_patch 2021-02-09 18:35:22 +00:00
Seeker
35f857e38f version: rename more regex constants 2021-01-28 16:59:51 -08:00
Seeker
c5d3b9ae3e version: rename regex constants 2021-01-28 16:42:44 -08:00
Seeker
2e6e38ec4d version: rename ALPHA_SUFFIX to PREREL_SUFFIX 2021-01-28 16:41:49 -08:00
Seeker
a52959d5d2 version: replace [-.vV] with [.-vV] in regexes 2021-01-28 16:41:49 -08:00
Seeker
fc7c243471 version: add constants for regexes 2021-01-28 16:41:49 -08:00
Seeker
d9e8a34d3b version: replace [.] with \. in regex 2021-01-28 16:41:49 -08:00
Seeker
f76bf240cd version: replace [-_] with [_-] in regexes 2021-01-28 16:41:49 -08:00
Seeker
e1d68cf1eb version: make [._-] consistent in regexes 2021-01-28 16:41:49 -08:00
Seeker
acdb05dbcf
Merge pull request #10407 from SeekingMeaning/version-public-api
version: mark methods as public
2021-01-25 18:50:08 -08:00
Seeker
0a0f435a88
Merge pull request #10378 from SeekingMeaning/version-regexes
version: add new `Version::Parser` class
2021-01-25 09:24:42 -08:00
Seeker
7171b3a41d version: mark methods as public 2021-01-24 11:58:22 -08:00
Seeker
568fc86676 version: add new Version::Parser class 2021-01-21 10:02:48 -08:00
Jonathan Chang
1e04cce19b version: fix type signature
Fixes type error:
Parameter 'val': Expected type T.any(String, Version), got type PkgVersion
2021-01-21 16:11:37 +11:00
Seeker
32ebc02f2f version: enable Sorbet type checking 2021-01-19 09:28:37 -08:00
souleater7
e50e3e4b22 Delete references to devel 2021-01-01 10:16:31 -08:00
Markus Reiter
6a125401c7
Unescape URL before parsing a version from it. 2020-12-19 19:34:18 -05:00
Markus Reiter
1b732ec7b2 Fix RuboCop offenses. 2020-11-16 02:05:29 +01:00
Rylan Polster
50890ebd51 fix Lint/DuplicateBranch style 2020-11-16 02:02:52 +01:00
Markus Reiter
da9289eff0 Add more type signatures. 2020-11-13 12:26:36 +01:00