Class: Homebrew::API::CaskStruct Private
- Defined in:
- api/cask_struct.rb,
sorbet/rbi/dsl/homebrew/api/cask_struct.rbi
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
- PREDICATES =
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.
[ :auto_updates, :caveats, :conflicts, :container, :depends_on, :deprecate, :desc, :disable, :homepage, ].freeze
- EMPTY_BLOCK =
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.
T.let(-> {}.freeze, T.proc.void)
- EMPTY_BLOCK_PLACEHOLDER =
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.
:empty_block- ArtifactArgs =
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.
T.type_alias do [ Symbol, T::Array[T.anything], T::Hash[Symbol, T.anything], T.nilable(T.proc.void), ] end
- DependsOnArgs =
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.
T.type_alias do T::Hash[ # Keys are dependency types like :macos, :arch, :cask, :formula Symbol, # Values can be any of: T.any( # Strings like ">= :catalina" for :macos String, # Symbols like :intel or :arm64 for :arch Symbol, # Array of strings or symbols for :cask and :formula T::Array[T.any(String, Symbol)], ), ] end
Instance Attribute Summary collapse
-
#auto_updates ⇒ Boolean
readonly
private
Changes to this struct must be mirrored in Homebrew::API::Cask.generate_cask_struct_hash.
-
#conflicts_with_args ⇒ Hash{Symbol => Array<String>}
readonly
private
Returns the value of prop
conflicts_with_args. -
#container_args ⇒ Hash{Symbol => Symbol, T.anything}
readonly
private
Returns the value of prop
container_args. -
#depends_on_args ⇒ DependsOnArgs
readonly
private
Returns the value of prop
depends_on_args. -
#deprecate_args ⇒ Hash{Symbol => String, Symbol, nil}
readonly
private
Returns the value of prop
deprecate_args. -
#desc ⇒ String?
readonly
private
Returns the value of prop
desc. -
#disable_args ⇒ Hash{Symbol => String, Symbol, nil}
readonly
private
Returns the value of prop
disable_args. -
#homepage ⇒ String?
readonly
private
Returns the value of prop
homepage. -
#languages ⇒ Array<String>
readonly
private
Returns the value of prop
languages. -
#names ⇒ Array<String>
readonly
private
Returns the value of prop
names. -
#raw_artifacts ⇒ Array<ArtifactArgs>
readonly
private
Returns the value of prop
raw_artifacts. -
#raw_caveats ⇒ String?
readonly
private
Returns the value of prop
raw_caveats. -
#renames ⇒ Array<Array<(String, String)>>
readonly
private
Returns the value of prop
renames. -
#ruby_source_checksum ⇒ Hash{Symbol => String, nil}
readonly
private
Returns the value of prop
ruby_source_checksum. -
#ruby_source_path ⇒ String?
readonly
private
Returns the value of prop
ruby_source_path. -
#sha256 ⇒ String, Symbol
readonly
private
Returns the value of prop
sha256. -
#tap_string ⇒ String?
readonly
private
Returns the value of prop
tap_string. -
#url_args ⇒ Array<String>
readonly
private
Returns the value of prop
url_args. -
#url_kwargs ⇒ Hash{Symbol => T.anything}
readonly
private
Returns the value of prop
url_kwargs. -
#version ⇒ String, Symbol
readonly
private
Returns the value of prop
version.
Class Method Summary collapse
- .deserialize(hash) ⇒ CaskStruct private
-
.deserialize_artifact_args(args) ⇒ ArtifactArgs
private
Format artifact args pairs into proper [key, args, kwargs, block] format since serialization removed blanks.
- .from_hash(cask_hash, ignore_types: false) ⇒ CaskStruct private
Instance Method Summary collapse
- #artifacts(appdir:) ⇒ Array<ArtifactArgs> private
- #auto_updates? ⇒ Boolean private
- #caveats(appdir:) ⇒ String? private
- #caveats? ⇒ Boolean private
- #conflicts? ⇒ Boolean private
- #container? ⇒ Boolean private
- #depends_on? ⇒ Boolean private
- #deprecate? ⇒ Boolean private
- #desc? ⇒ Boolean private
- #disable? ⇒ Boolean private
- #homepage? ⇒ Boolean private
- #initialize(auto_updates: false, conflicts_with_args: {}, container_args: {}, depends_on_args: {}, deprecate_args: {}, desc: nil, disable_args: {}, homepage: nil, languages: [], names: [], renames: [], ruby_source_checksum: { sha256: nil }, ruby_source_path: nil, sha256:, tap_string: nil, url_args: [], url_kwargs: {}, version:, raw_artifacts: [], raw_caveats: nil) ⇒ void constructor
- #serialize ⇒ Hash{String => T.untyped} private
- #serialize_artifact_args(artifact) ⇒ Array<T.untyped> private
Constructor Details
#initialize(auto_updates: false, conflicts_with_args: {}, container_args: {}, depends_on_args: {}, deprecate_args: {}, desc: nil, disable_args: {}, homepage: nil, languages: [], names: [], renames: [], ruby_source_checksum: { sha256: nil }, ruby_source_path: nil, sha256:, tap_string: nil, url_args: [], url_kwargs: {}, version:, raw_artifacts: [], raw_caveats: nil) ⇒ void
|
|
# File '' const :auto_updates, T::Boolean, default: false const :conflicts_with_args, T::Hash[Symbol, T::Array[String]], default: {} const :container_args, T::Hash[Symbol, T.any(Symbol, T.anything)], default: {} const :depends_on_args, DependsOnArgs, default: {} const :deprecate_args, T::Hash[Symbol, T.nilable(T.any(String, Symbol))], default: {} const :desc, T.nilable(String) const :disable_args, T::Hash[Symbol, T.nilable(T.any(String, Symbol))], default: {} const :homepage, T.nilable(String) const :languages, T::Array[String], default: [] const :names, T::Array[String], default: [] const :renames, T::Array[[String, String]], default: [] const :ruby_source_checksum, T::Hash[Symbol, T.nilable(String)], default: { sha256: nil } const :ruby_source_path, T.nilable(String) const :sha256, T.any(String, Symbol) const :tap_string, T.nilable(String) const :url_args, T::Array[String], default: [] const :url_kwargs, T::Hash[Symbol, T.anything], default: {} const :version, T.any(String, Symbol) const :raw_artifacts, T::Array[ArtifactArgs], default: [] const :raw_caveats, T.nilable(String) |
Instance Attribute Details
#auto_updates ⇒ Boolean (readonly)
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.
Changes to this struct must be mirrored in Homebrew::API::Cask.generate_cask_struct_hash
|
|
# File '' const :auto_updates, T::Boolean, default: false |
#conflicts_with_args ⇒ Hash{Symbol => Array<String>} (readonly)
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.
Returns the value of prop conflicts_with_args.
|
|
# File '' const :conflicts_with_args, T::Hash[Symbol, T::Array[String]], default: {} |
#container_args ⇒ Hash{Symbol => Symbol, T.anything} (readonly)
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.
Returns the value of prop container_args.
|
|
# File '' const :container_args, T::Hash[Symbol, T.any(Symbol, T.anything)], default: {} |
#depends_on_args ⇒ DependsOnArgs (readonly)
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.
Returns the value of prop depends_on_args.
|
|
# File '' const :depends_on_args, DependsOnArgs, default: {} |
#deprecate_args ⇒ Hash{Symbol => String, Symbol, nil} (readonly)
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.
Returns the value of prop deprecate_args.
|
|
# File '' const :deprecate_args, T::Hash[Symbol, T.nilable(T.any(String, Symbol))], default: {} |
#desc ⇒ String? (readonly)
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.
Returns the value of prop desc.
|
|
# File '' const :desc, T.nilable(String) |
#disable_args ⇒ Hash{Symbol => String, Symbol, nil} (readonly)
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.
Returns the value of prop disable_args.
|
|
# File '' const :disable_args, T::Hash[Symbol, T.nilable(T.any(String, Symbol))], default: {} |
#homepage ⇒ String? (readonly)
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.
Returns the value of prop homepage.
|
|
# File '' const :homepage, T.nilable(String) |
#languages ⇒ Array<String> (readonly)
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.
Returns the value of prop languages.
|
|
# File '' const :languages, T::Array[String], default: [] |
#names ⇒ Array<String> (readonly)
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.
Returns the value of prop names.
|
|
# File '' const :names, T::Array[String], default: [] |
#raw_artifacts ⇒ Array<ArtifactArgs> (readonly)
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.
Returns the value of prop raw_artifacts.
|
|
# File '' const :raw_artifacts, T::Array[ArtifactArgs], default: [] |
#raw_caveats ⇒ String? (readonly)
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.
Returns the value of prop raw_caveats.
|
|
# File '' const :raw_caveats, T.nilable(String) |
#renames ⇒ Array<Array<(String, String)>> (readonly)
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.
Returns the value of prop renames.
|
|
# File '' const :renames, T::Array[[String, String]], default: [] |
#ruby_source_checksum ⇒ Hash{Symbol => String, nil} (readonly)
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.
Returns the value of prop ruby_source_checksum.
|
|
# File '' const :ruby_source_checksum, T::Hash[Symbol, T.nilable(String)], default: { sha256: nil } |
#ruby_source_path ⇒ String? (readonly)
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.
Returns the value of prop ruby_source_path.
|
|
# File '' const :ruby_source_path, T.nilable(String) |
#sha256 ⇒ String, Symbol (readonly)
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.
Returns the value of prop sha256.
|
|
# File '' const :sha256, T.any(String, Symbol) |
#tap_string ⇒ String? (readonly)
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.
Returns the value of prop tap_string.
|
|
# File '' const :tap_string, T.nilable(String) |
#url_args ⇒ Array<String> (readonly)
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.
Returns the value of prop url_args.
|
|
# File '' const :url_args, T::Array[String], default: [] |
#url_kwargs ⇒ Hash{Symbol => T.anything} (readonly)
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.
Returns the value of prop url_kwargs.
|
|
# File '' const :url_kwargs, T::Hash[Symbol, T.anything], default: {} |
#version ⇒ String, Symbol (readonly)
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.
Returns the value of prop version.
|
|
# File '' const :version, T.any(String, Symbol) |
Class Method Details
.deserialize(hash) ⇒ CaskStruct
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.
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'api/cask_struct.rb', line 126 def self.deserialize(hash) hash = ::Utils.deep_unstringify_symbols(hash) PREDICATES.each do |name| source_value = case name when :auto_updates then hash["auto_updates"] when :caveats then hash["raw_caveats"] when :conflicts then hash["conflicts_with_args"] when :desc then hash["desc"] when :homepage then hash["homepage"] else hash["#{name}_args"] end hash["#{name}_present"] = source_value.present? end hash["raw_artifacts"] = if (raw_artifacts = hash["raw_artifacts"]) raw_artifacts.map { |artifact| deserialize_artifact_args(artifact) } end from_hash(hash) end |
.deserialize_artifact_args(args) ⇒ ArtifactArgs
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.
Format artifact args pairs into proper [key, args, kwargs, block] format since serialization removed blanks.
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'api/cask_struct.rb', line 174 def self.deserialize_artifact_args(args) case args in [key] then [key, [], {}, nil] in [key, Array => array] then [key, array, {}, nil] in [key, Hash => hash] then [key, [], hash, nil] in [key, EMPTY_BLOCK_PLACEHOLDER] then [key, [], {}, EMPTY_BLOCK] in [key, Array => array, Hash => hash] then [key, array, hash, nil] in [key, Array => array, EMPTY_BLOCK_PLACEHOLDER] then [key, array, {}, EMPTY_BLOCK] in [key, Hash => hash, EMPTY_BLOCK_PLACEHOLDER] then [key, [], hash, EMPTY_BLOCK] in [key, Array => array, Hash => hash, EMPTY_BLOCK_PLACEHOLDER] then [key, array, hash, EMPTY_BLOCK] else # The block argument should only ever be EMPTY_BLOCK_PLACEHOLDER or nil, so we should never reach this case. raise "Invalid artifact args: #{args.inspect}" end end |
.from_hash(cask_hash, ignore_types: false) ⇒ CaskStruct
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.
8 9 10 11 12 13 14 15 16 |
# File 'api/cask_struct.rb', line 8 def self.from_hash(cask_hash, ignore_types: false) return super(cask_hash) if ignore_types cask_hash = ::Cask::Cask.deep_remove_placeholders(cask_hash) cask_hash = cask_hash.transform_keys(&:to_sym) .slice(*decorator.all_props) .compact_blank new(**cask_hash) end |
Instance Method Details
#artifacts(appdir:) ⇒ Array<ArtifactArgs>
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 |
# File 'api/cask_struct.rb', line 100 def artifacts(appdir:) deep_remove_placeholders(raw_artifacts, appdir.to_s) end |
#auto_updates? ⇒ 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.
10 |
# File 'sorbet/rbi/dsl/homebrew/api/cask_struct.rbi', line 10 def auto_updates?; end |
#caveats(appdir:) ⇒ 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.
105 106 107 |
# File 'api/cask_struct.rb', line 105 def caveats(appdir:) deep_remove_placeholders(raw_caveats, appdir.to_s) end |
#caveats? ⇒ 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.
13 |
# File 'sorbet/rbi/dsl/homebrew/api/cask_struct.rbi', line 13 def caveats?; end |
#conflicts? ⇒ 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.
16 |
# File 'sorbet/rbi/dsl/homebrew/api/cask_struct.rbi', line 16 def conflicts?; end |
#container? ⇒ 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.
19 |
# File 'sorbet/rbi/dsl/homebrew/api/cask_struct.rbi', line 19 def container?; end |
#depends_on? ⇒ 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.
22 |
# File 'sorbet/rbi/dsl/homebrew/api/cask_struct.rbi', line 22 def depends_on?; end |
#deprecate? ⇒ 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.
25 |
# File 'sorbet/rbi/dsl/homebrew/api/cask_struct.rbi', line 25 def deprecate?; end |
#desc? ⇒ 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.
28 |
# File 'sorbet/rbi/dsl/homebrew/api/cask_struct.rbi', line 28 def desc?; end |
#disable? ⇒ 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.
31 |
# File 'sorbet/rbi/dsl/homebrew/api/cask_struct.rbi', line 31 def disable?; end |
#homepage? ⇒ 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.
34 |
# File 'sorbet/rbi/dsl/homebrew/api/cask_struct.rbi', line 34 def homepage?; end |
#serialize ⇒ 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.
110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'api/cask_struct.rb', line 110 def serialize hash = self.class.decorator.all_props.filter_map do |prop| next if PREDICATES.any? { |predicate| prop == :"#{predicate}_present" } [prop.to_s, send(prop)] end.to_h hash["raw_artifacts"] = raw_artifacts.map do |artifact| serialize_artifact_args(artifact) end hash = ::Utils.deep_stringify_symbols(hash) ::Utils.deep_compact_blank(hash) end |
#serialize_artifact_args(artifact) ⇒ Array<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 156 157 |
# File 'api/cask_struct.rb', line 150 def serialize_artifact_args(artifact) key, args, kwargs, block = artifact # We can't serialize Procs, so always use an empty block placeholder to be deserialized as `-> {}`. block = EMPTY_BLOCK_PLACEHOLDER unless block.nil? [key, args, kwargs, block] end |