58 Commits

Author SHA1 Message Date
Markus Reiter
786f5d359f
Remove unneeded method. 2024-09-04 22:54:25 +02:00
Markus Reiter
b6d529dab3
Convert Downloadable to a module. 2024-09-04 22:54:21 +02:00
Patrick Linnane
683a8aad99
Update analytics.rb
Co-authored-by: Douglas Eichelberger <697964+dduugg@users.noreply.github.com>
2024-08-20 12:47:48 -07:00
Patrick Linnane
85dfe2561b
api/analytics: use typed: strict
Signed-off-by: Patrick Linnane <patrick@linnane.io>
2024-08-19 10:16:26 -07:00
Patrick Linnane
31df4cff73
download: use typed: strict
Signed-off-by: Patrick Linnane <patrick@linnane.io>
2024-08-13 12:23:33 -06:00
Issy Long
45978435e7
rubocop: Use Sorbet/StrictSigil as it's better than comments
- Previously I thought that comments were fine to discourage people from
  wasting their time trying to bump things that used `undef` that Sorbet
  didn't support. But RuboCop is better at this since it'll complain if
  the comments are unnecessary.

- Suggested in https://github.com/Homebrew/brew/pull/18018#issuecomment-2283369501.

- I've gone for a mixture of `rubocop:disable` for the files that can't
  be `typed: strict` (use of undef, required before everything else, etc)
  and `rubocop:todo` for everything else that should be tried to make
  strictly typed. There's no functional difference between the two as
  `rubocop:todo` is `rubocop:disable` with a different name.

- And I entirely disabled the cop for the docs/ directory since
  `typed: strict` isn't going to gain us anything for some Markdown
  linting config files.

- This means that now it's easier to track what needs to be done rather
  than relying on checklists of files in our big Sorbet issue:

```shell
$ git grep 'typed: true # rubocop:todo Sorbet/StrictSigil' | wc -l
    268
```

- And this is confirmed working for new files:

```shell
$ git status
On branch use-rubocop-for-sorbet-strict-sigils
Untracked files:
  (use "git add <file>..." to include in what will be committed)
        Library/Homebrew/bad.rb
        Library/Homebrew/good.rb

nothing added to commit but untracked files present (use "git add" to track)

$ brew style
Offenses:

bad.rb:1:1: C: Sorbet/StrictSigil: Sorbet sigil should be at least strict got true.
^^^^^^^^^^^^^

1340 files inspected, 1 offense detected
```
2024-08-12 15:24:27 +01:00
Bo Anderson
10cbf191dc
Add env to disable finding packages from paths 2024-07-25 11:37:44 +01:00
Rylan Polster
b5f99d78f4
Rename API filename constants 2024-07-04 12:08:01 -04:00
Rylan Polster
c16a9b33b2
Use cached json API file for formulae and cask specified paths 2024-07-03 13:41:52 -04:00
Markus Reiter
0f0055ede4
Make documentation @api private by default. 2024-04-26 19:04:20 +02:00
Mike McQuaid
ea2892f8ee
brew.rb: handle missing args. 2024-03-07 16:20:20 +00:00
apainintheneck
d64de40e52 Update api code to load internal JSON v3 file 2024-02-27 20:55:16 -08:00
apainintheneck
bea2dc65fe Clean up files that use to include cachable
These were changed to extend to make it easier to determine
where the classes come to in the extended callback but that
means that the file is somewhat inconsistent. On the one
hand we're using class methods and on the other we're extend
self. This cleans that up but now the diff is atrocious and
the blame is even worse. Oh well...
2024-02-26 21:21:38 -08:00
apainintheneck
536ae08a44 cachable: make sure to clear caches between tests
This adds a registry for all modules and classes that
cachable is included in. The registry allows us to
programmatically clear all caches in between tests
so that we don't forget to do that when adding a new
class or refactoring code. The goal here is to reduce
the number of flaky tests in the future.
2024-02-25 17:47:30 -08:00
Markus Reiter
e0743a1436
Reapply "Refactor Formulary::loader_for."
This reverts commit 24683525cb5abf3cc79a9e0e268fa6efd0af558b.
2024-02-22 18:24:57 +01:00
Mike McQuaid
24683525cb
Revert "Refactor Formulary::loader_for." 2024-02-16 13:41:54 +00:00
Markus Reiter
4641690674
Refactor Formulary::loader_for. 2024-02-14 20:28:06 +01:00
Markus Reiter
76d8d6c840
Add type signatures. 2024-02-08 16:30:08 +01:00
Bo Anderson
1c3c64a743
api: use freeze option for JSON parsing 2024-01-09 19:07:36 +00:00
Mike McQuaid
27dda52a5d
Download tap_migrations.json files from the API
Download the previously stored tap migrations files for homebrew/core
and homebrew/cask from the formulae.brew.sh API.

This adds a much longer stale time (24 hours) to decide whether or not
the migrations files need downloaded from the API in Ruby land.
`brew update` will still update them every time.

Requires https://github.com/Homebrew/brew/pull/15628
Fixes https://github.com/Homebrew/brew/issues/14897
2023-07-05 17:18:12 +01:00
Markus Reiter
a3231a03fa
Implement cask renames. 2023-05-12 21:17:30 +02:00
Bo Anderson
44f058edb5
Refactor formula, cask and Ruby source downloads to use shared code 2023-04-27 23:23:07 +01:00
Bo Anderson
5510c3fb2b
Support formula renames in API 2023-04-27 05:15:45 +01:00
Douglas Eichelberger
24cf6076e8 brew style --fix 2023-04-24 20:42:39 -07:00
Markus Reiter
844db75361
Add source paths to API. 2023-04-07 15:20:01 +02:00
Bo Anderson
e663f532a6
Checksum Ruby source file downloads 2023-02-22 22:50:24 +00:00
Bo Anderson
b7d6d00c34
api: use signed endpoint 2023-02-22 21:53:32 +00:00
Bo Anderson
c2342eca91
Further improvements to API handling in shell 2023-02-19 05:38:13 +00:00
Mike McQuaid
f7f04bae26
api: use formulae.brew.sh for cask-source API again.
GitHub's raw endpoint is proving hilariously unreliable for us here.
2023-02-16 12:05:38 +00:00
Douglas Eichelberger
95742f4cfd Enabling typing in Homebrew::API module 2023-02-13 21:33:04 -08:00
Mike McQuaid
2a01529cad
api/versions: remove.
We no longer (never?) need/use these APIs so can remove them from here
and from Homebrew/formulae.brew.sh.
2023-02-04 13:09:59 +01:00
Rylan Polster
32a0877cad
Remove CaskSource API 2023-01-28 02:15:00 -06:00
Mike McQuaid
fd18c7b0ac
Tweak cask-source API handling
- Use raw.githubusercontent.com to download cask source rather than
  formulae.brew.sh. This allows us to remove these files
- output the tap's current `HEAD` for both formulae and cask JSON
- use this `HEAD` for the cask-source API to get the exact file on
  raw.githubusercontent.com rather than just whatever is newest (which
  is what the previous API did)
- set the `Tap` correctly when creating a `Cask` from the API
- if the `formula.json` file exists: print its modified time include
  `brew config`
- memoize `tap.git_head` as we'll be calling it a lot in the same
  process with the same value
2023-01-26 17:36:40 +00:00
Rylan Polster
52263e2917
Fix style 2023-01-06 02:46:21 -05:00
Rylan Polster
54e013aef6
Improve style
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2023-01-06 02:46:21 -05:00
Rylan Polster
68bbe03d04
Remove remaining formula_api_path references 2023-01-06 02:46:21 -05:00
Rylan Polster
bab85d84e9
Extract common JSON API fetch logic 2023-01-06 02:46:21 -05:00
Rylan Polster
374b61584b
Load casks from the JSON API with HOMEBREW_INSTALL_FROM_API 2023-01-06 02:46:21 -05:00
Mike McQuaid
e67901f236
api/formula: handle JSON file corruption.
If we can't parse the file: it's corrupt. Try again up to 3 times before
bailing.
2022-12-08 09:34:05 +00:00
Rylan Polster
e8f2d8f6c5
Load formulae from their aliases using the API 2022-09-14 23:59:10 -04:00
Rylan Polster
bfbb7a79bd
Improve brew update with HOMEBREW_INSTALL_FROM_API 2022-09-02 02:10:12 -04:00
Steve Hahn
9f27bd4c67 simplify cached_formula_json_file check 2022-07-20 11:19:24 -07:00
Steve Hahn
8993ebca88 use --time-cond when caching the formula api json 2022-07-19 17:41:27 -07:00
Rylan Polster
ccd46af7c6
Cleanup 2022-06-14 16:42:10 -04:00
Rylan Polster
43f7fa4162
Update cached formula json file when needed 2022-06-14 16:11:23 -04:00
Rylan Polster
89483abda9
Remove Bottle API 2022-06-14 16:06:05 -04:00
Bo Anderson
1d36c42fb7
Support offline usage under HOMEBREW_INSTALL_FROM_API 2022-06-14 16:06:05 -04:00
Rylan Polster
9fee68c500
Fix installing from API with tap names 2021-10-28 01:25:27 -04:00
Michka Popoff
1cc7ca33c0
update: migrate everyone from linuxbrew-core to homebrew-core
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2021-10-20 11:01:38 +01:00
Bo Anderson
861dea9ada
Bump various type strictnesses 2021-09-11 01:00:23 +01:00