This was slowing down every instantiation of brew significantly.
Hopefully doesn't break anything that had become accustomed to not having to require 'formula' or 'keg'.
/cc @mikemcquaid
Add an ARGV.dry_run? helper method for '--dry-run'/'-n' now that
'-n' is being used as a git-style dry-run in two commands.
ClosesHomebrew/homebrew#12898.
Signed-off-by: Misty De Meo <mistydemeo@gmail.com>
ARGV.build_head? will return true if the typo '-HEAD' is passed because
it uses flag? to detect the option. However, we only filter the exact
spelling of '--HEAD' in ARGV.filter_for_dependencies, and thus the HEAD
property is undesirably passed to deps during installation.
Since we never advertised '-H' as a valid short option for '--HEAD',
just use include? instead of flag?.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
If it exists, ARGV.kegs will return the Formula.prefix keg for each rack examined.
So for ARGV=[wget, foo] and the following Cellar (wget/1.11, wget/1.12, foo/1.0) you'll get [wget/1.12, foo/1.0] from ARGV.kegs provided 1.12 is the formula version of wget.
In fixing this I also made it so that ARGV.kegs will return the LinkedKeg if the symlink is set. Which is almost always is. This neatly avoids most multiple-kegs issues.
FixesHomebrew/homebrew#10685.
Previously, stripping arguments like `--HEAD` for dependencies failed because
that flag affects the installation prefix encoded into formula objects. The
previous implementation of `ARGV` filtering tried to contain all changes to a
single method call before the `FormulaInstaller` forks. This update spreads
things out a bit:
- The Homebrew `ARGV` extension adds a new method, `filter_for_dependencies`
which strips flags like `--HEAD`, yields to a block, then restores the
original contents of ARGV.
- The `explicitly_requested?` test, which returns true or false depending on
if a formula object is a member of `ARGV.formulae`, is now a method of
`Formula` objects.
- `FormulaInstaller` objects now execute the installation of dependencies
inside an `ARGV.filter_for_dependencies` block if the dependency was
`explicitly_requested?`.
FixesHomebrew/homebrew#8668.
ClosesHomebrew/homebrew#7724.
Often it is useful to provide a development build in addition to the
stable release or HEAD download.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Signed-off-by: Adam Vandenberg <flangy@gmail.com>
Be more useful by being more concise. I referenced dozens of other mature commands’ usage to figure out what to do here.
Also separated out the help into its own command for consistency.