Class: Cask::Reinstall Private

Inherits:
Object show all
Extended by:
Utils::Output::Mixin
Defined in:
cask/reinstall.rb

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.

Class Method Summary collapse

Methods included from Utils::Output::Mixin

odebug, odeprecated, odie, odisabled, ofail, oh1, oh1_title, ohai, ohai_title, onoe, opoo, opoo_outside_github_actions, pretty_duration, pretty_installed, pretty_outdated, pretty_uninstalled

Class Method Details

.reinstall_casks(*casks, verbose: false, force: false, skip_cask_deps: false, binaries: false, require_sha: false, quarantine: false, zap: 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.

This method returns an undefined value.

Parameters:

  • casks (::Cask::Cask)
  • verbose (Boolean) (defaults to: false)
  • force (Boolean) (defaults to: false)
  • skip_cask_deps (Boolean) (defaults to: false)
  • binaries (Boolean) (defaults to: false)
  • require_sha (Boolean) (defaults to: false)
  • quarantine (Boolean) (defaults to: false)
  • zap (Boolean) (defaults to: false)


16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'cask/reinstall.rb', line 16

def self.reinstall_casks(
  *casks,
  verbose: false,
  force: false,
  skip_cask_deps: false,
  binaries: false,
  require_sha: false,
  quarantine: false,
  zap: false
)
  require "cask/installer"

  quarantine = true if quarantine.nil?

  download_queue = Homebrew::DownloadQueue.new_if_concurrency_enabled(pour: true)
  cask_installers = casks.map do |cask|
    Installer.new(cask, binaries:, verbose:, force:, skip_cask_deps:, require_sha:, reinstall: true,
                  quarantine:, zap:, download_queue:)
  end

  if download_queue
    cask_installers.each(&:prelude)

    oh1 "Fetching downloads for: #{casks.map { |cask| Formatter.identifier(cask.full_name) }.to_sentence}",
        truncate: false
    cask_installers.each(&:enqueue_downloads)
    download_queue.fetch
  end

  cask_installers.each(&:install)
end