Class: Cask::Download Private
- Includes:
- Context, Downloadable
- Defined in:
- cask/download.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 download corresponding to a Cask.
Instance Attribute Summary collapse
- #cask ⇒ ::Cask::Cask readonly private
Attributes included from Downloadable
Instance Method Summary collapse
- #basename ⇒ Pathname private
- #checksum ⇒ ::Checksum? private
- #download_queue_name ⇒ String private
- #download_queue_type ⇒ String private
- #fetch(quiet: nil, verify_download_integrity: true, timeout: nil) ⇒ Pathname private
- #initialize(cask, quarantine: nil, require_sha: false) ⇒ void constructor private
- #time_file_size(timeout: nil) ⇒ Array<([Time, nil], Integer)> private
- #url ⇒ ::URL? private
- #verify_download_integrity(filename) ⇒ void private
- #version ⇒ Version? private
Methods included from Context
current, current=, #debug?, #quiet?, #verbose?, #with_context
Methods included from Downloadable
#cached_download, #clear_cache, #download_queue_message, #download_strategy, #downloaded!, #downloaded?, #downloader, #downloading!, #extracting!, #fetched_size, #freeze, #initialize_dup, #total_size, #verified!, #verifying!
Methods included from Utils::Output::Mixin
#odebug, #odeprecated, #odie, #odisabled, #ofail, #oh1, #oh1_title, #ohai, #ohai_title, #onoe, #opoo, #opoo_outside_github_actions, #pretty_deprecated, #pretty_disabled, #pretty_duration, #pretty_installed, #pretty_outdated, #pretty_uninstalled
Constructor Details
#initialize(cask, quarantine: nil, require_sha: 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.
26 27 28 29 30 31 32 |
# File 'cask/download.rb', line 26 def initialize(cask, quarantine: nil, require_sha: false) super() @cask = cask @quarantine = quarantine @require_sha = require_sha end |
Instance Attribute Details
#cask ⇒ ::Cask::Cask (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.
17 18 19 |
# File 'cask/download.rb', line 17 def cask @cask end |
Instance Method Details
#basename ⇒ 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.
86 87 88 |
# File 'cask/download.rb', line 86 def basename downloader.basename end |
#checksum ⇒ ::Checksum?
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.
42 43 44 |
# File 'cask/download.rb', line 42 def checksum @checksum ||= cask.sha256 if cask.sha256 != :no_check end |
#download_queue_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.
101 |
# File 'cask/download.rb', line 101 def download_queue_name = "#{cask.token} (#{version})" |
#download_queue_type ⇒ 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.
104 |
# File 'cask/download.rb', line 104 def download_queue_type = "Cask" |
#fetch(quiet: nil, verify_download_integrity: true, timeout: nil) ⇒ 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.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'cask/download.rb', line 60 def fetch(quiet: nil, verify_download_integrity: true, timeout: nil) verify_has_sha if @require_sha downloader.quiet! if quiet begin super(verify_download_integrity: false, timeout:) rescue DownloadError => e error = CaskError.new("Download failed on Cask '#{cask}' with message: #{e.cause}") error.set_backtrace e.backtrace raise error end downloaded_path = cached_download quarantine(downloaded_path) self.verify_download_integrity(downloaded_path) if verify_download_integrity downloaded_path end |
#time_file_size(timeout: nil) ⇒ Array<([Time, nil], Integer)>
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.
79 80 81 82 83 |
# File 'cask/download.rb', line 79 def time_file_size(timeout: nil) raise ArgumentError, "not supported for this download strategy" unless downloader.is_a?(CurlDownloadStrategy) T.cast(downloader, CurlDownloadStrategy).resolved_time_file_size(timeout:) end |
#url ⇒ ::URL?
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 36 37 38 39 |
# File 'cask/download.rb', line 35 def url return if (cask_url = cask.url).nil? @url ||= ::URL.new(cask_url.to_s, cask_url.specs) end |
#verify_download_integrity(filename) ⇒ 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.
91 92 93 94 95 96 97 98 |
# File 'cask/download.rb', line 91 def verify_download_integrity(filename) if no_checksum_defined? && !official_cask_tap? opoo "No checksum defined for cask '#{@cask}', skipping verification." return end super end |
#version ⇒ Version?
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 48 49 50 51 |
# File 'cask/download.rb', line 47 def version return if cask.version.nil? @version ||= Version.new(cask.version) end |