Class: Cask::Cmd::Fetch Private

Inherits:
AbstractCommand show all
Extended by:
T::Sig
Defined in:
cask/cmd/fetch.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.

Cask implementation of the brew fetch command.

Constant Summary

Constants inherited from AbstractCommand

AbstractCommand::OPTIONS

Instance Attribute Summary

Attributes inherited from AbstractCommand

#args

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractCommand

abstract?, command_name, help, #initialize, run, short_description, visible?

Methods included from Homebrew::Search

#query_regexp, #search_casks, #search_descriptions, #search_formulae, #search_taps

Methods included from Homebrew::Search::Extension

#search_casks, #search_descriptions

Constructor Details

This class inherits a constructor from Cask::Cmd::AbstractCommand

Class Method Details

.parserObject

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.



12
13
14
15
16
17
# File 'cask/cmd/fetch.rb', line 12

def self.parser
  super do
    switch "--force",
           description: "Force redownloading even if files already exist in local cache."
  end
end

Instance Method Details

#runvoid

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.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'cask/cmd/fetch.rb', line 20

def run
  require "cask/download"
  require "cask/installer"

  options = {
    quarantine: args.quarantine?,
  }.compact

  options[:quarantine] = true if options[:quarantine].nil?

  casks.each do |cask|
    puts Installer.caveats(cask)
    ohai "Downloading external files for Cask #{cask}"
    download = Download.new(cask, **options)
    download.clear_cache if args.force?
    downloaded_path = download.fetch
    ohai "Success! Downloaded to: #{downloaded_path}"
  end
end