* tap: take ownership of synced_versions_formulae.json
* formula: add synced_with_other_formulae? logic
Signed-off-by: Michael Cho <michael@michaelcho.dev>
This could cause problems if a tap is installed during the lifetime
of the program which happens occasionally with `Tap#ensure_installed!`.
It also seems to be slow mainly because of intermediate arrays and
Pathname objects that get created in `Tap.each`. Maybe that should
be optimized instead.
This should be a relatively small hash but it gets recalculated
every time we call Cask#oldnames or Formula#oldnames which ends
up being a lot if you run certain commands with --eval-all.
For example, when running the following, it took 10% of the total
runtime.
```
brew deps --casks --eval-all
```
We essentially stopped caching these accidentally and they get
called every time we try to load a cask or formula from the API.
It gets really, really, really slow.
I ran `brew deps --casks --eval-all` before and after the changes.
I let it run for 3 minutes before killing it. No output had been
printed to the screen.
It finished printing all output (pages and pages of it) in less
than a minute.
---
This should match the caching behavior we had before the
recent changes in these two PRs.
- https://github.com/Homebrew/brew/pull/16777
- https://github.com/Homebrew/brew/pull/16775
Stop mocking the formulary loader method. We just need to set the
environment variable so that it knows to load things from the API.
Fix spec that doesn't work with the `CoreTap.formula_names`.
That method assumes that we always have a valid `ruby_source_path`
in the API JSON even though that was optional for a while after
launching the API if my memory serves me. It's probably fine
to assume this should always be set though and I changed it to use
`Hash#fetch` to give use better error messages if something goes wrong in the future.
Remove unused `allow(x).to receive(y).and_call_original` in tap spec.
- 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
There is a check for other versioned formula with the same name
in the file audit. This just memoizes all of the versioned
formulae in a tap during the first call and then uses that much
shorter list everytime it checks for things.