273 Commits

Author SHA1 Message Date
Mike McQuaid
6f071a06f8
Use JSON.pretty_generate
It's dramatically more human readable for very little difference in
space.
2021-04-09 15:44:37 +01:00
Adrian Ho
548316ecc8 --prefix: shortlist only formulae 2021-03-11 17:32:35 +08:00
Mike McQuaid
e9419dbce7
test/cmd: test Bash logic. 2021-03-04 12:59:43 +00:00
Mike McQuaid
dc1fdc9f8d
Speedup brew --version.
Port `brew --version` to Bash to speed it up.

While we're here:
- remove (now) unused `Tap` Git methods
- use `--quiet` instead of `-q` to be more verbose

Benchmarks:
```
$ hyperfine --min-runs=3 --warmup=2 "git checkout origin/master; brew --version" "git checkout speedup_brew_version; brew --version"
Benchmark #1: git checkout origin/master; brew --version
  Time (mean ± σ):      2.083 s ±  0.004 s    [User: 396.8 ms, System: 597.2 ms]
  Range (min … max):    2.080 s …  2.088 s    3 runs

Benchmark #2: git checkout speedup_brew_version; brew --version
  Time (mean ± σ):     847.9 ms ±  35.2 ms    [User: 100.0 ms, System: 247.9 ms]
  Range (min … max):   824.1 ms … 888.3 ms    3 runs

Summary
  'git checkout speedup_brew_version; brew --version' ran
    2.46 ± 0.10 times faster than 'git checkout origin/master; brew --version'
```
2021-03-04 12:59:42 +00:00
Mike McQuaid
ca47b47f77
Speedup brew --prefix <formula>
This case is _really_ slow even although it's something we encourage
people to run often and build systems often do. The `brew --prefix`
case is really fast because it's just in Bash so: let's pull the
`brew --prefix <formula>` case into Bash too.

This doesn't handle any edge-cases like `--installed` and the formula
detection is pretty simple.

Also, to make this behaviour consistent, never output `Cellar` paths
from the (Ruby) `brew --prefix`; we never want people relying on the
Cellar paths anyway, only output them if the formula wasn't installed
(where, arguably, using a Cellar path is even worse) and the speedup is
worth this deviation in behaviour.
2021-02-25 17:07:28 +00:00
Rylan Polster
4a82d807e1
style: remove RSpec/MultipleDescribes violations in commands 2021-02-01 20:30:51 -05:00
Rylan Polster
af40e072b0
style: remove RSpec/NamedSubject violations 2021-02-01 20:30:51 -05:00
Mike McQuaid
cdf8ff9052
Merge pull request #10266 from gromgit/prefix_non_installed
cmd/--prefix: add --installed flag
2021-02-01 09:05:28 +00:00
Adrian Ho
28a8409b6e cmd/--prefix: add --installed flag
This changes the output for uninstalled formulae from Cellar prefix to empty string, so:
```sh
$ brew --prefix abcde python@3.9 tcl-tk
/usr/local/Cellar/abcde/2.9.3_1
/usr/local/opt/python@3.9
/usr/local/Cellar/tcl-tk/8.6.10
$ brew --prefix --installed abcde python@3.9 tcl-tk

/usr/local/opt/python@3.9

$
```
2021-01-31 16:09:43 +08:00
Mike McQuaid
d6957a3acb
Homebrew 3.0.0 deprecations/disables 2021-01-29 19:50:24 +00:00
Seeker
1ce8bd00fb named_args: print error if formula and cask found but one is unreadable 2021-01-28 15:21:23 -08:00
Rylan Polster
4b8477ba70 Completions, Settings: move to Homebrew namespace 2021-01-13 11:20:28 -05:00
Rylan Polster
e7b369273a completions: link official taps automatically 2021-01-11 12:27:57 -05:00
Rylan Polster
e9d09c4d8f tests: add and fix tests 2021-01-08 17:11:20 -05:00
Mike McQuaid
74fb058c7e
More deprecations
More deprecations, disabling and removal for Homebrew 2.7.0.
2020-12-18 14:17:37 +00:00
Markus Reiter
81203d346c Make brew help cat test stricter. 2020-11-30 20:52:27 +01:00
Markus Reiter
e26311236f Ensure brew cat output is empty on failure. 2020-11-30 20:52:27 +01:00
Mike McQuaid
d496f5c121
Deprecations for Homebrew 2.6.0
Do the usual deprecate/disable dance for the Homebrew 2.6.0 release.

Not to be merged until the next release will definitely be 2.6.0.
2020-11-24 16:44:02 +00:00
Markus Reiter
0184e271d8 Fix RuboCop offenses. 2020-11-17 11:09:55 +01:00
Tie
b5427e5095 fix style issues 2020-11-04 18:53:03 -05:00
Dawid Dziurla
0fa417706a cmd: add autoremove command 2020-11-04 17:15:32 -05:00
Tie
4127a7b624 move some uninstall tests to new file 2020-11-04 17:14:43 -05:00
Tie
f95e1729a2 move logic from leaves to formula 2020-11-04 16:45:14 -05:00
Mike McQuaid
60046ac41c
Merge pull request #8893 from whoiswillma/william/integrate-brew-info
cmd/info: Add support for casks in brew info
2020-10-26 11:59:53 +00:00
Mike McQuaid
a0a9fa241f
Merge pull request #8851 from Akylzhan/patch
cmd/list.rb: --formula and --cask as default option on TTY
2020-10-13 11:52:19 +01:00
William Ma
d96ad81cd0 cmd/info: Add test for --json=v2 2020-10-12 09:19:04 -04:00
Akylzhan Sauranbay
c8809ce730 cmd/list.rb: --formula, --cask as default on TTY outputs
cmd/list.rb: --formula, --cask as default TTY:

cmd/list.rb: proper deprecated message on non TTY outputs

update manpage

update zsh completion

updated manpages/brew.1

update tests

return list_casks

list_spec.rb: not output to stderr
2020-10-12 14:52:03 +06:00
Markus Reiter
24ae318a3d Move type annotations into files. 2020-10-10 14:59:39 +02:00
nandahkrishna
c1909e80b4
utils/tty: fix TTY handling for stderr 2020-09-17 04:18:13 +05:30
Mike McQuaid
2e5272d04c Deprecate/disable code for Homebrew 2.5.0.
Do the usual "disable deprecations" and "uncomment pending deprecations"
dance and delete/deprecate/disable relevant/related code.
2020-09-03 10:34:22 +01:00
Maxim Belkin
a6d29894d9 cleanup: fix and reuse portable ruby logic.
Align the logic in `cleanup_portable_ruby` with that in `ruby.sh`.

Co-authored-by: Maxim Belkin <maxim.belkin@gmail.com>
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2020-09-03 09:43:41 +01:00
Seeker
5def0701ba formula: rename opt_or_installed_prefix_keg to any_installed_keg 2020-09-01 09:39:20 -07:00
Seeker
5acdcd26d0 formula: rename installed_prefix to latest_installed_prefix 2020-09-01 09:32:32 -07:00
Mike McQuaid
2bdf0d6068
spec_helper: increase tests timeout.
When GitHub Actions is congested some tests can take longer than this
(particularly as we're running in parallel). Globally double the time
we allow for all tests.
2020-08-25 10:20:17 +01:00
Markus Reiter
21c502e05f Remove unused metadata from bundle spec. 2020-08-24 08:31:07 +02:00
Mike McQuaid
3a91c37e66
Fix RuboCop checks. 2020-08-19 17:12:32 +01:00
William Ma
2f68aad417 home: Deprecate brew cask home 2020-08-14 11:02:30 -04:00
William Ma
cf961caa27 caskroom: Add --caskroom command 2020-08-03 12:35:03 -04:00
Markus Reiter
d4c2ffd705 Refactor CLI::Parser. 2020-07-31 15:07:17 +02:00
Markus Reiter
e14506e589 Pass args in uninstall instead of using global args. 2020-07-30 03:21:12 +02:00
Markus Reiter
bf9659423a Increase timeout for some integration tests. 2020-07-28 09:50:15 +02:00
Mike McQuaid
2ff56c9e71
Merge pull request #7927 from MLH-Fellowship/integrate-cask
Allow references to casks when running upgrade and outdated
2020-07-27 15:11:32 +01:00
Mike McQuaid
047738069f
Speed up timing-out tests.
- make `brew readall` only check Homebrew/brew syntax with no tap
  passed.
- pass specified tap to `brew readall` test for speed
- only shell out once in `FormulaInfo` test for speed
2020-07-27 14:01:22 +01:00
Dustin Rodrigues
ec81d43519 increase readall test timeout 2020-07-25 22:53:25 -04:00
Markus Reiter
d048c324f9 Increase timeout for brew readall integration test. 2020-07-22 01:11:57 +02:00
William Ma
fa0f6f4d5b outdated: Update tests for deprecation warning 2020-07-20 16:16:18 -04:00
Mike McQuaid
4e10341277
Merge pull request #7752 from SMillerDev/cask/readall
Support casks in readall
2020-07-01 12:19:30 +01:00
Mike McQuaid
7d53104c46
cmd/search_spec: split Linux/macOS tests. 2020-07-01 11:55:25 +01:00
Mike McQuaid
ac0665daff
Refer to default branch in links with HEAD
Anywhere we can use `blob/master` we can use `blob/HEAD` instead. This
will make life easier if we ever rename our default branch in future
(once/if Git and GitHub provides the necessary tooling to do so).
2020-06-25 11:38:40 +01:00
William Ma
27abc8c50b home: Print info for each formula/cask opened 2020-06-23 09:44:17 -04:00