335 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
f7361c8d29
Remove disabled extend. 2024-04-30 11:01:12 +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
732bd52c72
Fix typo.
Co-authored-by: Eric Knibbe <enk3@outlook.com>
2024-04-23 02:07:42 +02:00
Markus Reiter
4b432c7ea4
Explicitly mark non-private APIs. 2024-04-22 21:16:49 +02:00
Mike McQuaid
56fc9a1fb2
Merge pull request #17047 from Homebrew/block-params
Prefer numbered block params over proc conversion, cont'd
2024-04-08 19:13:01 +01:00
Douglas Eichelberger
c59d9fa833 Prefer numbered block params over proc conversion, cont'd 2024-04-08 09:47:27 -07:00
Mike McQuaid
1474806527
Add more HOMEBREW_FORBIDDEN_* configuration
We already had `HOMEBREW_FORBIDDEN_LICENSES` but this commit adds
`HOMEBREW_FORBIDDEN_CASKS`, `HOMEBREW_FORBIDDEN_FORMULAE` and
`HOMEBREW_FORBIDDEN_TAPS` for also forbidding those.

Relatedly, add `HOMEBREW_FORBIDDEN_OWNER` and
`HOMEBREW_FORBIDDEN_OWNER_CONTACT` to allow customising these
messages.

There were no existing tests for `HOMEBREW_FORBIDDEN_LICENSES` so have
added more tests for all of these checks.

Co-authored-by: Bo Anderson <mail@boanderson.me>
2024-04-08 16:38:32 +01:00
Kevin
58b84c3979
Merge pull request #16867 from Homebrew/stop-using-full-name-as-key-in-cask-json-v3
cask: always return short cask tokens from core cask tap
2024-03-12 22:51:10 -07:00
Mike McQuaid
b1990ed4b6
Merge pull request #16863 from apainintheneck/memoize-installed-tap-loading-v2
Memoize installed tap loading v2
2024-03-12 08:36:09 +00:00
apainintheneck
6e0e78cadd tap: CoreCaskTap#cask_tokens should always return short names
This seems to be a bug with how we handle name shortening for the
core cask tap. The core tap always returns short formula names
and returning long names from the core cask tap when not using
the API leads to unexpected behavior.

Specifically this can trick the `brew untap` command into thinking
that there aren't any installed casks in the core cask tap and that
it can be removed even when that is not the case.

One risk here is that the full names were used when caching
descriptions so descriptions could be out of date for people in
the short term though hopefully that's not the end of the world.
2024-03-09 18:59:31 -08:00
apainintheneck
08442734ab s/Tap.reverse_tap_migrations_renames/Tap.tap_migration_oldnames/ 2024-03-09 10:27:22 -08:00
apainintheneck
d4a273443c tap: add #reverse_tap_migrations_renames to speed things up
This gets used by `Tap.reverse_tap_migrations_renames` and reduces
the amount of information that needs to be calculated on the fly
every time.
2024-03-09 10:25:47 -08:00
apainintheneck
3834ef1b73 tap: cache more things at the Tap level
I added two new methods to cache both installed and all taps.
All taps includes core taps no matter if they're installed locally
since they're always provided by the API anyway.

This makes it easier to cache `Tap.each` while making the code
easier to reason about. It also will be useful because we'll
be able to avoid the `Tap.select(&:installed?` pattern that has
recently invaded the codebase.

Note: I also stopped clearing all tap instance caches before
tests. Running `Tap.each` would cache existing taps which would
lead to unexpected behavior since the only existing tap before
each test is the core tap. This is the only tap whose directory
is not cleaned up between tests so we just clear it's cache directly.
We also now clear all tap instances after tests as well regardless
of whether the API was used that time.
2024-03-08 23:22:00 -08:00
Mike McQuaid
9ac31827a0
Various brew update behaviour improvements
- Output a message every time auto-update is run rather than a 3 second
  timer. This makes it more obvious that Homebrew isn't just sitting
  doing nothing for 2.9 seconds.
- Output a message when running `brew update` so Homebrew doesn't just
  sit there silently doing nothing.
- Update all taps when `brew update` is run, not just those hosted on
  GitHub. This makes it more obvious that people don't need to explictly
  run `brew update` "just in case".
- As a result of this, remove `brew tap --force-auto-update` as it's no
  longer necessary.
2024-03-08 16:21:09 +00:00
Mike McQuaid
b70884a474
Merge pull request #16848 from Homebrew/rubocop_default_hash_syntax
rubocop: default hash syntax.
2024-03-08 07:55:33 +00:00
apainintheneck
e0cea903ec s/to_api_hash/to_internal_api_hash/ 2024-03-07 20:29:58 -08:00
apainintheneck
12d5a40262 dev-cmd/generate-cask-api: start generating cask internal JSON v3
This adds a new file to the output of `brew generate-cask-api` which
represents the new internal JSON v3 file. It involves removing
a bunch of unneeded hash keys while removing blank ones as well.

I've made some slight changes to the cask loader as well but more
might be necessary before this starts loading things correctly.
The full loader code will be added in a separate PR.
2024-03-07 20:29:58 -08:00
Mike McQuaid
ea2892f8ee
brew.rb: handle missing args. 2024-03-07 16:20:20 +00:00
Mike McQuaid
3654c1ad2c
Merge pull request #16844 from reitermarkus/tap-clear-all-caches
Actually clear all tap caches.
2024-03-07 15:36:25 +00:00
Markus Reiter
47ff0b76c8
Actually clear all tap caches. 2024-03-07 15:43:16 +01:00
Markus Reiter
be9c0b8787
Simplify TapConfig. 2024-03-07 15:31:37 +01:00
Michael Cho
12d1e56ff5
dev-cmd/bump: skip autobump formulae & casks
Instead output a message that corresponding formula/cask is on the
autobump list. This avoids deferring the information to the error
message within `bump-{formula,cask}-pr`.

Signed-off-by: Michael Cho <michael@michaelcho.dev>
2024-03-06 12:34:29 -05:00
Mike McQuaid
3ea74ea417
Merge pull request #16835 from reitermarkus/tap-config-private
Don't store tap config when value is unknown.
2024-03-06 15:33:54 +00:00
Mike McQuaid
026ca68c5c
Merge pull request #16834 from reitermarkus/tap-new-private
Make `Tap::new` private.
2024-03-06 15:33:25 +00:00
Markus Reiter
c7f4e006f4
Don't store tap config when value is unknown. 2024-03-06 15:18:52 +01:00
Markus Reiter
e3a102efd4
Make Tap::new private. 2024-03-06 15:10:14 +01:00
Markus Reiter
a851bb86ef
Add type signature for Tap::fetch. 2024-03-06 14:30:17 +01:00
Kevin
a86094d794
Merge pull request #16808 from reitermarkus/tap-sig-alias-table
Simplify `Tap#alias_table`.
2024-03-04 21:33:07 -08:00
Mike McQuaid
a9f655b515
Merge pull request #16811 from reitermarkus/tapconfig-sig
Add type signatures for `TapConfig`.
2024-03-04 16:27:15 +00:00
Markus Reiter
00d69284e4
Add type signatures for TapConfig. 2024-03-04 17:14:02 +01:00
Markus Reiter
1a13097a86
Actually cache Tap#pypi_formula_mappings. 2024-03-04 16:57:39 +01:00
Markus Reiter
34af31a05d
Actually cache Tap#style_exceptions. 2024-03-04 16:51:38 +01:00
Markus Reiter
9e8acb6312
Actually cache Tap#audit_exceptions. 2024-03-04 16:51:35 +01:00
Markus Reiter
890bec6515
Simplify Tap#alias_reverse_table. 2024-03-04 16:49:33 +01:00
Markus Reiter
0592f7ac07
Simplify Tap#alias_table. 2024-03-04 16:47:48 +01:00
Mike McQuaid
8d4e841965
Merge pull request #16778 from reitermarkus/tap-sig-4
Simplify `Tap#custom_remote?`.
2024-03-04 14:42:52 +00:00
Markus Reiter
abc591e702
Simplify Tap#custom_remote?. 2024-03-04 14:30:06 +01:00
Markus Reiter
b4167f97d6
Simplify Tap#remote_repo. 2024-03-04 14:27:55 +01:00
Michael Cho
72f8399110
formula_auditor: move out synced_versions_formulae logic
* tap: take ownership of synced_versions_formulae.json
* formula: add synced_with_other_formulae? logic

Signed-off-by: Michael Cho <michael@michaelcho.dev>
2024-03-03 20:51:09 -05:00
apainintheneck
fb055f7aaf tap: revert caching Tap.reverse_tap_migrations_renames
This could cause problems if a tap is installed during the lifetime
of the program which happens occasionally with `Tap#ensure_installed!`.

It also seems to be slow mainly because of intermediate arrays and
Pathname objects that get created in `Tap.each`. Maybe that should
be optimized instead.
2024-03-02 11:31:04 -08:00
apainintheneck
2da1c93df7 tap: memoize Tap.reverse_tap_migrations_renames
This should be a relatively small hash but it gets recalculated
every time we call Cask#oldnames or Formula#oldnames which ends
up being a lot if you run certain commands with --eval-all.

For example, when running the following, it took 10% of the total
runtime.

```
brew deps --casks --eval-all
```
2024-03-01 20:14:42 -08:00
apainintheneck
99d5200db3 tap: fix performance regression in *_files_by_name
We essentially stopped caching these accidentally and they get
called every time we try to load a cask or formula from the API.
It gets really, really, really slow.

I ran `brew deps --casks --eval-all` before and after the changes.

I let it run for 3 minutes before killing it. No output had been
printed to the screen.

It finished printing all output (pages and pages of it) in less
than a minute.

---

This should match the caching behavior we had before the
recent changes in these two PRs.

- https://github.com/Homebrew/brew/pull/16777
- https://github.com/Homebrew/brew/pull/16775
2024-03-01 19:30:53 -08:00
Ruoyu Zhong
38b671d8bb
Merge pull request #16750 from iMichka/autobump
bump-formula|cask-pr: do not allow to bump autobumped packages
2024-03-02 00:33:06 +08:00
Mike McQuaid
387332ab68
Merge pull request #16782 from reitermarkus/tap-sig-5
Rename `Tap#reverse_cask_renames` to `Tap#cask_reverse_renames`.
2024-03-01 15:41:39 +00:00
Mike McQuaid
6c6c418dff
Merge pull request #16785 from reitermarkus/tap-sig-remote
Actually return `super` in `CoreTap#remote`.
2024-03-01 13:46:39 +00:00
Mike McQuaid
56b3982e7a
Merge pull request #16784 from reitermarkus/tap-sig-7
Add signature for `Tap#config`.
2024-03-01 13:46:20 +00:00
Markus Reiter
567ea44c99
Actually return super in CoreTap#remote. 2024-03-01 13:22:03 +01:00