Commit Graph
93 Commits
Author SHA1 Message Date
Mike McQuaid 204ea7e964 Make tests use public APIs and enable their cops
- Make every statically-poked method public and call it directly,
  keeping `public_send` only for dynamically-named public methods.
- Read and write state through public `attr_*` accessors instead of
  instance variable reflection.
- Enable `Homebrew/NoSendInTests` and
  `Homebrew/NoInstanceVariableAccessInTests` now the test suite is
  clean, so neither pattern creeps back in.
- Keep rare justified disables, e.g. `Module#remove_const` is
  private core Ruby and raw memoisation state has no accessor.
2026-07-27 08:11:46 +01:00
Douglas Eichelberger e7277d9fa1 utils: add parallel_map for concurrent subprocess and network waits 2026-07-09 18:09:49 -07:00
Douglas Eichelberger 6f92c66c7e tap-info: generate tap JSON hashes concurrently 2026-07-06 09:43:14 -07:00
Harald Nordgren ec61b24045 Revert "Merge pull request #22767 from HaraldNordgren/simplify-pretty-install-status-outdated" 2026-06-18 10:28:11 +02:00
Harald Nordgren 05167c9078 Drop redundant installed guard from pretty_install_status callers
`pretty_install_status` already gates the upgradable status on
`installed && outdated`, so callers passing
`outdated: installed && formula.outdated?` duplicated the guard.
Pass `outdated: formula.outdated?` directly and let the method
combine it with `installed`.
2026-06-17 09:59:35 +02:00
Mike McQuaid 1717af5d68 Retarget redirected tap trust
- Follow GitHub redirects while preventing old tap names from staying trusted
- Update redirected tap remotes so future operations use the new canonical URL
- Remove old `trustedtaps` and per-item trust entries after a tap redirect
- Show tap trust status in `tap-info` when tap trust is required
- Query redirected tap metadata only after tap API redirects
- Keep forced redirect checks limited to taps
- Preserve update-report revisions when a tap redirect renames a tap
- Keep no-op tap updates from querying redirected metadata
- Treat redirected tap SHA API checks as updates
- Print redirected and untrusted tap messages with explicit tap wording
2026-06-12 17:00:12 +01:00
Harald Nordgren 461e6cd169 info, tap-info: skip uninstalled marker when not a problem
The red ✘ uninstalled marker reads as an error, but in some places
uninstalled is the norm rather than a problem:

- tap-info: every uninstalled formula/cask in the tap catalog
- brew info <pkg>: deps and requirements when the package itself is
  not installed (the listing just shows what would be pulled in)

Add a 'mark_uninstalled:' parameter to 'pretty_install_status' that,
when false, returns the plain string instead of the red ✘. Pass it
through 'decorate_dependencies'/'decorate_requirements' in both
'cmd/info' and 'cask/info', and use it unconditionally in 'tap-info'.

Keep the marker where missing really signals a problem: info headers,
deps/requirements of an installed package, and update reports for
removed entries.
2026-05-19 00:26:54 +02:00
Harald Nordgren 3df4930233 info: mark deprecated/disabled formulae and casks in install status
Match the '(deprecated)'/'(disabled)' suffix already shown by
'brew search'. Apply it via 'pretty_install_status' so it shows in the
'brew info' title and 'brew tap-info' formula/cask listings, and
refactor 'brew search' to use the same helper.
2026-05-18 17:08:36 +02:00
Harald Nordgren 29876b85b4 help: show originating tap for external commands 2026-05-17 14:54:59 +02:00
Harald Nordgren edf0d75713 tap-info: list formulae and casks with install status 2026-05-09 22:08:08 +02:00
Bo Anderson 1cb4a4e369 cmd/tap-info: revert exit code changes to --json 2026-01-07 06:03:24 +00:00
Ben Kubota fc5dc2e817 properly iterate over the taps 2025-12-24 10:16:34 +04:00
f029f60120 Update Library/Homebrew/cmd/tap-info.rb
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2025-12-24 07:13:23 +01:00
Ben Kubota ee825cb11e Add test to ensure the json output also sets the failed flag 2025-12-23 13:11:01 +04:00
Ben Kubota 77945b394a Add top-level comment as requested by linter 2025-12-23 12:58:52 +04:00
Ben Kubota f0a3b2101e Exit with failure on tap-info for unknown tap 2025-12-23 12:49:03 +04:00
Mike McQuaid 07091cfbea Simplify pluralisation of common words
Formulae, dependencies, tries are all used in multiple places so let's
simplify them
2025-09-12 09:02:43 +01:00
Mike McQuaid af997ea2ad Hide main branches from brew tap-info and brew info
These are basically as "default" as `master` now so we can hide them.
2025-06-13 12:09:02 +01:00
D. Ben Knoble 3429e74d7e feat(tap-info): display Git information about non-Core/non-API taps
Copy and tweak code from Library/Homebrew/system_config.rb:110 to commit
and date information. This information can be useful when debugging
formulae in custom taps to ensure the tap has been correctly updated
recently or to suss out important differences from one version of a tap
to another.

This removes the need to ask users to run something like

    git -C $(brew --repository)/Library/Taps/<tap> show -s --decorate

Close https://github.com/Homebrew/brew/issues/18381
2024-09-30 11:27:35 -04:00
Mike McQuaidandGitHub fd14deaebd Merge pull request #18011 from Homebrew/more-srb-strict-cmd 2024-08-12 14:21:18 +01:00
Issy Long 10dc874b1e cmd/tap-info: Bump to Sorbet typed: strict 2024-08-10 23:55:14 +01:00
apainintheneck a3e917afe1 Refactor method to remove extra tap requires
We were selectively requiring the tap.rb file in a few places for
performance reasons. The main method we were referencing was the
`Tap.cmd_directories` method which uses `Pathname` and the `TAP_DIRECTORY`
constant internally. `Tap.cmd_directories` is mostly used in the `Commands`
module and that is loaded very early on in the program so it made sense
to move that command to that module. To facilitate that I moved the
`TAP_DIRECTORY` constant to the top-level and renamed it to
`HOMEBREW_TAP_DIRECTORY`. It now lies in the tap_constants.rb file.

A nice bonus of this refactor is that it speeds up loading external
commands since the tap.rb file is no longer required by default in
those cases.
2024-08-10 13:49:10 -07:00
Mike McQuaid c5dbd3ca24 Rearrange requires
This improves the load time of most brew commands. For an example of
one of the simplest commands this speeds up:

Without Bootsnap:
```
$ hyperfine 'git checkout master; brew help' 'git checkout optimise_requires; brew help'
Benchmark 1: git checkout master; brew help
  Time (mean ± σ):     525.0 ms ±  35.8 ms    [User: 229.9 ms, System: 113.1 ms]
  Range (min … max):   465.3 ms … 576.6 ms    10 runs

Benchmark 2: git checkout optimise_requires; brew help
  Time (mean ± σ):     383.3 ms ±  25.1 ms    [User: 133.0 ms, System: 72.1 ms]
  Range (min … max):   353.0 ms … 443.6 ms    10 runs

Summary
  git checkout optimise_requires; brew help ran
    1.37 ± 0.13 times faster than git checkout master; brew help
```

With Bootsnap:
```
$ hyperfine 'git checkout master; brew help' 'git checkout optimise_requires; brew help'
Benchmark 1: git checkout master; brew help
  Time (mean ± σ):     386.0 ms ±  30.9 ms    [User: 130.2 ms, System: 93.8 ms]
  Range (min … max):   359.5 ms … 469.3 ms    10 runs

Benchmark 2: git checkout optimise_requires; brew help
  Time (mean ± σ):     330.2 ms ±  32.4 ms    [User: 93.4 ms, System: 73.0 ms]
  Range (min … max):   302.9 ms … 413.9 ms    10 runs

Summary
  git checkout optimise_requires; brew help ran
    1.17 ± 0.15 times faster than git checkout master; brew help
```
2024-07-14 08:49:39 -04:00
Will Faught 29c561eb59 Use newlines in package info 2024-04-12 09:52:37 -07:00
661f78e9c1 Update Library/Homebrew/cmd/tap-info.rb
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2024-04-12 09:49:33 -07:00
Will Faught 4e7d128604 cmd, cask: info prints whether installed 2024-04-10 19:02:09 -07:00
Douglas Eichelberger be42d46d49 Port Homebrew::Cmd::TapInfo 2024-04-01 10:15:28 -07:00
Ryan Rotter d856d88c17 tap-info cmd: skip untapped core taps
When homebrew/core or homebrew/cask are untapped `brew tap-info` fails because
Tap.each includes them and tap.private? fails without a git repo interrogate.

This restores the behavior of `brew tap-info` before #16710
2024-03-30 01:41:31 -04:00
Eric Knibbe 4662678b3b cmd+dev-cmd: adjust description line breaks
Use to distinguish additional notes from initial explanation and usage info
2023-09-11 02:29:21 -04:00
Douglas Eichelberger 24cf6076e8 brew style --fix 2023-04-24 20:42:39 -07:00
Dustin Rodrigues b776fb32de change includecount to include_count for readability 2023-03-20 07:23:17 -04:00
Dustin Rodrigues e5fba88035 use includecount argument in pluralize 2023-03-19 23:35:47 -04:00
Douglas Eichelberger d56e2884aa Enable typing in cmd/ 2023-03-06 15:01:08 -08:00
Douglas Eichelberger 0eccc0e987 git grep -l Utils::Inflection | xargs gsed -i 's|Utils::Inflection|Utils|g' 2023-02-27 20:18:27 -08:00
Douglas Eichelberger eb2b990575 Port more call sites 2023-02-27 20:17:33 -08:00
Mike McQuaid f280ce069b Support loading formulae/casks from subdirectories
Previously, we required all formulae and casks to be in a specific
formula or cask directory but did not check any subdirectories.

This commit allows using subdirectories for official taps, the only
ones likely to be big enough to warrant sharding in this way and to
avoid potentially breaking backwards compatibility for existing taps.

This was inspired by the most recent issues with homebrew-cask.
2023-02-24 10:57:41 +00:00
Mike McQuaid 2d5eab2e1c brew style --fix 2022-06-30 08:56:21 +01: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
Rylan Polster d1f3e39b7b Update commands to generate usage banner 2021-01-18 21:20:11 -05:00
Dawid Dziurla 332372469f cmd: indicate multiple named args in usage banner 2021-01-15 13:04:00 +01:00
Rylan Polster da811373d3 Add named_args DSL for commands 2021-01-13 17:09:42 -05:00
Mike McQuaid 9216d8abe6 rubocop-rails: make fixes. 2020-12-02 10:43:04 +00:00
Markus Reiter da9289eff0 Add more type signatures. 2020-11-13 12:26:36 +01:00
Markus Reiter 24ae318a3d Move type annotations into files. 2020-10-10 14:59:39 +02:00
Mike McQuaid 99bff13cbb cmd/tap-info: improve comma usage.
Broken in https://github.com/Homebrew/brew/pull/8230.
2020-08-06 14:00:56 +01:00
Mike McQuaid fb0a6338b1 Remove more tap pinning code.
This was deprecated and removed a while ago.
2020-08-06 12:24:10 +01:00
Markus Reiter d4c2ffd705 Refactor CLI::Parser. 2020-07-31 15:07:17 +02:00
Mike McQuaid 1e265247ca rubocop: apply autofixes. 2020-03-13 21:16:18 +00:00
Mike McQuaid a7fe0ed847 cmd: use more and cleanup new args APIs. 2020-03-05 09:40:15 +00:00
Gautham Goli 685a6b4da6 ARGV: Replace usages of ARGV.named with Homebrew.args.named 2019-12-18 20:38:21 +05:30