While we're here, also add `brew tests --no-parallel` which I relied
on during testing.
Pretty much anywhere we rely on a stubbed formula on disk to work: we
need to disable the API.
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.
- 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.
- 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
```
We added the `--all` flag (now renamed to `--eval-all`) for various
commands for this behaviour so let's start deprecating this.
Also, introduce a `HOMEBREW_EVAL_ALL` environment variable to use the
existing, less secure, behaviour by default and avoid passing
`--eval-all` everywhere.
This makes use of both the existing interfaces and could use the
existing cache file but we'll create a new one and cleanup the old one
to avoid issues and use a more consistent name.
We have an awful lot of integration tests and they are (comparatively)
really slow. Let's kill those that test edge case conditions and focus
on those that test that our functionality works as expected. Edge cases
can be better tested with unit tests.