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.
Constant Summary collapse
- PACKAGE_TYPE =
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.
:tap- PACKAGE_TYPE_NAME =
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.
"Tap"
Class Method Summary collapse
- .dump ⇒ 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
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?, type
Class Method Details
.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.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'bundle/tap.rb', line 86 def dump taps.map do |tap| remote = if tap.custom_remote? && (tap_remote = tap.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}" tapline += ", trusted: true" if Homebrew::Trust.explicitly_trusted_tap?(tap) 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.
103 104 105 106 107 108 |
# File 'bundle/tap.rb', line 103 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.
51 52 53 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 |
# File 'bundle/tap.rb', line 51 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.
81 82 83 |
# File 'bundle/tap.rb', line 81 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.
116 117 118 |
# File 'bundle/tap.rb', line 116 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.
29 30 31 32 33 34 35 36 37 38 |
# File 'bundle/tap.rb', line 29 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.
16 17 18 19 |
# File 'bundle/tap.rb', line 16 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.
111 112 113 |
# File 'bundle/tap.rb', line 111 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.
121 122 123 124 125 126 |
# File 'bundle/tap.rb', line 121 def taps @taps ||= begin require "tap" ::Tap.select(&:installed?).to_a end end |
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.
134 135 136 137 138 139 140 141 142 143 144 |
# File 'bundle/tap.rb', line 134 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.
147 148 149 150 151 |
# File 'bundle/tap.rb', line 147 def installed_and_up_to_date?(package, no_upgrade: false) _ = no_upgrade self.class.installed_taps.include?(T.cast(package, String)) end |