Class: Homebrew::Bundle::PackageType Abstract Private
- Extended by:
- T::Helpers
- Defined in:
- bundle/package_type.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.
Class Method Summary collapse
- .check(entries, exit_on_first_error: false, no_upgrade: false, verbose: false) ⇒ Array<Object> private
- .dump ⇒ String abstract private
- .dump_output(describe: false, no_restart: false) ⇒ String private
- .dump_supported? ⇒ Boolean private
- .fetchable_name(name, options = {}, no_upgrade: false) ⇒ String? private
- .inherited(subclass) ⇒ void private
- .install!(name, preinstall: true, no_upgrade: false, verbose: false, force: false, **options) ⇒ Boolean abstract private
- .install_supported? ⇒ Boolean private
- .install_verb(_name = "", _options = {}) ⇒ String private
- .preinstall!(name, no_upgrade: false, verbose: false, **options) ⇒ Boolean abstract private
- .reset! ⇒ void abstract private
- .type ⇒ Symbol private
Instance Method Summary collapse
- #checkable_entries(all_entries) ⇒ Array<Object> private
- #exit_early_check(packages, no_upgrade:) ⇒ Array<Object> private
- #failure_reason(name, no_upgrade:) ⇒ String private
- #find_actionable(entries, exit_on_first_error: false, no_upgrade: false, verbose: false) ⇒ Array<Object> private
- #format_checkable(entries) ⇒ Array<Object> private
- #full_check(packages, no_upgrade:) ⇒ Array<String> private
- #installed_and_up_to_date?(_pkg, no_upgrade: false) ⇒ Boolean private
Class Method Details
.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.
94 95 96 |
# File 'bundle/package_type.rb', line 94 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 |
.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.
99 |
# File 'bundle/package_type.rb', line 99 def self.dump; end |
.dump_output(describe: false, no_restart: false) ⇒ 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.
102 103 104 105 106 107 |
# File 'bundle/package_type.rb', line 102 def self.dump_output(describe: false, no_restart: false) _ = describe _ = no_restart dump 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.
32 33 34 |
# File 'bundle/package_type.rb', line 32 def self.dump_supported? true end |
.fetchable_name(name, options = {}, no_upgrade: false) ⇒ 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.
53 54 55 56 57 58 59 |
# File 'bundle/package_type.rb', line 53 def self.fetchable_name(name, = {}, no_upgrade: false) _ = name _ = _ = no_upgrade nil 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.
19 20 21 22 23 24 |
# File 'bundle/package_type.rb', line 19 def self.inherited(subclass) super return if subclass.name == "Homebrew::Bundle::Extension" Homebrew::Bundle.register_package_type(subclass) end |
.install!(name, preinstall: true, no_upgrade: false, verbose: false, force: false, **options) ⇒ 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.
84 |
# File 'bundle/package_type.rb', line 84 def self.install!(name, preinstall: true, no_upgrade: false, verbose: false, force: 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.
37 38 39 |
# File 'bundle/package_type.rb', line 37 def self.install_supported? true end |
.install_verb(_name = "", _options = {}) ⇒ 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.
42 43 44 |
# File 'bundle/package_type.rb', line 42 def self.install_verb(_name = "", = {}) "Installing" end |
.preinstall!(name, no_upgrade: false, verbose: false, **options) ⇒ 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.
72 |
# File 'bundle/package_type.rb', line 72 def self.preinstall!(name, no_upgrade: false, verbose: false, **); 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.
62 |
# File 'bundle/package_type.rb', line 62 def self.reset!; 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.
27 28 29 |
# File 'bundle/package_type.rb', line 27 def self.type T.cast(const_get(:PACKAGE_TYPE), Symbol) end |
Instance Method Details
#checkable_entries(all_entries) ⇒ 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.
135 136 137 138 139 140 141 142 143 144 |
# File 'bundle/package_type.rb', line 135 def checkable_entries(all_entries) require "bundle/skipper" all_entries.filter_map do |entry| entry = T.cast(entry, Dsl::Entry) next if entry.type != self.class.const_get(:PACKAGE_TYPE) next if Bundle::Skipper.skip?(entry) entry end end |
#exit_early_check(packages, no_upgrade:) ⇒ 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.
110 111 112 113 114 115 116 |
# File 'bundle/package_type.rb', line 110 def exit_early_check(packages, no_upgrade:) work_to_be_done = packages.find do |pkg| !installed_and_up_to_date?(pkg, no_upgrade:) end Array(work_to_be_done) end |
#failure_reason(name, 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.
119 120 121 122 123 124 125 126 |
# File 'bundle/package_type.rb', line 119 def failure_reason(name, no_upgrade:) reason = if no_upgrade && Bundle.upgrade_formulae.exclude?(name) "needs to be installed." else "needs to be installed or updated." end "#{self.class.const_get(:PACKAGE_TYPE_NAME)} #{name} #{reason}" end |
#find_actionable(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.
167 168 169 170 171 172 173 174 175 |
# File 'bundle/package_type.rb', line 167 def find_actionable(entries, exit_on_first_error: false, no_upgrade: false, verbose: false) requested = format_checkable(entries) if exit_on_first_error exit_early_check(requested, no_upgrade:) else full_check(requested, no_upgrade:) end end |
#format_checkable(entries) ⇒ 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.
147 148 149 150 151 152 |
# File 'bundle/package_type.rb', line 147 def format_checkable(entries) checkable_entries(entries).map do |entry| entry = T.cast(entry, Dsl::Entry) entry.name end end |
#full_check(packages, no_upgrade:) ⇒ 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.
129 130 131 132 |
# File 'bundle/package_type.rb', line 129 def full_check(packages, no_upgrade:) packages.reject { |pkg| installed_and_up_to_date?(pkg, no_upgrade:) } .map { |pkg| failure_reason(pkg, no_upgrade:) } end |
#installed_and_up_to_date?(_pkg, 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.
155 156 157 |
# File 'bundle/package_type.rb', line 155 def installed_and_up_to_date?(_pkg, no_upgrade: false) raise NotImplementedError end |