This updates logic to add a `#scheme_and_version` method to be used
with `.sort_by` and `.max_by`. Using `Keg#version` by itself can be
inaccurate when different version schemes are present. This also
updates the behavior of `Formula#eligible_kegs_for_cleanup` to match
the previous behavior. We were dropping the wrong keg based on the
sort being reversed in a previous PR.
This came up recently where an outdated formula definition
caused the program to crash with an ambiguous message when
a user wanted to upgrade a cask instead. Catching these errors
allows them to get handled later on improving error messages
and defaults. Now if the only formula with the given name is
invalid it will default to using the cask unless --formula is
specified.
- https://github.com/Homebrew/brew/issues/16123
Before we used to evaluate all named arguments as local paths
first. This means that the following could be a name conflict.
$ brew edit src
If there was a local file or directory named src, it would default
to that. Otherwise it would search for a formula/cask with the
same name and return that.
Now it will only default to the local path if the named argument
starts or ends with a slash ('/') or includes a period ('.').
This means that in the event of a name clash with a normal package
name it will default to the package instead of the local file.
It also fixes an edge case where the following would be interpreted
as a tap name.
$ brew edit /src
Before this change, external commands, whether official or not, cannot
use the `env:` DSL for `Homebrew::CLI::Parser` without adding their
environment variable to `Homebrew::EnvConfig`.
Instead, if the method is not defined, check the environment variable
directly. This allows `env:` to be used as expected and allows
simplifying some (new) code in e.g. `brew bundle`.
- keep running the command against all os/arch combinations
as the default
- remove todos and deprecations related to changing the behavior
- create constants for os/arch combinations
- Load paths with no API when needed (e.g. for `brew edit`)
- Use no API mode for `brew log` as it's needed there
- Define sharding format for homebrew-cask and homebrew-core inside
`Tap` methods
- Create new formulae/casks in location defined by these `Tap` methods
- Fix a bug in Formulary that made sharded formulae lookup less
efficient (and possibly broke it for core and some API usage)
- Fix various other hardcoded Formula/Cask directory assumptions
Co-authored-by: Bo Anderson <mail@boanderson.me>