Module: Homebrew::API::CaskDownload Private

Defined in:
api/cask_download.rb

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.

Class Method Summary collapse

Class Method Details

.download(token:, cask_struct:, quarantine: nil, require_sha: false) ⇒ ::Cask::Download?

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.

Parameters:

Returns:



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'api/cask_download.rb', line 19

def self.download(token:, cask_struct:, quarantine: nil, require_sha: false)
  return if cask_struct.languages.any?
  return if cask_struct.url_args.empty?

  cask = ::Cask::Cask.new(
    token,
    tap:                      CoreCaskTap.instance,
    loaded_from_api:          true,
    loaded_from_internal_api: true,
  ) do
    version cask_struct.version
    sha256 cask_struct.sha256
    url(*cask_struct.url_args, **cask_struct.url_kwargs)
    homepage cask_struct.homepage if cask_struct.homepage?
  end

  ::Cask::Download.new(cask, quarantine:, require_sha:)
end