Class: Cask::Download

Inherits:
Object
  • Object
show all
Defined in:
brew/Library/Homebrew/cask/download.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cask, force: false, quarantine: nil) ⇒ Download

Returns a new instance of Download



12
13
14
15
16
# File 'brew/Library/Homebrew/cask/download.rb', line 12

def initialize(cask, force: false, quarantine: nil)
  @cask = cask
  @force = force
  @quarantine = quarantine
end

Instance Attribute Details

#caskObject (readonly)

Returns the value of attribute cask



10
11
12
# File 'brew/Library/Homebrew/cask/download.rb', line 10

def cask
  @cask
end

Instance Method Details

#downloaderObject



25
26
27
28
29
30
# File 'brew/Library/Homebrew/cask/download.rb', line 25

def downloader
  @downloader ||= begin
    strategy = DownloadStrategyDetector.detect(cask.url.to_s, cask.url.using)
    strategy.new(cask.url.to_s, cask.token, cask.version, cache: Cache.path, **cask.url.specs)
  end
end

#performObject



18
19
20
21
22
23
# File 'brew/Library/Homebrew/cask/download.rb', line 18

def perform
  clear_cache
  fetch
  quarantine
  downloaded_path
end