Module: Homebrew::API::Cask Private
- Extended by:
- Cachable, T::Generic
- Defined in:
- api/cask.rb,
api/cask/cask_struct_generator.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 cask JSON API.
Defined Under Namespace
Modules: CaskStructGenerator
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_template { { fixed: T::Hash[String, T.untyped] } }
- DEFAULT_API_FILENAME =
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.
"cask.jws.json"
Class Method Summary collapse
- .all_casks ⇒ Hash{String => Hash{String => T.untyped}} private
- .cached_json_file_path ⇒ Pathname private
- .fetch_api!(download_queue: nil, stale_seconds: nil, enqueue: false) ⇒ Array<([Array<T.untyped>, Hash{String => T.untyped}], Boolean)> private
- .fetch_tap_migrations!(download_queue: nil, stale_seconds: nil, enqueue: false) ⇒ Array<([Array<T.untyped>, Hash{String => T.untyped}], Boolean)> private
- .tap_migrations ⇒ Hash{String => T.untyped} private
- .write_names(regenerate: false) ⇒ void private
Methods included from Cachable
Class Method Details
.all_casks ⇒ 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.
62 63 64 65 66 67 68 69 |
# File 'api/cask.rb', line 62 def self.all_casks unless cache.key?("casks") json_updated = download_and_cache_data! write_names(regenerate: json_updated) end cache.fetch("casks") end |
.cached_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.
22 23 24 |
# File 'api/cask.rb', line 22 def self.cached_json_file_path HOMEBREW_CACHE_API/DEFAULT_API_FILENAME end |
.fetch_api!(download_queue: nil, stale_seconds: nil, enqueue: false) ⇒ Array<([Array<T.untyped>, 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.
30 31 32 |
# File 'api/cask.rb', line 30 def self.fetch_api!(download_queue: nil, stale_seconds: nil, enqueue: false) Homebrew::API.fetch_json_api_file DEFAULT_API_FILENAME, stale_seconds:, download_queue:, enqueue: end |
.fetch_tap_migrations!(download_queue: nil, stale_seconds: nil, enqueue: false) ⇒ Array<([Array<T.untyped>, 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.
38 39 40 |
# File 'api/cask.rb', line 38 def self.fetch_tap_migrations!(download_queue: nil, stale_seconds: nil, enqueue: false) Homebrew::API.fetch_json_api_file "cask_tap_migrations.jws.json", stale_seconds:, download_queue:, enqueue: 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.
72 73 74 75 76 77 78 79 |
# File 'api/cask.rb', line 72 def self.tap_migrations unless cache.key?("tap_migrations") json_migrations, = fetch_tap_migrations! cache["tap_migrations"] = json_migrations end cache.fetch("tap_migrations") end |
.write_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.
82 83 84 85 86 |
# File 'api/cask.rb', line 82 def self.write_names(regenerate: false) download_and_cache_data! unless cache.key?("casks") Homebrew::API.write_names_file!("cask", regenerate:) { all_casks.keys } end |