Class: Homebrew::Bundle::Tap Private
- Inherits:
-
PackageType
- Object
- PackageType
- Homebrew::Bundle::Tap
- Defined in:
- bundle/tap.rb
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.
Class Method Summary collapse
- .check_label ⇒ String private
- .dump(dumped_formulae: [], dumped_casks: []) ⇒ String private
- .dump_output(describe: false, no_restart: false) ⇒ String private
- .install!(name, preinstall: true, no_upgrade: false, verbose: false, force: false, clone_target: nil, **_options) ⇒ Boolean private
- .install_verb(_name = "", _options = {}) ⇒ String private
- .installed_taps ⇒ Array<String> private
- .preinstall!(name, no_upgrade: false, verbose: false, **_options) ⇒ Boolean private
- .reset! ⇒ void private
- .tap_names ⇒ Array<String> private
- .taps ⇒ Array<::Tap> private
- .type ⇒ Symbol private
Instance Method Summary collapse
- #find_actionable(entries, exit_on_first_error: false, no_upgrade: false, verbose: false) ⇒ Array<String> private
- #installed_and_up_to_date?(package, no_upgrade: false) ⇒ Boolean private
Methods inherited from PackageType
check, #checkable_entries, dump_supported?, #exit_early_check, #failure_reason, fetchable_name, #format_checkable, #full_check, inherited, install_supported?
Class Method Details
.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.
16 |
# File 'bundle/tap.rb', line 16 def check_label = "Tap" |
.dump(dumped_formulae: [], dumped_casks: []) ⇒ 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.
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'bundle/tap.rb', line 89 def dump(dumped_formulae: [], dumped_casks: []) taps.map do |tap| remote = if (tap_remote = tap.remote) && tap_remote != tap.default_remote if (api_token = ENV.fetch("HOMEBREW_GITHUB_API_TOKEN", false).presence) # Replace the API token in the remote URL with interpolation. # Keep the interpolation unevaluated until the Brewfile is evaluated. tap_remote = tap_remote.gsub api_token, "\#{ENV.fetch(\"HOMEBREW_GITHUB_API_TOKEN\")}" end ", \"#{tap_remote}\"" end tapline = "tap \"#{tap.name}\"#{remote}" trusted = if Homebrew::Trust.explicitly_trusted_tap?(tap) true else tap_trust = T.let({}, T::Hash[Symbol, T::Array[String]]) { formula: [:formulae, dumped_formulae], cask: [:casks, dumped_casks], command: [:commands, []], }.each do |type, values| key, dumped_items = values trusted_items = Homebrew::Trust.trusted_entries(type).filter_map do |entry| reference, _, item = entry.rpartition("/") next if reference.blank? || item.blank? next if reference != tap.name && !tap.matches_reference?(reference) next if dumped_items.include?("#{tap.name}/#{item}") item end.sort.uniq tap_trust[key] = trusted_items if trusted_items.present? end tap_trust.presence end if trusted == true tapline += ", trusted: true" elsif trusted.present? = trusted.map do |key, values| "#{key}: [#{values.map(&:inspect).join(", ")}]" end.join(", ") tapline += ", trusted: { #{} }" end tapline end.sort.uniq.join("\n") 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.
136 137 138 139 140 141 |
# File 'bundle/tap.rb', line 136 def dump_output(describe: false, no_restart: false) _ = describe _ = no_restart dump end |
.install!(name, preinstall: true, no_upgrade: false, verbose: false, force: false, clone_target: nil, **_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.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'bundle/tap.rb', line 54 def install!(name, preinstall: true, no_upgrade: false, verbose: false, force: false, clone_target: nil, **) _ = no_upgrade return true unless preinstall puts "Installing #{name} tap. It is not currently installed." if verbose args = [] official_tap = name.downcase.start_with? "homebrew/" args << "--force" if force || (official_tap && Homebrew::EnvConfig.developer?) success = if clone_target Bundle.brew("tap", name, clone_target, *args, verbose:) else Bundle.brew("tap", name, *args, verbose:) end unless success require "bundle/skipper" Homebrew::Bundle::Skipper.tap_failed!(name) return false end require "tap" ::Tap.fetch(name).clear_cache installed_taps << name 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.
84 85 86 |
# File 'bundle/tap.rb', line 84 def install_verb(_name = "", = {}) "Tapping" end |
.installed_taps ⇒ 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.
149 150 151 |
# File 'bundle/tap.rb', line 149 def installed_taps @installed_taps ||= T.let(tap_names, T.nilable(T::Array[String])) 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.
32 33 34 35 36 37 38 39 40 41 |
# File 'bundle/tap.rb', line 32 def preinstall!(name, no_upgrade: false, verbose: false, **) _ = no_upgrade if installed_taps.include? name puts "Skipping install of #{name} tap. It is already installed." if verbose return false end 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.
19 20 21 22 |
# File 'bundle/tap.rb', line 19 def reset! @taps = T.let(nil, T.nilable(T::Array[::Tap])) @installed_taps = T.let(nil, T.nilable(T::Array[String])) end |
.tap_names ⇒ 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.
144 145 146 |
# File 'bundle/tap.rb', line 144 def tap_names taps.map(&:name) end |
.taps ⇒ Array<::Tap>
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.
154 155 156 157 158 159 |
# File 'bundle/tap.rb', line 154 def taps @taps ||= begin require "tap" ::Tap.select(&:installed?).to_a end 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.
13 |
# File 'bundle/tap.rb', line 13 def type = :tap |
Instance Method Details
#find_actionable(entries, exit_on_first_error: false, no_upgrade: false, verbose: false) ⇒ 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.
167 168 169 170 171 172 173 174 175 176 177 |
# File 'bundle/tap.rb', line 167 def find_actionable(entries, exit_on_first_error: false, no_upgrade: false, verbose: false) _ = exit_on_first_error _ = no_upgrade _ = verbose requested_taps = format_checkable(entries) return [] if requested_taps.empty? current_taps = self.class.tap_names (requested_taps - current_taps).map { |entry| "Tap #{entry} needs to be tapped." } 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.
180 181 182 183 184 |
# File 'bundle/tap.rb', line 180 def installed_and_up_to_date?(package, no_upgrade: false) _ = no_upgrade self.class.installed_taps.include?(T.cast(package, String)) end |