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>
- use e.g. `$HOMEBREW_*` for cases where only the environment variable
is the entire backtick-quoted string
- use e.g. `${HOMEBREW_*}` for cases where the environment variable is
part of a backtick-quoted string to make clear what parts are variable
and what parts are not
- use `export HOMEBREW_*=...` for cases where we're talking about
setting the environment variable (because it likely needs to be
exported to work how they want)
Inspired by https://github.com/Homebrew/homebrew-bundle/pull/1579 making
similar changes for Homebrew/homebrew-bundle.
We already have `--skip-post-install` and this adds similar behaviour
for e.g. `brew bundle` (and other users) to be able to install a
formula but skip the `brew link` stage afterwards.
This adds a new method to either move the `gh` formula to the front
of the formula list to be installed or checks that the `gh` formula
is already installed some other way.