We were selectively requiring the tap.rb file in a few places for
performance reasons. The main method we were referencing was the
`Tap.cmd_directories` method which uses `Pathname` and the `TAP_DIRECTORY`
constant internally. `Tap.cmd_directories` is mostly used in the `Commands`
module and that is loaded very early on in the program so it made sense
to move that command to that module. To facilitate that I moved the
`TAP_DIRECTORY` constant to the top-level and renamed it to
`HOMEBREW_TAP_DIRECTORY`. It now lies in the tap_constants.rb file.
A nice bonus of this refactor is that it speeds up loading external
commands since the tap.rb file is no longer required by default in
those cases.
Previously, we required all formulae and casks to be in a specific
formula or cask directory but did not check any subdirectories.
This commit allows using subdirectories for official taps, the only
ones likely to be big enough to warrant sharding in this way and to
avoid potentially breaking backwards compatibility for existing taps.
This was inspired by the most recent issues with homebrew-cask.
- For some of these I changed `context` to `describe` as it fit better
rather than contriving a "when", "with" or "without", or massively
restructuring the tests.
- Depending on context, I've gone for either "denylist" or "disallow"
here. "Disallow" for things in sentences, or actions, and "denylist"
for list of things.
- In Homebrew/linuxbrew-core, [we have a Linux-only formula for
`texlive`](https://github.com/Homebrew/linuxbrew-core/tree/master/Formula/texlive.rb).
- When running `brew audit --strict texlive` on Linux, we got the
following messaging:
```
$ brew audit --strict texlive
texlive:
* 'texlive' is blacklisted from homebrew/core.
Error: 1 problem in 1 formula detected
```
- Looking at where this comes from leads to the missing formula
messaging to install `mactex` via Homebrew Cask. The 'blacklisted in
homebrew/core' messaging only applies to macOS where Casks are an option
for users, so let's not surface the audit for `texlive` on Linux.