Class: Homebrew::Bundle::Tap Private
- Inherits:
-
PackageType
- Object
- Checker::Base
- 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, verbose: false, force: false, clone_target: nil, **_options) ⇒ Boolean private
- .install_verb(_name = "", _options = {}) ⇒ String private
- .installed_taps ⇒ Array<String> private
- .preinstall!(name, 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, check_supported?, dump_supported?, fetchable_name, inherited, install_supported?, type
Methods inherited from Checker::Base
#checkable_entries, #exit_early_check, #failure_reason, #format_checkable, #full_check
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.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'bundle/tap.rb', line 70 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. # Rubocop's warning here is wrong; we intentionally want to not # evaluate this string until the Brewfile is evaluated. # rubocop:disable Lint/InterpolationCheck tap_remote = tap_remote.gsub api_token, '#{ENV.fetch("HOMEBREW_GITHUB_API_TOKEN")}' # rubocop:enable Lint/InterpolationCheck end ", \"#{tap_remote}\"" end "tap \"#{tap.name}\"#{remote}" 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.
88 89 90 91 92 93 |
# File 'bundle/tap.rb', line 88 def dump_output(describe: false, no_restart: false) _ = describe _ = no_restart dump end |
.install!(name, preinstall: true, 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.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'bundle/tap.rb', line 40 def install!(name, preinstall: true, verbose: false, force: false, clone_target: nil, **) 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 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.
65 66 67 |
# File 'bundle/tap.rb', line 65 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.
101 102 103 |
# File 'bundle/tap.rb', line 101 def installed_taps @installed_taps ||= T.let(tap_names, T.nilable(T::Array[String])) end |
.preinstall!(name, 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.
21 22 23 24 25 26 27 28 |
# File 'bundle/tap.rb', line 21 def preinstall!(name, verbose: false, **) 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.
15 16 17 18 |
# File 'bundle/tap.rb', line 15 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.
96 97 98 |
# File 'bundle/tap.rb', line 96 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.
106 107 108 109 110 111 |
# File 'bundle/tap.rb', line 106 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.
119 120 121 122 123 124 125 126 127 128 129 |
# File 'bundle/tap.rb', line 119 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.
132 133 134 135 136 |
# File 'bundle/tap.rb', line 132 def installed_and_up_to_date?(package, no_upgrade: false) _ = no_upgrade self.class.installed_taps.include?(T.cast(package, String)) end |