Class: CoreTap Private
- Inherits:
-
AbstractCoreTap
- Object
- Tap
- AbstractCoreTap
- CoreTap
- Defined in:
- tap/core_tap.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.
A specialized Tap class for the core formulae.
Constant Summary collapse
- Cache =
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.
type_member { { fixed: T::Hash[T.any(String, Symbol), T.untyped] } }
- Elem =
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.
type_member(:out) { { fixed: Tap } }
Constants inherited from Tap
Tap::GITHUB_REMOTE_PREFIX_REGEX, Tap::HOMEBREW_TAP_JSON_FILES, Tap::NORMALIZE_REMOTE_HOSTS, Tap::REMOTE_HOST_REGEX, Tap::REMOTE_SCHEME_USERINFO_REGEX
Instance Attribute Summary
Attributes inherited from Tap
#full_name, #full_repository, #git_repository, #name, #path, #repository, #user
Instance Method Summary collapse
- #alias_dir ⇒ Pathname private
- #alias_file_to_name(file) ⇒ String private
- #alias_table ⇒ Hash{String => String} private
- #audit_exceptions ⇒ Hash{Symbol => T.untyped} private
- #autobump ⇒ Array<String> private
-
#canonical_remote?(remote = self.remote) ⇒ Boolean
private
The configured
HOMEBREW_CORE_GIT_REMOTEis the official remote for this tap. - #core_tap? ⇒ Boolean private
- #ensure_installed! ⇒ void private
- #formula_dir ⇒ Pathname private
- #formula_files ⇒ Array<Pathname> private
- #formula_files_by_name ⇒ Hash{String => Pathname} private
- #formula_names ⇒ Array<String> private
- #formula_renames ⇒ Hash{String => String} private
- #initialize ⇒ void constructor private
-
#install(quiet: false, clone_target: nil, custom_remote: false, verify: false, force: false) ⇒ void
private
CoreTap never allows shallow clones (on request from GitHub).
- #linuxbrew_core? ⇒ Boolean private
- #new_formula_path(name) ⇒ Pathname private
- #new_formula_subdirectory(name) ⇒ String private
- #remote ⇒ String? private
- #style_exceptions ⇒ Hash{Symbol => T.untyped} private
- #synced_versions_formulae ⇒ Array<Array<String>> private
- #tap_migrations ⇒ Hash{String => T.untyped} private
- #uninstall(manual: false) ⇒ void private
Methods inherited from AbstractCoreTap
#formula_file_to_name, #implicitly_trusted?, instance, #should_report_analytics?
Methods inherited from Tap
#alias_files, #alias_reverse_table, #aliases, all, #allow_bump?, #allowed_by_env?, allowed_taps, #apply_redirected_remote!, #audit_exception, #cask_dir, #cask_file?, #cask_files, #cask_files_by_name, #cask_renames, #cask_reverse_renames, #cask_tokens, #clear_cache, #command_dir, #command_files, #config, #contents, #core_cask_tap?, core_taps, #custom_remote?, #default_remote, #disabled_new_usr_local_relocation_formulae, each, fetch, #fix_remote_configuration, #forbidden_by_env?, forbidden_taps, #formula_file?, #formula_file_to_name, #formula_reverse_renames, from_path, #git?, #git_branch, #git_head, #git_last_commit, #implicitly_trusted?, installed, #installed?, #issues_url, #link_completions_and_manpages, #matches_reference?, #new_cask_path, normalize_remote, #official?, #potential_formula_dirs, #prefix_to_versioned_formulae_names, #private?, #reference, #relative_cask_path, remote_reference?, #remote_repository, remote_to_reference, #repository_var_suffix, #reverse_tap_migrations_renames, same_remote?, #shallow?, #should_report_analytics?, tap_list_references, tap_migration_oldnames, #to_hash, untapped_official_taps, #update_remote_from_git_redirect!, #uses_custom_remote?, with_cask_token, with_formula_name, #worktree_source_tap_path_for
Methods included from Enumerable
Methods included from Cachable
Methods included from Utils::Output::Mixin
#issue_reporting_message, #odebug, #odeprecated, #odie, #odisabled, #ofail, #oh1, #oh1_title, #ohai, #ohai_title, #onoe, #opoo, #opoo_outside_github_actions, #opoo_without_github_actions_annotation, #pretty_deprecated, #pretty_disabled, #pretty_duration, #pretty_install_status, #pretty_installed, #pretty_uninstalled, #pretty_upgradable
Constructor Details
#initialize ⇒ 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.
12 13 14 |
# File 'tap/core_tap.rb', line 12 def initialize super "Homebrew", "core" end |
Instance Method Details
#alias_dir ⇒ 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.
100 101 102 103 104 105 |
# File 'tap/core_tap.rb', line 100 def alias_dir @alias_dir ||= T.let(begin ensure_installed! super end, T.nilable(Pathname)) end |
#alias_file_to_name(file) ⇒ 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.
166 167 168 |
# File 'tap/core_tap.rb', line 166 def alias_file_to_name(file) file.basename.to_s end |
#alias_table ⇒ Hash{String => 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.
171 172 173 174 175 176 177 178 179 180 |
# File 'tap/core_tap.rb', line 171 def alias_table @alias_table ||= T.let( if Homebrew::EnvConfig.no_install_from_api? super else Homebrew::API.formula_aliases end, T.nilable(T::Hash[String, String]), ) end |
#audit_exceptions ⇒ Hash{Symbol => 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.
142 143 144 145 146 147 |
# File 'tap/core_tap.rb', line 142 def audit_exceptions @audit_exceptions ||= T.let(begin ensure_installed! super end, T.nilable(T::Hash[Symbol, T.untyped])) end |
#autobump ⇒ 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 |
# File 'tap/core_tap.rb', line 134 def autobump @autobump ||= T.let(begin ensure_installed! super end, T.nilable(T::Array[String])) end |
#canonical_remote?(remote = self.remote) ⇒ 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.
The configured HOMEBREW_CORE_GIT_REMOTE is the official remote for this tap.
32 33 34 |
# File 'tap/core_tap.rb', line 32 def canonical_remote?(remote = self.remote) remote.blank? || self.class.same_remote?(remote, Homebrew::EnvConfig.core_git_remote) end |
#core_tap? ⇒ 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.
64 65 66 |
# File 'tap/core_tap.rb', line 64 def core_tap? true end |
#ensure_installed! ⇒ 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.
17 18 19 20 21 |
# File 'tap/core_tap.rb', line 17 def ensure_installed! return if ENV["HOMEBREW_TESTS"] super end |
#formula_dir ⇒ 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.
74 75 76 77 78 79 |
# File 'tap/core_tap.rb', line 74 def formula_dir @formula_dir ||= T.let(begin ensure_installed! super end, T.nilable(Pathname)) end |
#formula_files ⇒ Array<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.
183 184 185 186 187 |
# File 'tap/core_tap.rb', line 183 def formula_files return super if Homebrew::EnvConfig.no_install_from_api? formula_files_by_name.values end |
#formula_files_by_name ⇒ Hash{String => 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.
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
# File 'tap/core_tap.rb', line 197 def formula_files_by_name return super if Homebrew::EnvConfig.no_install_from_api? @formula_files_by_name ||= T.let( begin formula_directory_path = formula_dir.to_s Homebrew::API.formula_names.each_with_object({}) do |name, hash| # If there's more than one item with the same path: use the longer one to prioritise more specific results. existing_path = hash[name] # Pathname equivalent is slow in a tight loop new_path = File.join(formula_directory_path, new_formula_subdirectory(name), "#{name.downcase}.rb") hash[name] = Pathname(new_path) if existing_path.nil? || existing_path.to_s.length < new_path.length end end, T.nilable(T::Hash[String, Pathname]), ) end |
#formula_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.
190 191 192 193 194 |
# File 'tap/core_tap.rb', line 190 def formula_names return super if Homebrew::EnvConfig.no_install_from_api? Homebrew::API.formula_names end |
#formula_renames ⇒ Hash{String => 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.
108 109 110 111 112 113 114 115 116 117 118 |
# File 'tap/core_tap.rb', line 108 def formula_renames @formula_renames ||= T.let( if Homebrew::EnvConfig.no_install_from_api? ensure_installed! super else Homebrew::API.formula_renames end, T.nilable(T::Hash[String, String]), ) end |
#install(quiet: false, clone_target: nil, custom_remote: false, verify: false, force: false) ⇒ 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.
CoreTap never allows shallow clones (on request from GitHub).
41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'tap/core_tap.rb', line 41 def install(quiet: false, clone_target: nil, custom_remote: false, verify: false, force: false) remote = Homebrew::EnvConfig.core_git_remote # set by HOMEBREW_CORE_GIT_REMOTE requested_remote = clone_target || remote # The remote will changed again on `brew update` since remotes for homebrew/core are mismatched raise TapCoreRemoteMismatchError.new(name, remote, requested_remote) if requested_remote != remote if remote != default_remote $stderr.puts "HOMEBREW_CORE_GIT_REMOTE set: using #{remote} as the Homebrew/homebrew-core Git remote." end super(quiet:, clone_target: remote, custom_remote:, force:) end |
#linuxbrew_core? ⇒ 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.
69 70 71 |
# File 'tap/core_tap.rb', line 69 def linuxbrew_core? remote_repository.to_s.end_with?("/linuxbrew-core") || remote_repository == "Linuxbrew/homebrew-core" end |
#new_formula_path(name) ⇒ 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.
91 92 93 94 95 96 97 |
# File 'tap/core_tap.rb', line 91 def new_formula_path(name) formula_subdir = new_formula_subdirectory(name) return super unless (formula_dir/formula_subdir).directory? formula_dir/formula_subdir/"#{name.downcase}.rb" end |
#new_formula_subdirectory(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.
82 83 84 85 86 87 88 |
# File 'tap/core_tap.rb', line 82 def new_formula_subdirectory(name) if name.start_with?("lib") "lib" else name[0].to_s end end |
#remote ⇒ 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.
24 25 26 27 28 |
# File 'tap/core_tap.rb', line 24 def remote return super if Homebrew::EnvConfig.no_install_from_api? Homebrew::EnvConfig.core_git_remote end |
#style_exceptions ⇒ Hash{Symbol => 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.
150 151 152 153 154 155 |
# File 'tap/core_tap.rb', line 150 def style_exceptions @style_exceptions ||= T.let(begin ensure_installed! super end, T.nilable(T::Hash[Symbol, T.untyped])) end |
#synced_versions_formulae ⇒ Array<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.
158 159 160 161 162 163 |
# File 'tap/core_tap.rb', line 158 def synced_versions_formulae @synced_versions_formulae ||= T.let(begin ensure_installed! super end, T.nilable(T::Array[T::Array[String]])) end |
#tap_migrations ⇒ Hash{String => 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.
121 122 123 124 125 126 127 128 129 130 131 |
# File 'tap/core_tap.rb', line 121 def tap_migrations @tap_migrations ||= T.let( if Homebrew::EnvConfig.no_install_from_api? ensure_installed! super else Homebrew::API.formula_tap_migrations end, T.nilable(T::Hash[String, T.untyped]), ) end |
#uninstall(manual: false) ⇒ 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.
57 58 59 60 61 |
# File 'tap/core_tap.rb', line 57 def uninstall(manual: false) raise "Tap#uninstall is not available for CoreTap" if Homebrew::EnvConfig.no_install_from_api? super end |