166 Commits

Author SHA1 Message Date
Thibaut Hérault
548d87c9e8
Update Library/Homebrew/cmd/reinstall.rb comment
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2025-03-07 11:26:52 -05:00
thibhero
99fad7797c modifying files with brew style 2025-03-06 21:27:13 -05:00
thibhero
0b53e54bfa Moving ask input to Install.ask 2025-03-05 17:38:18 -05:00
thibhero
1a43a9d258 extracting method to Homebrew/install.rb 2025-02-18 22:41:40 -05:00
thibhero
bb7dcc9384 updating comments 2025-02-16 00:06:57 -05:00
thibhero
5c2bbe5911 pass brew typecheck, brew style and brew tests 2025-02-15 23:20:07 -05:00
thibhero
624e960cd5 refactoring lambda as upgrade.RB 2025-02-15 23:02:14 -05:00
thibhero
1ba3f32026 Adding upgrade arguments in lambda 2025-02-11 20:15:19 -05:00
thibhero
9891653aa8 corrected code with brew typecheck 2025-02-11 18:53:10 -05:00
thibhero
a111139682 moving to lambda expressions to respect brew style 2025-02-11 11:06:16 -05:00
thibhero
478035ed90 Copying function from upgrade.rb and implementing with check_dep: false 2025-02-10 23:18:47 -05:00
Mike McQuaid
bbf5a9f479
env_config: use environment variables consistently
- 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.
2025-01-27 14:21:27 +00:00
Douglas Eichelberger
e1fdd2eda4 Enable strict typing in NamedArgs 2024-12-03 17:43:22 -08:00
Mike McQuaid
4d4531c19d
Revamp installed_on_request handling
- `reinstall` and `upgrade` no longer mark as installed on request,
  with or without names specified, but preserve the version from the
  tab instead
- default `install_on_request` to `false` rather than `true`
- only set installed in request in a tab if it's missing rather than
  false

Co-authored-by: Michael Cho <michael@michaelcho.dev>
2024-11-19 08:39:55 +00:00
Bo Anderson
97866f8adf
Perform preinstall checks when a formula is installed via a cask 2024-10-11 16:57:47 +01:00
Bo Anderson
77204e01da
reinstall: move to submodule 2024-08-20 03:58:01 +01:00
apainintheneck
52cf4e30fc Share attestation formula sorting and gh exe checking logic
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.
2024-07-18 21:32:50 -07:00
apainintheneck
75cfa21068 Avoid frozen array errors in brew upgrade
The `Homebrew::CLI::NamedArgs` class often returns frozen arrays so this one cannot
be easily modified in-place here. We just overwrite it instead.

I also updated the `brew reinstall` command logic to match for consistency.

```console
$ brew upgrade gh --verbose --debug
...
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FromAPILoader): loading gh
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FromAPILoader): loading gh
Error: can't modify frozen Array: [#<Formula gh (stable) /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/g/gh.rb>]
/usr/local/Homebrew/Library/Homebrew/cmd/upgrade.rb:139:in `delete'
/usr/local/Homebrew/Library/Homebrew/cmd/upgrade.rb:139:in `run'
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11481/lib/types/private/methods/call_validation.rb:270:in `bind_call'
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11481/lib/types/private/methods/call_validation.rb:270:in `validate_call'
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11481/lib/types/private/methods/_methods.rb:277:in `block in _on_method_added'
/usr/local/Homebrew/Library/Homebrew/brew.rb:95:in `<main>'
```
2024-07-17 23:54:50 -07:00
Nanda H Krishna
8839ccfe72
Fix tests for attestations 2024-07-17 14:48:53 -04:00
Nanda H Krishna
d2d814414e
cmd/{install,reinstall,upgrade}: ensure that gh is installed 2024-07-17 14:48:52 -04:00
Todd Schulman
18e2a37d14 cmd: allow --display-times with --cask 2024-04-09 01:50:29 -04:00
Douglas Eichelberger
d875c970e9 Port Homebrew::Cmd::Reinstall 2024-04-01 10:09:48 -07:00
Eric Knibbe
e63b1f4da5
docs: monospace suggested values 2024-02-04 15:42:26 +01:00
Eric Knibbe
931f762598
docs+rubydoc: various grammar/wording fixes 2023-09-11 02:26:37 -04:00
Douglas Eichelberger
24cf6076e8 brew style --fix 2023-04-24 20:42:39 -07:00
hyuraku
a41a7c94d8 remove cask/cmd 2023-04-19 21:30:42 +09:00
Douglas Eichelberger
09c679e75f Refactor module_function to reduce rbi need 2023-04-17 10:37:59 -07:00
hyuraku
ec0d492c09 move cask/cmd/reinstall to cask/reinstall 2023-04-10 22:07:06 +09:00
Mike McQuaid
253dca568c
Revert "move cask/cmd/reinstall" 2023-03-23 17:06:42 +00:00
hyuraku
31e49d96af move cask/cmd/reinstall to cask/reinstall 2023-03-23 22:50:03 +09:00
Douglas Eichelberger
d56e2884aa Enable typing in cmd/ 2023-03-06 15:01:08 -08:00
Mike McQuaid
fbdec8738d
Warn more when building from source
We warn sometimes when we tell people to build from source and it's
not supported but we don't actually warn non-developers when invoking
the various install commands so: let's start doing so.

While we're here, also update the existing messaging to reflect the fact
we're on Mastodon now too and we don't want maintainers being
individually bothered about errors either.

I've tried to balance having messages here vs. having them be so long
at the beginning of installation that they will be missed or be overly
obnoxious.
2023-02-17 16:10:38 +00:00
EricFromCanada
dfc9906184
internal messaging fixes 2023-02-10 23:17:16 -05:00
Mike McQuaid
46d727b475
HOMEBREW_INSTALL_FROM_API: various improvements.
- flip the messaging to refer to `HOMEBREW_NO_INSTALL_FROM_API` where relevant
- remove some duplicate checks
- better scope checks to just core tap formulae
2023-01-25 14:29:35 +00:00
Bo Anderson
9b99594753
Preliminary compatibility fixes for Ruby 3 2022-10-11 02:53:27 +01:00
Mike McQuaid
04ff6a18f4
Tweak --debug-symbols description. 2022-08-12 09:34:51 +01:00
Lukas Oberhuber
3d60d610dd Merge branch 'master' into debug-symbols 2022-08-10 18:44:09 -10:00
fn ⌃ ⌥
71ab2f6e7a Run periodic cleanup after installing all packages 2022-08-04 07:46:31 -07:00
Lukas Oberhuber
215e545660 brew style 2022-07-26 19:28:30 +01:00
Lukas Oberhuber
d195f22522 Connecting up --debug-symbols flag
This connects the calling of dsymutil and the retention of temporary
files. Still need to connect compilation to flag.
2022-07-26 12:15:53 +01:00
Rylan Polster
b896f6cb0d
Allow more developer commands with HOMEBREW_INSTALL_FROM_API 2022-06-16 21:31:15 -04:00
Rylan Polster
e53ccbc3cd
Remove unnecessary code 2022-06-14 16:06:05 -04:00
Issy Long
0b6b2f04da
cask/reinstall: Support --zap for entirely purging cask files
- The `brew uninstall` command has `--zap`, so let's make `brew
  reinstall` have parity here for a better user experience. (Requested
  in issue 12983.)
- It feels weird that to get my new reinstall test to pass I had to add
  `--zap` to `cask/cmd/install.rb`, not `cask/cmd/reinstall.rb` to get
  the tests to pass. But the `brew reinstall --cask caffeine --zap`
  command worked fine all the time. The CLI argument parser from the
  test run was complaining about not knowing what `zap` was. As a
  result, `--zap` now shows up as a switch in `brew install --help`
  which I'm not 100% convinced is the desired UX. But I've edited the
  description accordingly to specify that it will only work on
  `reinstall` operations (and `--zap` on `install` is a no-op).

```
issyl0 at pictor in /opt/homebrew on reinstall-cask-zap
❯ brew reinstall --cask caffeine --zap
==> Downloading https://github.com/IntelliScape/caffeine/releases/download/1.1.3/Caffeine.dmg
Already downloaded: /Users/issyl0/Library/Caches/Homebrew/downloads/3d6ccfdd3b8d0ab37d1c2468d6e69078c2d31d3b12bf51947c4db21e5f376af2--Caffeine.dmg
==> Implied `brew uninstall --cask caffeine`
==> Backing App 'Caffeine.app' up to '/opt/homebrew/Caskroom/caffeine/1.1.3/Caffeine.app'
==> Removing App '/Applications/Caffeine.app'
==> Dispatching zap stanza
==> Trashing files:
~/Library/Application Support/com.intelliscapesolutions.caffeine
~/Library/Preferences/com.intelliscapesolutions.caffeine.plist
~/Library/Caches/com.intelliscapesolutions.caffeine
~/Library/HTTPStoages/com.intelliscapesolutions.caffeine.binarycookies
==> Removing all staged versions of Cask 'caffeine'
==> Installing Cask caffeine
==> Moving App 'Caffeine.app' to '/Applications/Caffeine.app'
🍺  caffeine was successfully installed!
```
2022-04-09 16:37:23 +01:00
Mike McQuaid
11c5f8f05a
Improve discovery of some environment variables
There's a few bits of functionality that Homebrew has changed over the
years, makes sense as a sensible default but some people find really
annoying:

- automatically running `brew update`
- automatically running `brew cleanup`
- automatically upgrading outdated dependents
- automatically reinstalling broken dependents

For each of these: let's improve the documentation of the commands
whose behaviour is changed and the environment variables themselves.
2021-11-25 09:10:59 +00:00
Rylan Polster
0b8032d421
Document HOMEBREW_INSTALL_FROM_API 2021-10-22 12:37:57 -04:00
Rylan Polster
5d536d66fc
Rename HOMEBREW_JSON_CORE to HOMEBREW_INSTALL_FROM_API 2021-08-27 00:24:15 -04:00
Rylan Polster
99635bf3ae
Remove need for homebrew/cask to be tapped 2021-08-14 16:17:26 -04:00
Rylan Polster
737dd1654b
Refactor API methods 2021-08-06 04:31:27 -04:00
Rylan Polster
1e34b69cd4
Prioritize installing from JSON if env var is set 2021-07-12 03:23:42 -04:00
Rylan Polster
e316c4f013
Rename Utils::BottleAPI to BottleAPI 2021-07-05 11:45:15 -04:00