This reduces the surface area of our `Kernel` monkeypatch and removes
the need to `include Kernel` in a bunch of modules.
While we're here, also move `Kernel#require?` to `Homebrew` and fully
scope the calls to it.
Fixes#20374
When using HOMEBREW_DOWNLOAD_CONCURRENCY, cask binaries were being
downloaded before checking if the cask could actually be installed
(e.g., disabled casks or conflict checks). This resulted in unnecessary
downloads for casks that would ultimately fail to install.
This change adds a `prelude` method to Cask::Installer that performs
early validation checks (deprecation/disable status and conflicts)
similar to Formula#prelude_fetch. The prelude method is called before
enqueueing downloads in all download queue scenarios (install, reinstall,
and upgrade commands), ensuring that validation failures occur before
the "Fetching downloads for:" message is displayed.
Key changes:
- Add Cask::Installer#prelude method with @ran_prelude tracking
- Call prelude before enqueueing downloads in install/reinstall/upgrade
- Refactor to avoid creating installer objects multiple times
- Maintain backward compatibility for non-download-queue scenarios
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Change styling based on output of brew typecheck and brew style
Changes as per PR comments
Remove --leaves flag functionality
Simplify formulae and cask parsing as well as style changes as per PR comments
Update cask and formulae parsing as per PR comment suggestion
Add column formatting function as well as PR comment suggestions
Add Sorbet struct for printing and minor logic changes as per PR comments
Minor changes as per PR comments and fix formatting issue in output
- When the user tried `brew search foo` with `--eval-all` or its
envvar, it would fail with
`Error: Invalid usage: `--eval-all` cannot be passed without `--desc`.`
- This was the wrong way around: `--desc` depends on `--eval-all`.
Follow up on `DownloadQueue` for download concurrency on `brew fetch`
and `brew install` to also add support for `brew reinstall` and
`brew upgrade`.
This required a fair bit of refactoring to make this work so I've also
made `install.rb`, `reinstall.rb` and `upgrade.rb` `typed: strict` to
add some extra guardrails from Sorbet here.
Co-authored-by: Carlo Cabrera <github@carlo.cab>
- ensure that the `brew.rb` downloads of the API files only happens
when they are more stale (>1 day) and using the API is not disabled
- default `brew fetch` and `brew install` to a single download retry
Co-authored-by: Carlo Cabrera <github@carlo.cab>
- Use undocumented (for now) `HOMEBREW_DOWNLOAD_CONCURRENCY` instead
of `--concurrency` flag and avoid passing around `concurrency`
- Create and use `Formula#enqueue_resources_and_patches` helper method
- Rename some method calls to be more obvious
- Use `Downloadable` type to simplify type checks
- General refactoring
This is the first step towards using the download queue for all
download operations e.g. `brew install`, `brew upgrade`,
`brew reinstall` etc.
While we're here, do some API cleanup and Sorbet type improvements.
- Homebrew Bundle referred to formulae as "brews". But it referred to
casks as "casks" and taps as "taps".
- Let's use the same terminology everywhere.
- (I know that `brew "hello"` is the formula syntax in the Brewfile, so
I'm not changing that (though would be up for it, in a backwards
compatible manner), just making the code more consistent.)