Class: Homebrew::Bundle::Extension Abstract Private
- Inherits:
-
Checker::Base
- Object
- Checker::Base
- Homebrew::Bundle::Extension
- Extended by:
- T::Helpers
- Defined in:
- bundle/extensions/extension.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.
It cannot be directly instantiated. Subclasses must implement the abstract methods below.
Constant Summary collapse
- EntryOptions =
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
T.type_alias { T::Hash[Symbol, Object] }
Class Method Summary collapse
- .add_supported? ⇒ Boolean private
- .banner_name ⇒ String private
- .check(entries, exit_on_first_error: false, no_upgrade: false, verbose: false) ⇒ Array<Object> private
- .check_label ⇒ String private
- .cleanup!(_items) ⇒ void private
- .cleanup_heading ⇒ String? private
- .cleanup_items(_entries) ⇒ Array<String> private
- .cleanup_supported? ⇒ Boolean private
- .dump ⇒ String private
- .dump_disable_description ⇒ String private
- .dump_disable_env ⇒ Symbol private
- .dump_disable_predicate_method ⇒ Symbol private
- .dump_disable_supported? ⇒ Boolean private
- .dump_entry(package) ⇒ String private
- .dump_name(package) ⇒ String private
- .dump_supported? ⇒ Boolean private
- .dump_with(_package) ⇒ Array<String>? private
- .entry(name, options = {}) ⇒ Dsl::Entry abstract private
- .flag ⇒ String private
- .inherited(subclass) ⇒ void private
- .install!(name, with: nil, preinstall: true, no_upgrade: false, verbose: false, force: false) ⇒ Boolean private
- .install_package!(name, with: nil, verbose: false) ⇒ Boolean abstract private
- .install_supported? ⇒ Boolean private
- .installed_packages ⇒ Array<T.untyped> abstract private
- .package_description ⇒ String private
- .package_installed?(name, with: nil) ⇒ Boolean private
- .package_manager_executable ⇒ Pathname? private
-
.package_manager_installed? ⇒ Boolean
private
stubbing
Homebrew::Bundle.which_*and*_installed?directly. - .package_manager_name ⇒ String private
- .package_record(name, with: nil) ⇒ Object private
-
.packages ⇒ Array<T.untyped>
abstract
private
share a typed package interface without breaking Sorbet override checks.
- .predicate_method ⇒ Symbol private
- .preinstall!(name, with: nil, no_upgrade: false, verbose: false) ⇒ Boolean private
- .quote(value) ⇒ String private
- .remove_supported? ⇒ Boolean private
- .reset! ⇒ void abstract private
- .switch_description ⇒ String private
- .type ⇒ Symbol private
Instance Method Summary collapse
- #failure_reason(package, no_upgrade:) ⇒ String private
- #installed_and_up_to_date?(package, no_upgrade: false) ⇒ Boolean private
Methods inherited from Checker::Base
#checkable_entries, #exit_early_check, #find_actionable, #format_checkable, #full_check
Class Method Details
.add_supported? ⇒ Boolean
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.
180 181 182 |
# File 'bundle/extensions/extension.rb', line 180 def self.add_supported? true end |
.banner_name ⇒ 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.
110 111 112 |
# File 'bundle/extensions/extension.rb', line 110 def self. T.cast(const_get(:BANNER_NAME), String) end |
.check(entries, exit_on_first_error: false, no_upgrade: false, verbose: false) ⇒ Array<Object>
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.
253 254 255 |
# File 'bundle/extensions/extension.rb', line 253 def self.check(entries, exit_on_first_error: false, no_upgrade: false, verbose: false) new.find_actionable(entries, exit_on_first_error:, no_upgrade:, verbose:) end |
.check_label ⇒ 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.
105 106 107 |
# File 'bundle/extensions/extension.rb', line 105 def self.check_label T.cast(const_get(:PACKAGE_TYPE_NAME), String) end |
.cleanup!(_items) ⇒ 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.
This method returns an undefined value.
263 |
# File 'bundle/extensions/extension.rb', line 263 def self.cleanup!(_items); end |
.cleanup_heading ⇒ 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.
195 196 197 |
# File 'bundle/extensions/extension.rb', line 195 def self.cleanup_heading nil end |
.cleanup_items(_entries) ⇒ Array<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.
258 259 260 |
# File 'bundle/extensions/extension.rb', line 258 def self.cleanup_items(_entries) [] end |
.cleanup_supported? ⇒ Boolean
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.
200 201 202 |
# File 'bundle/extensions/extension.rb', line 200 def self.cleanup_supported? !cleanup_heading.nil? end |
.dump ⇒ 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.
241 242 243 |
# File 'bundle/extensions/extension.rb', line 241 def self.dump packages.map { |package| dump_entry(package) }.join("\n") end |
.dump_disable_description ⇒ 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.
160 161 162 |
# File 'bundle/extensions/extension.rb', line 160 def self.dump_disable_description "`dump` without #{}." end |
.dump_disable_env ⇒ Symbol
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.
165 166 167 |
# File 'bundle/extensions/extension.rb', line 165 def self.dump_disable_env :"bundle_dump_no_#{type}" end |
.dump_disable_predicate_method ⇒ Symbol
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.
175 176 177 |
# File 'bundle/extensions/extension.rb', line 175 def self.dump_disable_predicate_method :"no_#{type}?" end |
.dump_disable_supported? ⇒ Boolean
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.
170 171 172 |
# File 'bundle/extensions/extension.rb', line 170 def self.dump_disable_supported? true end |
.dump_entry(package) ⇒ 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.
216 217 218 219 220 221 222 223 |
# File 'bundle/extensions/extension.rb', line 216 def self.dump_entry(package) line = "#{type} #{quote(dump_name(package))}" with = dump_with(package) return line if with.blank? formatted_with = with.map { |requirement| quote(requirement) }.join(", ") "#{line}, with: [#{formatted_with}]" end |
.dump_name(package) ⇒ 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.
231 232 233 |
# File 'bundle/extensions/extension.rb', line 231 def self.dump_name(package) package.to_s end |
.dump_supported? ⇒ Boolean
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.
155 156 157 |
# File 'bundle/extensions/extension.rb', line 155 def self.dump_supported? true end |
.dump_with(_package) ⇒ Array<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.
236 237 238 |
# File 'bundle/extensions/extension.rb', line 236 def self.dump_with(_package) nil end |
.entry(name, options = {}) ⇒ Dsl::Entry
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.
120 |
# File 'bundle/extensions/extension.rb', line 120 def self.entry(name, = {}); end |
.flag ⇒ 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.
123 124 125 |
# File 'bundle/extensions/extension.rb', line 123 def self.flag type.to_s.tr("_", "-") end |
.inherited(subclass) ⇒ 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.
This method returns an undefined value.
94 95 96 97 |
# File 'bundle/extensions/extension.rb', line 94 def self.inherited(subclass) super Homebrew::Bundle.register_extension(subclass) end |
.install!(name, with: nil, preinstall: true, no_upgrade: false, verbose: false, force: false) ⇒ Boolean
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.
318 319 320 321 322 323 324 325 326 327 328 329 330 331 |
# File 'bundle/extensions/extension.rb', line 318 def self.install!(name, with: nil, preinstall: true, no_upgrade: false, verbose: false, force: false) _ = no_upgrade _ = force return true unless preinstall puts "Installing #{name} #{package_description}. It is not currently installed." if verbose return false unless install_package!(name, with:, verbose:) package = package_record(name, with:) installed_packages << package unless installed_packages.include?(package) packages << package unless packages.include?(package) true end |
.install_package!(name, with: nil, verbose: false) ⇒ Boolean
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.
350 |
# File 'bundle/extensions/extension.rb', line 350 def self.install_package!(name, with: nil, verbose: false); end |
.install_supported? ⇒ Boolean
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.
190 191 192 |
# File 'bundle/extensions/extension.rb', line 190 def self.install_supported? true end |
.installed_packages ⇒ Array<T.untyped>
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.
213 |
# File 'bundle/extensions/extension.rb', line 213 def self.installed_packages; end |
.package_description ⇒ 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.
150 151 152 |
# File 'bundle/extensions/extension.rb', line 150 def self.package_description check_label.downcase end |
.package_installed?(name, with: nil) ⇒ Boolean
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.
273 274 275 |
# File 'bundle/extensions/extension.rb', line 273 def self.package_installed?(name, with: nil) installed_packages.include?(package_record(name, with:)) end |
.package_manager_executable ⇒ Pathname?
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.
145 146 147 |
# File 'bundle/extensions/extension.rb', line 145 def self.package_manager_executable Bundle.public_send(:"which_#{type}") end |
.package_manager_installed? ⇒ Boolean
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.
Route these through each extension once the go/uv specs stop
stubbing Homebrew::Bundle.which_* and *_installed? directly.
140 141 142 |
# File 'bundle/extensions/extension.rb', line 140 def self.package_manager_installed? Bundle.public_send(:"#{type}_installed?") end |
.package_manager_name ⇒ 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.
133 134 135 |
# File 'bundle/extensions/extension.rb', line 133 def self.package_manager_name flag end |
.package_record(name, with: nil) ⇒ Object
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.
266 267 268 269 270 |
# File 'bundle/extensions/extension.rb', line 266 def self.package_record(name, with: nil) _ = with name end |
.packages ⇒ Array<T.untyped>
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.
Replace these T.untyped package collections once extensions can
share a typed package interface without breaking Sorbet override checks.
210 |
# File 'bundle/extensions/extension.rb', line 210 def self.packages; end |
.predicate_method ⇒ Symbol
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.
128 129 130 |
# File 'bundle/extensions/extension.rb', line 128 def self.predicate_method :"#{type}?" end |
.preinstall!(name, with: nil, no_upgrade: false, verbose: false) ⇒ Boolean
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.
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 |
# File 'bundle/extensions/extension.rb', line 285 def self.preinstall!(name, with: nil, no_upgrade: false, verbose: false) _ = no_upgrade unless package_manager_installed? puts "Installing #{package_manager_name}. It is not currently installed." if verbose Bundle.brew("install", "--formula", package_manager_name, verbose:) upgrade_formulae = Bundle.upgrade_formulae Bundle.reset! Bundle.upgrade_formulae = upgrade_formulae.join(",") unless package_manager_installed? raise "Unable to install #{name} #{package_description}. " \ "#{package_manager_name} installation failed." end end if package_installed?(name, with:) puts "Skipping install of #{name} #{package_description}. It is already installed." if verbose return false end true end |
.quote(value) ⇒ 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.
226 227 228 |
# File 'bundle/extensions/extension.rb', line 226 def self.quote(value) value.inspect end |
.remove_supported? ⇒ Boolean
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.
185 186 187 |
# File 'bundle/extensions/extension.rb', line 185 def self.remove_supported? true end |
.reset! ⇒ 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.
This method returns an undefined value.
205 |
# File 'bundle/extensions/extension.rb', line 205 def self.reset!; end |
.switch_description ⇒ 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.
115 116 117 |
# File 'bundle/extensions/extension.rb', line 115 def self.switch_description "`list` or `dump` #{}." end |
.type ⇒ Symbol
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.
100 101 102 |
# File 'bundle/extensions/extension.rb', line 100 def self.type T.cast(const_get(:PACKAGE_TYPE), Symbol) end |
Instance Method Details
#failure_reason(package, no_upgrade:) ⇒ 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.
334 335 336 |
# File 'bundle/extensions/extension.rb', line 334 def failure_reason(package, no_upgrade:) "#{self.class.check_label} #{self.class.dump_name(package)} needs to be installed." end |
#installed_and_up_to_date?(package, no_upgrade: false) ⇒ Boolean
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.
339 340 341 |
# File 'bundle/extensions/extension.rb', line 339 def installed_and_up_to_date?(package, no_upgrade: false) self.class.package_installed?(self.class.dump_name(package), with: self.class.dump_with(package)) end |