Module: Homebrew::API::Internal Private
- Extended by:
- Cachable
- Defined in:
- api/internal.rb
Overview
This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.
Helper functions for using the JSON internal API.
Class Method Summary collapse
- .cached_cask_json_file_path ⇒ Pathname private
- .cached_formula_json_file_path ⇒ Pathname private
- .cask_endpoint ⇒ String private
- .cask_hashes ⇒ Hash{String => Hash{String => T.untyped}} private
- .cask_renames ⇒ Hash{String => String} private
- .cask_tap_migrations ⇒ Hash{String => String} private
- .fetch_cask_api!(download_queue: nil, stale_seconds: nil) ⇒ Array<(Hash{String => T.untyped}, Boolean)> private
- .fetch_formula_api!(download_queue: nil, stale_seconds: nil) ⇒ Array<(Hash{String => T.untyped}, Boolean)> private
- .formula_aliases ⇒ Hash{String => String} private
- .formula_endpoint ⇒ String private
- .formula_hashes ⇒ Hash{String => Hash{String => T.untyped}} private
- .formula_renames ⇒ Hash{String => String} private
- .formula_struct(name) ⇒ Homebrew::API::FormulaStruct private
- .formula_tap_git_head ⇒ String private
- .formula_tap_migrations ⇒ Hash{String => String} private
- .write_cask_names(regenerate: false) ⇒ void private
- .write_formula_names_and_aliases(regenerate: false) ⇒ void private
Methods included from Cachable
Class Method Details
.cached_cask_json_file_path ⇒ 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.
48 49 50 |
# File 'api/internal.rb', line 48 def self.cached_cask_json_file_path HOMEBREW_CACHE_API/cask_endpoint end |
.cached_formula_json_file_path ⇒ 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.
43 44 45 |
# File 'api/internal.rb', line 43 def self.cached_formula_json_file_path HOMEBREW_CACHE_API/formula_endpoint end |
.cask_endpoint ⇒ 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.
23 24 25 |
# File 'api/internal.rb', line 23 def self.cask_endpoint "internal/cask.#{SimulateSystem.current_tag}.jws.json" end |
.cask_hashes ⇒ Hash{String => 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.
162 163 164 165 166 167 168 169 |
# File 'api/internal.rb', line 162 def self.cask_hashes unless cache.key?("cask_hashes") updated = download_and_cache_cask_data! write_cask_names(regenerate: updated) end cache["cask_hashes"] end |
.cask_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.
172 173 174 175 176 177 178 179 |
# File 'api/internal.rb', line 172 def self.cask_renames unless cache.key?("cask_renames") updated = download_and_cache_cask_data! write_cask_names(regenerate: updated) end cache["cask_renames"] end |
.cask_tap_migrations ⇒ 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.
182 183 184 185 186 187 188 189 |
# File 'api/internal.rb', line 182 def self.cask_tap_migrations unless cache.key?("cask_tap_migrations") updated = download_and_cache_cask_data! write_cask_names(regenerate: updated) end cache["cask_tap_migrations"] end |
.fetch_cask_api!(download_queue: nil, stale_seconds: nil) ⇒ Array<(Hash{String => T.untyped}, 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.
65 66 67 68 |
# File 'api/internal.rb', line 65 def self.fetch_cask_api!(download_queue: nil, stale_seconds: nil) json_contents, updated = Homebrew::API.fetch_json_api_file(cask_endpoint, stale_seconds:, download_queue:) [T.cast(json_contents, T::Hash[String, T.untyped]), updated] end |
.fetch_formula_api!(download_queue: nil, stale_seconds: nil) ⇒ Array<(Hash{String => T.untyped}, 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.
56 57 58 59 |
# File 'api/internal.rb', line 56 def self.fetch_formula_api!(download_queue: nil, stale_seconds: nil) json_contents, updated = Homebrew::API.fetch_json_api_file(formula_endpoint, stale_seconds:, download_queue:) [T.cast(json_contents, T::Hash[String, T.untyped]), updated] end |
.formula_aliases ⇒ 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.
122 123 124 125 126 127 128 129 |
# File 'api/internal.rb', line 122 def self.formula_aliases unless cache.key?("formula_aliases") updated = download_and_cache_formula_data! write_formula_names_and_aliases(regenerate: updated) end cache["formula_aliases"] end |
.formula_endpoint ⇒ 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.
18 19 20 |
# File 'api/internal.rb', line 18 def self.formula_endpoint "internal/formula.#{SimulateSystem.current_tag}.jws.json" end |
.formula_hashes ⇒ Hash{String => 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.
112 113 114 115 116 117 118 119 |
# File 'api/internal.rb', line 112 def self.formula_hashes unless cache.key?("formula_hashes") updated = download_and_cache_formula_data! write_formula_names_and_aliases(regenerate: updated) end cache["formula_hashes"] 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.
132 133 134 135 136 137 138 139 |
# File 'api/internal.rb', line 132 def self.formula_renames unless cache.key?("formula_renames") updated = download_and_cache_formula_data! write_formula_names_and_aliases(regenerate: updated) end cache["formula_renames"] end |
.formula_struct(name) ⇒ Homebrew::API::FormulaStruct
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.
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'api/internal.rb', line 28 def self.formula_struct(name) return cache["formula_structs"][name] if cache.key?("formula_structs") && cache["formula_structs"].key?(name) hash = formula_hashes[name] raise "No formula found for #{name}" unless hash struct = Homebrew::API::FormulaStruct.deserialize(hash, bottle_tag: SimulateSystem.current_tag) cache["formula_structs"] ||= {} cache["formula_structs"][name] = struct struct end |
.formula_tap_git_head ⇒ 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.
152 153 154 155 156 157 158 159 |
# File 'api/internal.rb', line 152 def self.formula_tap_git_head unless cache.key?("formula_tap_git_head") updated = download_and_cache_formula_data! write_formula_names_and_aliases(regenerate: updated) end cache["formula_tap_git_head"] end |
.formula_tap_migrations ⇒ 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.
142 143 144 145 146 147 148 149 |
# File 'api/internal.rb', line 142 def self.formula_tap_migrations unless cache.key?("formula_tap_migrations") updated = download_and_cache_formula_data! write_formula_names_and_aliases(regenerate: updated) end cache["formula_tap_migrations"] end |
.write_cask_names(regenerate: 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.
105 106 107 108 109 |
# File 'api/internal.rb', line 105 def self.write_cask_names(regenerate: false) download_and_cache_cask_data! unless cache.key?("cask_hashes") Homebrew::API.write_names_file!(cask_hashes.keys, "cask", regenerate:) end |
.write_formula_names_and_aliases(regenerate: 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.
97 98 99 100 101 102 |
# File 'api/internal.rb', line 97 def self.write_formula_names_and_aliases(regenerate: false) download_and_cache_formula_data! unless cache.key?("formula_hashes") Homebrew::API.write_names_file!(formula_hashes.keys, "formula", regenerate:) Homebrew::API.write_aliases_file!(formula_aliases, "formula", regenerate:) end |