Exception: FormulaOrCaskUnavailableError Private
- Defined in:
- exceptions.rb
Overview
This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.
Raised when neither a formula nor a cask with the given name is available.
Direct Known Subclasses
Instance Attribute Summary collapse
- #name ⇒ String readonly private
Instance Method Summary collapse
- #did_you_mean ⇒ String private
- #initialize(name) ⇒ void constructor private
Constructor Details
#initialize(name) ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
125 126 127 128 129 130 131 132 133 134 135 |
# File 'exceptions.rb', line 125 def initialize(name) super() @name = name # Store the state of these envs at the time the exception is thrown. # This is so we do the fuzzy search for "did you mean" etc under that same mode, # in case the list of formulae are different. @without_api = T.let(Homebrew::EnvConfig.no_install_from_api?, T::Boolean) @auto_without_api = T.let(Homebrew::EnvConfig.automatically_set_no_install_from_api?, T::Boolean) end |
Instance Attribute Details
#name ⇒ String (readonly)
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
122 123 124 |
# File 'exceptions.rb', line 122 def name @name end |
Instance Method Details
#did_you_mean ⇒ String
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
138 139 140 141 142 143 144 145 146 |
# File 'exceptions.rb', line 138 def did_you_mean require "api/env" require "formula" similar_formula_names = Homebrew::API.with_no_api_env_if_needed(@without_api) { Formula.fuzzy_search(name) } return "" if similar_formula_names.blank? "Did you mean #{Utils::Text.to_sentence(similar_formula_names, conjunction: "or")}?" end |