When an installed formula is missing and its source has migrated
to a new tap, Homebrew warns the user about this, saying:
You can access it again by running:
brew tap new-name
And then you can install it by running:
brew cask install new-name
Unfortunately, the "brew cask install" incantation is deprecated
and the advice won't work:
Error: Calling brew cask install is disabled! Use brew install [--cask] instead.
This alters the advice to use the new "brew install --cask" notation,
fixing the advice presented to the user.
- 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.
- I tried to install `keybase`, thinking I'd get the CLI. On Linux,
casks don't work, yet I was still prompted to `brew cask install
keybase`. When I tried that (just to make sure), I got the "casks are
only supported on MacOS" error.
- This change makes it so we don't prompt people to install casks if
they're on platforms other than MacOS.
Before:
```
╭─issyl0@grus /home/linuxbrew/.linuxbrew/Homebrew ‹master›
╰─ $ brew install keybase
Error: No available formula with the name "keybase"
Found a cask named "keybase" instead.
```
After:
```
Error: No available formula with the name "keybase"
==> Searching for a previously deleted formula (in the last month)...
Warning: homebrew/core is shallow clone. To get complete history run:
git -C "$(brew --repo homebrew/core)" fetch --unshallow
Error: No previously deleted formula found.
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
==> Searching taps on GitHub...
Error: No formulae found in taps.
```
- It won't output anything during a failed 'brew install'
- There's a seperate call to MissingFormula.cask_reason
when 'brew info' is executed on a cask.
- get_info builds info string by appending helper functions
- removed unnecessary returns
- fixed indentation in missing_formula
- reduced size of regex in info_spec
- missing_formula will indicate when it finds a cask with same name
- search_for_cask in missing_formula renamed to is_a_cask_reason
- is_a_cask calls new getInfo method in cask/cmd/info.rb to return info
string
- self.info in info.rb now calls getInfo and puts return value
- added ohai_title to return the ohai printout for only titles, so that
ohai printout could be added to the getInfo return string without
calling puts.
- refactored ohai to use ohai_title
- updated info_spec.rb cask info test to be more specific when
matching stderr.
- is_a_cask_reason will respect 'silent'
- refactored print_caveats to return instead of print
- changed require_relative to require
- removed useless begin
- removed unnecessary test
- updated brew info positive test case to verify a cask was found
- moved cask search logic to missing_formula.rb
Use 124 max line length everywhere. Also, reduce tap max line length to
189 as Homebrew/homebrew-core has that as a maximum now. In future
Homebrew/homebrew-core will also be reduced to 124 maximum line length.