This reduces the surface area of our `Kernel` monkeypatch and removes
the need to `include Kernel` in a bunch of modules.
While we're here, also move `Kernel#require?` to `Homebrew` and fully
scope the calls to it.
`cmd` can be a `Pathname` (see the type signature), but `ohai` seems to
expect only `String`s now.
While we're here, let's assert that `cmd` exists whenever it is a
`Pathname`, to avoid passing arguments like `bin/"cmd --version"` (which
is not a valid `Pathname`).
See, for example, Homebrew/homebrew-core#231882.
```
❯ brew test zstd
==> Testing zstd
Error: zstd: failed
An exception occurred within a child process:
TypeError: Parameter 'cmd': Expected type String, got type Pathname with value #<Pathname:/opt/homebrew/Cellar/zstd/1.5.6/bin/zstd>
Caller: /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/z/zstd.rb:58
Definition: /opt/homebrew/Library/Homebrew/formula_assertions.rb:40 (Homebrew::Assertions#pipe_output)
```
- This can be either a String or a Pathname, per
the part of the `noseyparker` test that failed
(in a different part of the test, the command is
passed as a string).
```
==> Testing noseyparker
==> /opt/homebrew/Cellar/noseyparker/0.18.1/bin/noseyparker -V
Error: noseyparker: failed
An exception occurred within a child process:
TypeError: Parameter 'cmd': Expected type String, got type Pathname with value #<Pathname:/opt/homebrew/Ce...ps://github.com/Homebrew/brew>
Caller: /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/n/noseyparker.rb:35
```
When doing `brew test --verbose` (as `brew test-bot` does) ensure that
the output is printed when an assertion fails to more easily debug the
test failure.