Class: Cask::Uninstall Private
- Extended by:
- Utils::Output::Mixin
- Defined in:
- cask/uninstall.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
- .check_dependent_casks(*casks, named_args: []) ⇒ void private
- .uninstall_casks(*casks, binaries: false, force: false, verbose: false) ⇒ void private
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
.check_dependent_casks(*casks, named_args: []) ⇒ 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.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'cask/uninstall.rb', line 26 def self.check_dependent_casks(*casks, named_args: []) dependents = [] all_requireds = casks.map(&:token) requireds = Set.new caskroom = ::Cask::Caskroom.casks caskroom.each do |dependent| d = CaskDependent.new(dependent) dependencies = d.recursive_requirements.filter_map { |r| r.cask if r.is_a?(CaskDependent::Requirement) } found_dependents = dependencies.intersection(all_requireds) next if found_dependents.empty? requireds += found_dependents dependents << dependent.token end return if dependents.empty? DependentsMessage.new(requireds.to_a, dependents, named_args:).output end |
.uninstall_casks(*casks, binaries: false, force: false, verbose: 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.
13 14 15 16 17 18 19 20 21 22 23 |
# File 'cask/uninstall.rb', line 13 def self.uninstall_casks(*casks, binaries: false, force: false, verbose: false) require "cask/installer" casks.each do |cask| odebug "Uninstalling Cask #{cask}" raise CaskNotInstalledError, cask if !cask.installed? && !force Installer.new(cask, binaries:, force:, verbose:).uninstall end end |