Class: Cask::Cask Private
- Extended by:
- APIHashable, Attrable, Forwardable
- Includes:
- Metadata
- Defined in:
- cask/cask.rb,
cask/cask.rbi,
sorbet/rbi/parlour.rbi
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.
An instance of a cask.
Constant Summary
Constants included from Metadata
Metadata::METADATA_SUBDIR, Metadata::TIMESTAMP_FORMAT
Instance Attribute Summary collapse
-
#allow_reassignment ⇒ Object
private
-
#config ⇒ Object
internal
The configuration of this Cask.
-
#default_config ⇒ Object
readonly
private
-
#download ⇒ Object
private
-
#loader ⇒ Object
readonly
private
-
#source ⇒ Object
readonly
private
-
#sourcefile_path ⇒ Object
readonly
private
-
#token ⇒ Object
readonly
internal
The token of this Cask.
Class Method Summary collapse
-
.all(eval_all: false) ⇒ Object
private
Instance Method Summary collapse
-
#appcast ⇒ Object
private
-
#appdir ⇒ Object
private
-
#artifacts ⇒ Object
private
-
#auto_updates ⇒ Object
private
-
#bundle_long_version ⇒ String?
private
-
#bundle_short_version ⇒ String?
private
-
#caskfile_only? ⇒ Boolean
private
The caskfile is needed during installation when there are
*flight
blocks or the cask has multiple languages. -
#caskroom_path ⇒ Pathname
private
-
#caveats ⇒ Object
private
-
#checksumable? ⇒ Boolean
private
-
#config_path ⇒ Object
private
-
#conflicts_with ⇒ Object
private
-
#container ⇒ Object
private
-
#depends_on ⇒ Object
private
-
#deprecated? ⇒ Boolean
private
-
#deprecation_date ⇒ Object
private
-
#deprecation_reason ⇒ Object
private
-
#desc ⇒ Object
private
-
#disable_date ⇒ Object
private
-
#disable_reason ⇒ Object
private
-
#disabled? ⇒ Boolean
private
-
#discontinued? ⇒ Boolean
private
-
#download_sha_path ⇒ Object
private
-
#eql?(other) ⇒ Boolean
(also: #==)
private
-
#full_name ⇒ Object
internal
Alias for #full_token.
-
#full_token ⇒ Object
internal
The fully-qualified token of this Cask.
-
#hash ⇒ Object
private
-
#homepage ⇒ Object
private
-
#initialize(token, sourcefile_path: nil, source: nil, tap: nil, loaded_from_api: false, config: nil, allow_reassignment: false, loader: nil, &block) ⇒ void
constructor
private
-
#install_time ⇒ Time?
private
-
#installed? ⇒ Boolean
private
-
#installed_caskfile ⇒ Pathname?
private
-
#installed_version ⇒ String?
private
-
#language ⇒ Object
private
-
#languages ⇒ Object
private
-
#livecheck ⇒ Object
private
-
#livecheckable? ⇒ Boolean
private
-
#loaded_from_api? ⇒ Boolean
private
-
#name ⇒ Object
private
-
#new_download_sha ⇒ Object
private
-
#old_tokens ⇒ Array<String>
private
An old name for the cask.
-
#on_system_blocks_exist? ⇒ Boolean
private
-
#outdated?(greedy: false, greedy_latest: false, greedy_auto_updates: false) ⇒ Boolean
internal
Check if the installed cask is outdated.
-
#outdated_download_sha? ⇒ Boolean
private
-
#outdated_info(greedy, verbose, json, greedy_latest, greedy_auto_updates) ⇒ Object
private
-
#outdated_version(greedy: false, greedy_latest: false, greedy_auto_updates: false) ⇒ Object
private
-
#populate_from_api!(json_cask) ⇒ Object
private
-
#refresh ⇒ Object
private
-
#ruby_source_checksum ⇒ Hash{Symbol => String}
private
-
#ruby_source_path ⇒ Object
private
-
#sha256 ⇒ Object
private
-
#staged_path ⇒ Object
private
-
#tap ⇒ Object
private
-
#tap_git_head ⇒ Object
private
-
#timestamped_versions(caskroom_path: self.caskroom_path) ⇒ Array<Array(String, String)>
private
-
#to_h ⇒ Object
private
-
#to_hash_with_variations(hash_method: :to_h) ⇒ Object
private
-
#to_internal_api_hash ⇒ Object
private
-
#url ⇒ Object
private
-
#version ⇒ Object
private
Methods included from Attrable
Methods included from APIHashable
generated_hash!, generating_hash!, generating_hash?
Methods included from Metadata
#metadata_main_container_path, #metadata_subdir, #metadata_timestamped_path, #metadata_versioned_path
Constructor Details
#initialize(token, sourcefile_path: nil, source: nil, tap: nil, loaded_from_api: false, config: nil, allow_reassignment: false, loader: nil, &block) ⇒ 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.
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'cask/cask.rb', line 72 def initialize(token, sourcefile_path: nil, source: nil, tap: nil, loaded_from_api: false, config: nil, allow_reassignment: false, loader: nil, &block) @token = token @sourcefile_path = sourcefile_path @source = source @tap = tap @allow_reassignment = allow_reassignment @loaded_from_api = loaded_from_api @loader = loader # Sorbet has trouble with bound procs assigned to ivars: https://github.com/sorbet/sorbet/issues/6843 instance_variable_set(:@block, block) @default_config = config || Config.new self.config = if config_path.exist? Config.from_json(File.read(config_path), ignore_invalid_keys: true) else @default_config end end |
Instance Attribute Details
#allow_reassignment ⇒ Object
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.
32 33 34 |
# File 'cask/cask.rb', line 32 def allow_reassignment @allow_reassignment end |
#config ⇒ Object
This method is part of an internal API. This method may only be used internally in repositories owned by Homebrew, except in casks or formulae. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
The configuration of this Cask::Cask.
29 30 31 |
# File 'cask/cask.rb', line 29 def config @config end |
#default_config ⇒ Object (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.
31 32 33 |
# File 'cask/cask.rb', line 31 def default_config @default_config end |
#download ⇒ Object
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.
32 33 34 |
# File 'cask/cask.rb', line 32 def download @download end |
#loader ⇒ Object (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.
31 32 33 |
# File 'cask/cask.rb', line 31 def loader @loader end |
#source ⇒ Object (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.
31 32 33 |
# File 'cask/cask.rb', line 31 def source @source end |
#sourcefile_path ⇒ Object (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.
31 32 33 |
# File 'cask/cask.rb', line 31 def sourcefile_path @sourcefile_path end |
#token ⇒ Object (readonly)
This method is part of an internal API. This method may only be used internally in repositories owned by Homebrew, except in casks or formulae. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
The token of this Cask::Cask.
24 25 26 |
# File 'cask/cask.rb', line 24 def token @token end |
Class Method Details
.all(eval_all: false) ⇒ Object
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.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'cask/cask.rb', line 36 def self.all(eval_all: false) if !eval_all && !Homebrew::EnvConfig.eval_all? raise ArgumentError, "Cask::Cask#all cannot be used without `--eval-all` or HOMEBREW_EVAL_ALL" end # Load core casks from tokens so they load from the API when the core cask is not tapped. tokens_and_files = CoreCaskTap.instance.cask_tokens tokens_and_files += Tap.reject(&:core_cask_tap?).flat_map(&:cask_files) tokens_and_files.filter_map do |token_or_file| CaskLoader.load(token_or_file) rescue CaskUnreadableError => e opoo e. nil end end |
Instance Method Details
#appcast ⇒ Object
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.
5 |
# File 'cask/cask.rbi', line 5 def appcast; end |
#appdir ⇒ Object
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.
7 |
# File 'cask/cask.rbi', line 7 def appdir; end |
#artifacts ⇒ Object
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.
9 |
# File 'cask/cask.rbi', line 9 def artifacts; end |
#auto_updates ⇒ Object
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.
11 |
# File 'cask/cask.rbi', line 11 def auto_updates; end |
#bundle_long_version ⇒ 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.
207 208 209 |
# File 'cask/cask.rb', line 207 def bundle_long_version bundle_version&.version end |
#bundle_short_version ⇒ 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.
202 203 204 |
# File 'cask/cask.rb', line 202 def bundle_short_version bundle_version&.short_version end |
#caskfile_only? ⇒ 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 caskfile is needed during installation when there are
*flight
blocks or the cask has multiple languages
156 157 158 |
# File 'cask/cask.rb', line 156 def caskfile_only? languages.any? || artifacts.any?(Artifact::AbstractFlightBlock) end |
#caskroom_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.
240 241 242 |
# File 'cask/cask.rb', line 240 def caskroom_path @caskroom_path ||= Caskroom.path.join(token) end |
#caveats ⇒ Object
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 'cask/cask.rbi', line 13 def caveats; end |
#checksumable? ⇒ 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.
215 216 217 |
# File 'cask/cask.rb', line 215 def checksumable? DownloadStrategyDetector.detect(url.to_s, url.using) <= AbstractFileDownloadStrategy end |
#config_path ⇒ Object
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.
211 212 213 |
# File 'cask/cask.rb', line 211 def config_path /"config.json" end |
#conflicts_with ⇒ Object
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.
15 |
# File 'cask/cask.rbi', line 15 def conflicts_with; end |
#container ⇒ Object
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.
17 |
# File 'cask/cask.rbi', line 17 def container; end |
#depends_on ⇒ Object
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 'cask/cask.rbi', line 19 def depends_on; end |
#deprecated? ⇒ 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 'cask/cask.rbi', line 25 def deprecated?; end |
#deprecation_date ⇒ Object
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.
27 |
# File 'cask/cask.rbi', line 27 def deprecation_date; end |
#deprecation_reason ⇒ Object
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.
29 |
# File 'cask/cask.rbi', line 29 def deprecation_reason; end |
#desc ⇒ Object
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 |
# File 'cask/cask.rbi', line 21 def desc; end |
#disable_date ⇒ Object
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.
33 |
# File 'cask/cask.rbi', line 33 def disable_date; end |
#disable_reason ⇒ Object
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.
35 |
# File 'cask/cask.rbi', line 35 def disable_reason; end |
#disabled? ⇒ 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 'cask/cask.rbi', line 31 def disabled?; end |
#discontinued? ⇒ 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.
23 |
# File 'cask/cask.rbi', line 23 def discontinued?; end |
#download_sha_path ⇒ Object
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.
219 220 221 |
# File 'cask/cask.rb', line 219 def download_sha_path /"LATEST_DOWNLOAD_SHA256" end |
#eql?(other) ⇒ Boolean Also known as: ==
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.
340 341 342 |
# File 'cask/cask.rb', line 340 def eql?(other) instance_of?(other.class) && token == other.token end |
#full_name ⇒ Object
This method is part of an internal API. This method may only be used internally in repositories owned by Homebrew, except in casks or formulae. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Alias for #full_token.
147 |
# File 'cask/cask.rb', line 147 def full_name = full_token |
#full_token ⇒ Object
This method is part of an internal API. This method may only be used internally in repositories owned by Homebrew, except in casks or formulae. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
The fully-qualified token of this Cask::Cask.
137 138 139 140 141 142 |
# File 'cask/cask.rb', line 137 def full_token return token if tap.nil? return token if tap.core_cask_tap? "#{tap.name}/#{token}" end |
#hash ⇒ Object
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.
336 337 338 |
# File 'cask/cask.rb', line 336 def hash token.hash end |
#homepage ⇒ Object
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.
37 |
# File 'cask/cask.rbi', line 37 def homepage; end |
#install_time ⇒ Time?
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.
161 162 163 164 165 |
# File 'cask/cask.rb', line 161 def install_time # <caskroom_path>/.metadata/<version>/<timestamp>/Casks/<token>.{rb,json} -> <timestamp> time = installed_caskfile&.dirname&.dirname&.basename&.to_s Time.strptime(time, Metadata::TIMESTAMP_FORMAT) if time end |
#installed? ⇒ 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.
150 151 152 |
# File 'cask/cask.rb', line 150 def installed? installed_caskfile&.exist? || false end |
#installed_caskfile ⇒ 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.
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 |
# File 'cask/cask.rb', line 168 def installed_caskfile installed_caskroom_path = caskroom_path installed_token = token # Check if the cask is installed with an old name. old_tokens.each do |old_token| old_caskroom_path = Caskroom.path/old_token next if !old_caskroom_path.directory? || old_caskroom_path.symlink? installed_caskroom_path = old_caskroom_path installed_token = old_token break end installed_version = (caskroom_path: installed_caskroom_path).last return unless installed_version caskfile_dir = (caskroom_path: installed_caskroom_path) .join(*installed_version, "Casks") ["json", "rb"] .map { |ext| caskfile_dir.join("#{installed_token}.#{ext}") } .find(&:exist?) end |
#installed_version ⇒ 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.
194 195 196 197 198 199 |
# File 'cask/cask.rb', line 194 def installed_version return unless (installed_caskfile = self.installed_caskfile) # <caskroom_path>/.metadata/<version>/<timestamp>/Casks/<token>.{rb,json} -> <version> installed_caskfile.dirname.dirname.dirname.basename.to_s end |
#language ⇒ Object
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.
39 |
# File 'cask/cask.rbi', line 39 def language; end |
#languages ⇒ Object
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.
303 304 305 |
# File 'cask/cask.rb', line 303 def languages @languages ||= @dsl.languages end |
#livecheck ⇒ Object
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 |
# File 'cask/cask.rbi', line 43 def livecheck; end |
#livecheckable? ⇒ 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.
45 |
# File 'cask/cask.rbi', line 45 def livecheckable?; end |
#loaded_from_api? ⇒ 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.
325 |
# File 'sorbet/rbi/parlour.rbi', line 325 def loaded_from_api?; end |
#name ⇒ Object
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.
47 |
# File 'cask/cask.rbi', line 47 def name; end |
#new_download_sha ⇒ Object
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.
223 224 225 226 227 228 229 230 |
# File 'cask/cask.rb', line 223 def new_download_sha require "cask/installer" # Call checksumable? before hashing @new_download_sha ||= Installer.new(self, verify_download_integrity: false) .download(quiet: true) .instance_eval { |x| Digest::SHA256.file(x).hexdigest } end |
#old_tokens ⇒ 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.
An old name for the cask.
95 96 97 98 99 100 101 102 |
# File 'cask/cask.rb', line 95 def old_tokens @old_tokens ||= if (tap = self.tap) Tap.tap_migration_oldnames(tap, token) + tap.cask_reverse_renames.fetch(token, []) else [] end end |
#on_system_blocks_exist? ⇒ 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.
49 |
# File 'cask/cask.rbi', line 49 def on_system_blocks_exist?; end |
#outdated?(greedy: false, greedy_latest: false, greedy_auto_updates: false) ⇒ Boolean
This method is part of an internal API. This method may only be used internally in repositories owned by Homebrew, except in casks or formulae. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Check if the installed cask is outdated.
247 248 249 250 |
# File 'cask/cask.rb', line 247 def outdated?(greedy: false, greedy_latest: false, greedy_auto_updates: false) !outdated_version(greedy:, greedy_latest:, greedy_auto_updates:).nil? end |
#outdated_download_sha? ⇒ 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.
232 233 234 235 236 237 |
# File 'cask/cask.rb', line 232 def outdated_download_sha? return true unless checksumable? current_download_sha = download_sha_path.read if download_sha_path.exist? current_download_sha.blank? || current_download_sha != new_download_sha end |
#outdated_info(greedy, verbose, json, greedy_latest, greedy_auto_updates) ⇒ Object
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.
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
# File 'cask/cask.rb', line 270 def outdated_info(greedy, verbose, json, greedy_latest, greedy_auto_updates) return token if !verbose && !json installed_version = outdated_version(greedy:, greedy_latest:, greedy_auto_updates:).to_s if json { name: token, installed_versions: [installed_version], current_version: version, } else "#{token} (#{installed_version}) != #{version}" end end |
#outdated_version(greedy: false, greedy_latest: false, greedy_auto_updates: false) ⇒ Object
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.
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 |
# File 'cask/cask.rb', line 252 def outdated_version(greedy: false, greedy_latest: false, greedy_auto_updates: false) # special case: tap version is not available return if version.nil? if version.latest? return installed_version if (greedy || greedy_latest) && outdated_download_sha? return elsif auto_updates && !greedy && !greedy_auto_updates return end # not outdated unless there is a different version on tap return if installed_version == version installed_version end |
#populate_from_api!(json_cask) ⇒ Object
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.
311 312 313 314 315 316 317 318 319 320 321 322 323 |
# File 'cask/cask.rb', line 311 def populate_from_api!(json_cask) raise ArgumentError, "Expected cask to be loaded from the API" unless loaded_from_api? @languages = json_cask.fetch(:languages, []) @tap_git_head = json_cask.fetch(:tap_git_head, "HEAD") @ruby_source_path = json_cask[:ruby_source_path] # TODO: Clean this up when we deprecate the current JSON API and move to the internal JSON v3. ruby_source_sha256 = json_cask.dig(:ruby_source_checksum, :sha256) ruby_source_sha256 ||= json_cask[:ruby_source_sha256] @ruby_source_checksum = { sha256: ruby_source_sha256 } end |
#refresh ⇒ Object
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 |
# File 'cask/cask.rb', line 110 def refresh @dsl = DSL.new(self) return unless @block @dsl.instance_eval(&@block) @dsl.language_eval end |
#ruby_source_checksum ⇒ Hash{Symbol => 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.
297 298 299 300 301 |
# File 'cask/cask.rb', line 297 def ruby_source_checksum @ruby_source_checksum ||= { sha256: Digest::SHA256.file(sourcefile_path).hexdigest, }.freeze end |
#ruby_source_path ⇒ Object
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.
287 288 289 290 291 292 293 294 |
# File 'cask/cask.rb', line 287 def ruby_source_path return @ruby_source_path if defined?(@ruby_source_path) return unless sourcefile_path return unless tap @ruby_source_path = sourcefile_path.relative_path_from(tap.path) end |
#sha256 ⇒ Object
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.
51 |
# File 'cask/cask.rbi', line 51 def sha256; end |
#staged_path ⇒ Object
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.
53 |
# File 'cask/cask.rbi', line 53 def staged_path; end |
#tap ⇒ Object
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.
53 54 55 56 57 |
# File 'cask/cask.rb', line 53 def tap return super if block_given? # Object#tap @tap end |
#tap_git_head ⇒ Object
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.
307 308 309 |
# File 'cask/cask.rb', line 307 def tap_git_head @tap_git_head ||= tap&.git_head end |
#timestamped_versions(caskroom_path: self.caskroom_path) ⇒ Array<Array(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.
123 124 125 126 127 128 129 130 131 132 |
# File 'cask/cask.rb', line 123 def (caskroom_path: self.caskroom_path) relative_paths = Pathname.glob(( version: "*", timestamp: "*", caskroom_path: )) .map { |p| p.relative_path_from(p.parent.parent) } # Sorbet is unaware that Pathname is sortable: https://github.com/sorbet/sorbet/issues/6844 T.unsafe(relative_paths).sort_by(&:basename) # sort by timestamp .map { |p| p.split.map(&:to_s) } end |
#to_h ⇒ Object
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.
345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 |
# File 'cask/cask.rb', line 345 def to_h { "token" => token, "full_token" => full_name, "old_tokens" => old_tokens, "tap" => tap&.name, "name" => name, "desc" => desc, "homepage" => homepage, "url" => url, "url_specs" => url_specs, "appcast" => appcast, "version" => version, "installed" => installed_version, "installed_time" => install_time&.to_i, "bundle_version" => bundle_long_version, "bundle_short_version" => bundle_short_version, "outdated" => outdated?, "sha256" => sha256, "artifacts" => artifacts_list, "caveats" => (caveats unless caveats.empty?), "depends_on" => depends_on, "conflicts_with" => conflicts_with, "container" => container&.pairs, "auto_updates" => auto_updates, "deprecated" => deprecated?, "deprecation_date" => deprecation_date, "deprecation_reason" => deprecation_reason, "disabled" => disabled?, "disable_date" => disable_date, "disable_reason" => disable_reason, "tap_git_head" => tap_git_head, "languages" => languages, "ruby_source_path" => ruby_source_path, "ruby_source_checksum" => ruby_source_checksum, } end |
#to_hash_with_variations(hash_method: :to_h) ⇒ Object
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.
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 |
# File 'cask/cask.rb', line 425 def to_hash_with_variations(hash_method: :to_h) case hash_method when :to_h if loaded_from_api? && !Homebrew::EnvConfig.no_install_from_api? return api_to_local_hash(Homebrew::API::Cask.all_casks[token].dup) end when :to_internal_api_hash raise ArgumentError, "API Hash must be generated from Ruby source files" if loaded_from_api? else raise ArgumentError, "Unknown hash method #{hash_method.inspect}" end hash = public_send(hash_method) variations = {} if @dsl.on_system_blocks_exist? begin MacOSVersion::SYMBOLS.keys.product(OnSystem::ARCH_OPTIONS).each do |os, arch| bottle_tag = ::Utils::Bottles::Tag.new(system: os, arch:) next unless bottle_tag.valid_combination? Homebrew::SimulateSystem.with(os:, arch:) do refresh public_send(hash_method).each do |key, value| next if HASH_KEYS_TO_SKIP.include? key next if value.to_s == hash[key].to_s variations[bottle_tag.to_sym] ||= {} variations[bottle_tag.to_sym][key] = value end end end ensure refresh end end hash["variations"] = variations if hash_method != :to_internal_api_hash || variations.present? hash end |
#to_internal_api_hash ⇒ Object
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.
383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 |
# File 'cask/cask.rb', line 383 def to_internal_api_hash api_hash = { "token" => token, "name" => name, "desc" => desc, "homepage" => homepage, "url" => url, "version" => version, "sha256" => sha256, "artifacts" => artifacts_list(compact: true), "ruby_source_path" => ruby_source_path, "ruby_source_sha256" => ruby_source_checksum.fetch(:sha256), } if deprecation_date api_hash["deprecation_date"] = deprecation_date api_hash["deprecation_reason"] = deprecation_reason end if disable_date api_hash["disable_date"] = disable_date api_hash["disable_reason"] = disable_reason end if (url_specs_hash = url_specs).present? api_hash["url_specs"] = url_specs_hash end api_hash["caskfile_only"] = true if caskfile_only? api_hash["conflicts_with"] = conflicts_with if conflicts_with.present? api_hash["depends_on"] = depends_on if depends_on.present? api_hash["container"] = container.pairs if container api_hash["caveats"] = caveats if caveats.present? api_hash["auto_updates"] = auto_updates if auto_updates api_hash["languages"] = languages if languages.present? api_hash end |
#url ⇒ Object
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.
55 |
# File 'cask/cask.rbi', line 55 def url; end |
#version ⇒ Object
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.
57 |
# File 'cask/cask.rbi', line 57 def version; end |