442 Commits

Author SHA1 Message Date
Sam Ford
23274ac454
tests: add missing :needs_network argument
I was recently running `brew tests` without `--online` and I noticed
that there was still one formulae.brew.sh request. I narrowed it down
to a `brew desc` test, so this adds `:needs_network` to that test.
As expected, `brew tests` doesn't make any network requests after this
change unless `--online` is used.
2025-02-04 16:05:35 -05:00
Douglas Eichelberger
f5d2d30f5b Add test for concurrent fetching 2025-02-04 13:02:50 -08: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
89e640c567 Remove OpenStruct from Uses cmd 2024-11-22 21:04:51 -08:00
Mike McQuaid
94416e82f0
Add new odeprecated, odisabled, remove disabled code.
Prepare the usual deprecation cycle for Homebrew 4.4.0.
2024-09-24 10:15:34 +01:00
Bo Anderson
d9a339b231
list.sh: improve arg parsing, support brew ls 2024-09-03 15:13:15 +01:00
Bo Anderson
38987be01f
cmd/--repository: fix homebrew- prefix handling 2024-07-25 01:42:53 +01:00
Ruoyu Zhong
96cf5513c8
Port brew --repository to Bash
This provides a significant speedup:

    $ hyperfine 'git checkout master; brew --repo homebrew/core' 'git checkout brew-repository-speedup; brew --repo homebrew/core'
    Benchmark 1: git checkout master; brew --repo homebrew/core
      Time (mean ± σ):      1.737 s ±  0.388 s    [User: 0.743 s, System: 0.323 s]
      Range (min … max):    1.336 s …  2.438 s    10 runs

    Benchmark 2: git checkout brew-repository-speedup; brew --repo homebrew/core
      Time (mean ± σ):     459.1 ms ±  91.9 ms    [User: 100.5 ms, System: 142.1 ms]
      Range (min … max):   366.5 ms … 594.0 ms    10 runs

    Summary
      git checkout brew-repository-speedup; brew --repo homebrew/core ran
        3.78 ± 1.13 times faster than git checkout master; brew --repo homebrew/core
2024-07-14 12:07:11 -04:00
Rylan Polster
46cb7f2847
Update tests 2024-07-04 01:47:14 -04:00
Ryan Rotter
4f6771ccab test brew desc -s works w/ API w/o --eval-all 2024-06-30 23:05:29 -04:00
Mike McQuaid
a883f14b72
autoremove: don't remove formulae that were built from source
When a formula was built from source, it should not be removed by
`brew autoremove` as it will take a while to be installed again.

Fixes https://github.com/Homebrew/brew/issues/17433
2024-06-14 17:26:28 +01:00
Ruoyu Zhong
9cd5078efb
cmd/tab: new command
Add `brew tab`, a new command to edit tab information, as previously
discussed in https://github.com/Homebrew/brew/pull/17125#issuecomment-2068473483.
Currently, this supports marking or unmarking formulae as installed on
request.

Sample usage:

    $ brew tab --installed-on-request curl
    ==> curl is now marked as installed on request.
    $ brew autoremove --dry-run
    [no output]
    $ brew tab --no-installed-on-request curl
    ==> curl is now marked as not installed on request.
    $ brew autoremove --dry-run
    ==> Would autoremove 2 unneeded formulae:
    curl
    rtmpdump

Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2024-06-13 11:44:14 +08:00
Mike McQuaid
6e9288470e
brew style --fix 2024-05-23 17:15:43 +01:00
Mike McQuaid
222fe8ef0b
Homebrew 4.3.0 deprecation/disable/removals.
The usual pass of deprecating/disabling/removing code for the next
minor Homebrew release.
2024-05-07 12:18:04 +01:00
apainintheneck
56ecd42ebd dev-cmd/tests: skip tests that require core if it's not tapped
There were a few tests which require core to be tapped and fail
if it isn't. This is annoying if someone is trying to contribute
to the project and they're using the JSON API instead of having
the core repo tapped locally.

I'm just skipping these because it's the simplest thing to do.
The tests that failed are mostly rubocop tests so it's fine
if they only run on CI.
2024-05-03 00:32:50 -07:00
Mike McQuaid
4ffcd8a110
Various improvements for brew command
- Add a (large) speedup by moving some logic to Bash for the typical
  case of a normal or dev-cmd, Bash or Ruby command.
- Make `brew command` a non-developer command, I don't think it makes
  sense to consider it something needed for developing Homebrew.
- Update the manpage/tests/RBI accordingly.

Co-authored-by: Carlo Cabrera <30379873+carlocab@users.noreply.github.com>
2024-04-30 11:38:19 +01:00
Issy Long
69c31d275f
Only brew desc --search needs --eval-all
- It was suggested in https://github.com/Homebrew/brew/issues/ 16733 that
  `brew desc <formula_or_cask>` should work like `brew info <formula_or_cask>`
  and print the description of the package without needing `--eval-all`.
- Looking at the code, it seems like it's only searching that needs
  `--eval-all`, so limit the check to that.

Before:

```shell
$ brew desc hello
Error: `brew desc` needs `--eval-all` passed or `HOMEBREW_EVAL_ALL` set!
```

After:

```shell
$ brew desc hello
hello: Program providing model for GNU coding standards and practices

$ brew desc --search hello
Error: Invalid usage: `brew desc --search` needs `--eval-all` passed or `HOMEBREW_EVAL_ALL` set!

$ brew desc --search --eval-all hello
==> Formulae
dsh: Dancer's shell, or distributed shell
hello: Program providing model for GNU coding standards and practices
```
2024-04-17 23:54:45 +01:00
Kevin
044e48b816
Merge pull request #17012 from Homebrew/move-untap-module-into-cmd
cmd/untap: move module methods back into the cmd
2024-04-03 22:16:13 -07:00
apainintheneck
2d47193d22 cmd/untap: move module methods back into the cmd
The extra module was their to facilitate testing but now that
everything is properly namespaced and each command is an instance
we can just move the methods into the command. Since it's an
instance now we don't need to be as careful about caching either.
2024-04-03 22:06:19 -07:00
Douglas Eichelberger
f664433b5c Enable RSpec/DescribeClass 2024-04-03 09:12:47 -07:00
Douglas Eichelberger
8ebcadd1c9 Clean up args_parse tests 2024-04-02 12:19:14 -07:00
Douglas Eichelberger
3f856f6516 Port Homebrew::Cmd::Repository 2024-04-01 16:02:41 -07:00
Douglas Eichelberger
6a1d43337c Port Homebrew::Cmd::Prefix 2024-04-01 16:00:47 -07:00
Douglas Eichelberger
b56e0b733d Port Homebrew::Cmd::Env 2024-04-01 15:58:07 -07:00
Douglas Eichelberger
754151fcb8 Port Homebrew::Cmd::Cellar 2024-04-01 15:56:06 -07:00
Douglas Eichelberger
102051c35d Port Homebrew::Cmd::Caskroom 2024-04-01 15:54:03 -07:00
Douglas Eichelberger
7bbf0a3206 Port Homebrew::Cmd::Cache 2024-04-01 15:53:56 -07:00
Douglas Eichelberger
fdc95d02c8 Port Homebrew::Cmd::Uses 2024-04-01 12:01:37 -07:00
Douglas Eichelberger
1362890f2a Port Homebrew::Cmd::Upgrade 2024-04-01 11:58:35 -07:00
Douglas Eichelberger
d5add6565c Port Homebrew::Cmd::UpdateReport 2024-04-01 11:58:20 -07:00
Douglas Eichelberger
48f4adad33 Port Homebrew::Cmd::Untap 2024-04-01 11:50:25 -07:00
Douglas Eichelberger
f8caae06f7 Port Homebrew::Cmd::Unpin 2024-04-01 11:48:40 -07:00
Douglas Eichelberger
5ccb0b0567 Port Homebrew::Cmd::Unlink 2024-04-01 11:47:18 -07:00
Douglas Eichelberger
4cf9ef831a Port Homebrew::Cmd::Uninstall 2024-04-01 11:46:01 -07:00
Douglas Eichelberger
841cfd9fdc Port Homebrew::Cmd::Tap 2024-04-01 11:43:52 -07:00
Douglas Eichelberger
be42d46d49 Port Homebrew::Cmd::TapInfo 2024-04-01 10:15:28 -07:00
Douglas Eichelberger
5495ff1eea Port Homebrew::Cmd::Search 2024-04-01 10:12:52 -07:00
Douglas Eichelberger
d875c970e9 Port Homebrew::Cmd::Reinstall 2024-04-01 10:09:48 -07:00
Douglas Eichelberger
057f561d2c Port Homebrew::Cmd::Readall 2024-04-01 10:05:02 -07:00
Douglas Eichelberger
5ef070380c Port Homebrew::Cmd::RbenvSync 2024-04-01 10:04:06 -07:00
Douglas Eichelberger
6c260db277 Port Homebrew::Cmd::PyenvSync 2024-04-01 10:01:54 -07:00
Douglas Eichelberger
427b527335 Port Homebrew::Cmd::Postinstall 2024-04-01 09:59:47 -07:00
Douglas Eichelberger
31aa89aa7c Port Homebrew::Cmd::PostgresqlUpgradeDatabase 2024-04-01 09:48:23 -07:00
Douglas Eichelberger
c1b1c11a8c Port Homebrew::Cmd::Pin 2024-04-01 09:44:14 -07:00
Douglas Eichelberger
7725fc62d4 Port Homebrew::Cmd::Outdated 2024-04-01 09:42:31 -07:00
Douglas Eichelberger
57442ab67e Port Homebrew::Cmd::Options 2024-04-01 09:15:58 -07:00
Douglas Eichelberger
c5dfac1f2c Port Homebrew::Cmd::NodenvSync 2024-04-01 09:15:58 -07:00
Douglas Eichelberger
a43224cb4a Port Homebrew::Cmd::Missing 2024-04-01 09:15:58 -07:00
Douglas Eichelberger
0cb608a80c Port Homebrew::Cmd::Migrate 2024-04-01 09:15:58 -07:00
Douglas Eichelberger
59adde2069 Port Homebrew::Cmd::Log 2024-04-01 09:15:58 -07:00