Class: Cask::Reinstall Private
- 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_deprecated, pretty_disabled, 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, skip_prefetch: false, download_queue: nil) ⇒ 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.
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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'cask/reinstall.rb', line 17 def self.reinstall_casks( *casks, verbose: false, force: false, skip_cask_deps: false, binaries: false, require_sha: false, quarantine: false, zap: false, skip_prefetch: false, download_queue: nil ) require "cask/installer" quarantine = true if quarantine.nil? created_download_queue = T.let(false, T::Boolean) if download_queue.nil? if skip_prefetch download_queue = Homebrew.default_download_queue else download_queue = Homebrew::DownloadQueue.new(pour: true) created_download_queue = true end end cask_installers = T.let([], T::Array[Installer]) begin cask_installers = casks.map do |cask| Installer.new( cask, binaries:, verbose:, force:, skip_cask_deps:, require_sha:, reinstall: true, quarantine:, zap:, download_queue:, defer_fetch: true, ) end unless skip_prefetch 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 ensure download_queue.shutdown if created_download_queue end exit 1 if Homebrew.failed? caught_exceptions = [] cask_installers.each do |installer| installer.install rescue => e caught_exceptions << e next end return if caught_exceptions.empty? raise MultipleCaskErrors, caught_exceptions if caught_exceptions.count > 1 raise caught_exceptions.fetch(0) end |