83 Commits

Author SHA1 Message Date
Douglas Eichelberger
bbca610601
Use type-safe blocks 2025-09-07 12:13:36 -07:00
Mike McQuaid
b32296a7e0
bundle/tap_installer: add force flag for official taps for developers.
This avoids a `homebrew/core` in a `Brewfile` failing for Homebrew
developers who probably want it.
2025-08-28 16:41:50 +01:00
Mike McQuaid
7878c73b85
Merge pull request #20537 from Homebrew/dependabot/all-de17bcb037
Bump the "all" group with 2 updates across multiple ecosystems
2025-08-22 12:47:27 +00:00
Mike McQuaid
3998a4fe85
Merge pull request #20530 from Homebrew/typed-strict
bundle: some more `typed: strict`
2025-08-22 10:29:25 +00:00
Mike McQuaid
02c2a348c4
brew style --fix 2025-08-22 10:41:43 +01:00
Mike McQuaid
3bbff84ff1
Merge pull request #20525 from Homebrew/utils_output
Move `o*` output methods to `Utils::Output`
2025-08-22 09:10:29 +00:00
Ruoyu Zhong
bcf3de5807
bundle/skipper: typed: strict 2025-08-21 22:41:17 +08:00
Ruoyu Zhong
13af517121
bundle/brewfile: typed: strict 2025-08-21 22:33:39 +08:00
Ruoyu Zhong
12366f9c5b
bundle/commands/install: typed: strict 2025-08-21 22:33:29 +08:00
Ruoyu Zhong
a03aaef339
bundle/dumper: typed: strict 2025-08-21 17:27:36 +08:00
Ruoyu Zhong
579c31f001
bundle/mac_app_store_dumper: typed: strict 2025-08-21 17:27:36 +08:00
Ruoyu Zhong
1a45660194
bundle/vscode_extension_dumper: typed: strict 2025-08-21 17:27:36 +08:00
Ruoyu Zhong
19d160bfc2
bundle/tap_dumper: typed: strict 2025-08-21 17:27:36 +08:00
Mike McQuaid
a1f112f3fe
Move o* output methods to Utils::Output
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.
2025-08-20 19:20:19 +01:00
Mike McQuaid
a71d5e835f
More Sorbet typed: strict files
Add the necessary changes for Sorbet `typed: strict` in more files.

Co-authored-by: Ruoyu Zhong <zhongruoyu@outlook.com>
2025-08-19 13:03:08 +01:00
Eric Knibbe
6255263b51
output: express environment variables consistently 2025-08-04 09:50:06 -04:00
Mike McQuaid
e3c3f5a356
Deprecate/disable/remove code for Homebrew 4.6
The next minor release will be Homebrew 4.6.0 so let's do the usual
deprecation/disable/remove code cycle.
2025-07-31 12:13:01 +01:00
Patrick Linnane
4513a43d53
Fix RuboCop failures.
Co-authored-by: Patrick Linnane <patrick@linnane.io>
Co-authored-by: Carlo Cabrera <github@carlo.cab>
Co-authored-by: Thierry Moisan <thierry.moisan@gmail.com>
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2025-07-14 19:12:38 +01:00
Mike McQuaid
e8bfa23877
Support Cask renames when installing/dumping
This adds support for Cask old tokens used for renames of Casks.

We'll now correctly check these at installation time to avoid repeatedly
installing renamed Casks and dump them in the Brewfile. We also use this
logic to avoid cleaning up renamed Casks.
2025-07-10 08:05:36 +00:00
Issy Long
990c1efc16
bundle: Rename "brews" to "formulae" for consistency
- 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.)
2025-07-04 21:08:37 +01:00
Issy Long
019a799fae
Merge pull request #20128 from Homebrew/some-bundle-files-werent-typed-at-all
Make the remaining `bundle` files `typed: true`
2025-06-29 23:10:59 +00:00
Douglas Eichelberger
004c0a2a6c
Refactor exec.rb type fixes 2025-06-29 09:02:24 -07:00
Issy Long
a2e39c4814
Make Bundle::BrewDumper more Homebrew-y
- https://github.com/Homebrew/brew/pull/20182#discussion_r2170422499
2025-06-27 18:15:37 +01:00
Issy Long
5fed8f4210
Make the remaining Bundle file Sorbet typed: true 2025-06-26 23:21:54 +01:00
Issy Long
0d40f48e8d
Reapply "Make some of the bundle commands Sorbet typed: true"
- This reverts commit 68dbf12220f9a52ddf5ca5eb3aa1b356aa42da3a that was
  a revert of commit 68596ec720a50f44ae9c30c5806aa7f2d4bcc96f because I
  put the RBI file in the wrong place and Tapioca got rid of it, causing
  this week's release to be blocked.
2025-06-26 23:15:23 +01:00
Mike McQuaid
68dbf12220
Revert "Make some of the bundle commands Sorbet typed: true" 2025-06-23 13:52:35 +01:00
Issy Long
68596ec720
Make some of the bundle commands Sorbet typed: true
- The last remaining one is `exec` but that's a bit more involved
  (https://github.com/Homebrew/brew/pull/20128#discussion_r2156781591).
2025-06-20 10:11:35 +02:00
Mike McQuaid
7345607ca0
a*.rb: move to strict Sorbet sigil.
Co-authored-by: Rylan Polster <rslpolster@gmail.com>
2025-06-17 08:18:33 +01:00
Peter Wu
770335f72e Remove unused --force-auto-update option
Remove the `brew tap --force-auto-update` option and the
`force_auto_update` configuration file option from Homebrew Bundles.

Fixes #19856
2025-06-12 14:16:12 +02:00
Mike McQuaid
dc71b7c8f6
Cleanup extend/ directory usage.
- move some things out of `extend` that don't really fit there e.g.
  `Module`s that are included but not doing any
  overriding/monkeypatching
- move some code into `extend/os` to fix all remaining
  `rubocop:todo Homebrew/MoveToExtendOS`s
- remove some unneeded `bundle` skipper code that doesn't really make
  sense given our current bottling strategy
- extract some `Pathname` extensions to `extend/pathname` for separate
  files
- move a `ENV` `Kernel` extension into `kernel.rb`
- `odeprecate` a seemingly unused backwards compatibility method
- move `readline_nonblock` from a monkeypatch to a
  `ReadlineNonblock.read` method as its only used in one place
- fix up a link in documentation
2025-06-09 19:06:16 +01:00
Mike McQuaid
5fe43ed3f2
brew (bundle|) sh: use user's configuration but override prompts.
This was more painful that I expected but will allow `brew bundle sh`
and `brew sh` to use the user's configuration but use our custom prompt
for Bash and ZSH.
2025-06-05 15:43:34 +01:00
Bo Anderson
418a771d12
bundle: add support for selective cleanup 2025-05-23 06:19:01 +01:00
Mike McQuaid
e8e8fcea02
bundle/commands/exec: fix exit code handling.
In some `brew tests` runs, `$CHILD_STATUS` can be `nil`.
Let's handle this and avoid these flaky tests.
2025-05-21 16:31:30 +01:00
Mike McQuaid
ef4bea60a4
bundle/adder: create Brewfile if it doesn't exist.
This provides a nicer interface into using `brew bundle add` as a first
command.
2025-05-09 12:58:06 +01:00
Bo Anderson
288984bb0f
bundle/dsl: combine cask_args calls 2025-05-09 08:06:06 +01:00
Issy Long
6c11916cbc
Bump some files to Sorbet typed: strict 2025-04-27 22:45:44 +01:00
Mike McQuaid
a1e4e9eaf7
bundle/commands/exec: make environment variables more consistent.
Let's avoid having `exec` and `env`/`sh` subcommands have different
environment variables logic. Instead, let's e.g. add `HOMEBREW_PATH`
and remove `*/Homebrew/shims/*` from the `PATH` for all three
subcommands.

This allows more consistency for users and easier to debug and reason
about behaviour.
2025-04-25 11:53:23 +01:00
Carlo Cabrera
f3c25498f8
bundle/commands/exec: check that Brewfile is installed with --check
`brew bundle exec` behaves correctly only after doing `brew bundle install`.

Running `brew bundle check` can be slow, so let's add a `--check` flag
to `brew bundle exec` which will also run `brew bundle check` before
`brew bundle exec` to ensure that the `Brewfile` has been installed
before proceeding.
2025-04-24 16:34:23 +08:00
Mike McQuaid
c9a7b62b1d
Homebrew 4.5 deprecations/disables/removals
The usual cycle of deprecating, disabling, and removing things in
Homebrew major/minor releases.
2025-04-22 17:15:23 +01:00
Mike McQuaid
dbbffbaca5
Improve HOMEBREW_TEMP handling
- if HOMEBREW_TEMP is not writable, use the default temp directory
- when running `brew bundle exec`, strip various temporary directories
  from the environment if they are not writable
2025-04-14 19:10:58 +01:00
Mike McQuaid
1a1aac9715
bundle/commands/exec: adjust environment variable handling (again)
We need to ensure that we keep around some `HOMEBREW_` variables so that
the e.g. `git` shim still works in `brew bundle exec`.
2025-04-10 16:16:53 +01:00
Mike McQuaid
359b68f827
Improve brew bundle exec/env/sh environment handling
- Rather than maintaining a list of Homebrew environment variables to
  delete, delete all Homebrew (and Portable Ruby) internal variables
  that won't be used by other tools.
- When exporting variables, only export variables that have changed.
- When exporting PATH-like variables, ensure the PATH is appending to
  the existing path rather than replacing it and ensure we only include
  newly added paths.
2025-04-10 15:23:02 +01:00
Mike McQuaid
a1343c94d0
bundle/commands/exec: add missing require.
This should fix the flaky test failures in `exec_spec.rb`.
2025-04-10 13:04:01 +01:00
Bo Anderson
80f5c42f02
bundle/commands/exec: handle no services to start 2025-04-07 14:12:41 +01:00
Bo Anderson
f2513965e8
Revert "Revert "bundle: handle simultaneous exec --services better""
This reverts commit 94db0b2f3408280e20ca3888ed5c91672ab4fca2.
2025-04-07 14:10:42 +01:00
Mike McQuaid
94db0b2f34
Revert "bundle: handle simultaneous exec --services better" 2025-04-04 15:30:47 +01:00
Bo Anderson
1ef00cb55f
bundle: handle simultaneous exec --services better 2025-04-04 08:10:11 +01:00
Mike McQuaid
3012f427df
bundle: fix up formula name for environment variable.
We previously were trying to pass through invalid environment variable
names so let's fix these up and query those instead.
2025-04-03 11:05:07 +01:00
Mike McQuaid
89d0309b9c
Add brew bundle --upgrade-formulae
This flag allows you to specify formulae to upgrade, even if
`$HOMEBREW_BUNDLE_NO_UPGRADE` is set.

This is useful for upgrading specific formulae without upgrading all
formulae.

While we're here, let's add Sorbet signatures to the `Bundle` module
because I needed to add a new method there anyway.
2025-04-02 17:15:36 +01:00
Bo Anderson
4254b75cb8
bundle: add tests for exec --services 2025-04-02 16:09:16 +01:00