Class: Cask::Artifact::Uninstall Private

Inherits:
AbstractUninstall show all
Defined in:
cask/artifact/uninstall.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.

Artifact corresponding to the uninstall stanza.

Constant Summary collapse

UPGRADE_REINSTALL_SKIP_DIRECTIVES =

This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.

[:signal].freeze

Constants inherited from AbstractUninstall

AbstractUninstall::METADATA_KEYS, AbstractUninstall::ORDERED_DIRECTIVES

Constants inherited from AbstractArtifact

AbstractArtifact::DirectivesType

Instance Attribute Summary

Attributes inherited from AbstractUninstall

#directives

Attributes inherited from AbstractArtifact

#cask

Instance Method Summary collapse

Methods inherited from AbstractUninstall

bundle_identifier_for_pid, #bundle_ids_to_reopen, #each_resolved_path, #find_launchctl_with_wildcard, from_args, #initialize, owner_uid, parent_pid, #summarize, #to_h, #uninstall_quit

Methods included from SystemCommand::Mixin

#command_sandbox, #system_command, #system_command!

Methods included from OS::Mac::Cask::Artifact::AbstractUninstall

#undeletable?

Methods inherited from AbstractArtifact

#cask_sandbox, #config, dirmethod, dsl_key, english_article, english_name, #initialize, read_script_arguments, #requires_sudo?, #run_cask_sandbox, #sort_order, #staged_path_join_executable, #summarize, #to_args

Methods included from Utils::Output::Mixin

#issue_reporting_message, #odebug, #odeprecated, #odie, #odisabled, #ofail, #oh1, #oh1_title, #ohai, #ohai_title, #onoe, #opoo, #opoo_once, #opoo_outside_github_actions, #opoo_without_github_actions_annotation, #pretty_cannot_install, #pretty_deprecated, #pretty_disabled, #pretty_duration, #pretty_install_status, #pretty_installed, #pretty_uninstalled, #pretty_unmarked, #pretty_upgradable, #pretty_warning

Constructor Details

This class inherits a constructor from Cask::Artifact::AbstractUninstall

Instance Method Details

#post_uninstall_phase(command:, skip: false, force: false, verbose: false, successor: 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.

Parameters:

  • command (T.class_of(SystemCommand))
  • skip (Boolean) (defaults to: false)
  • force (Boolean) (defaults to: false)
  • verbose (Boolean) (defaults to: false)
  • successor (Cask, nil) (defaults to: nil)


65
66
67
# File 'cask/artifact/uninstall.rb', line 65

def post_uninstall_phase(command:, skip: false, force: false, verbose: false, successor: nil)
  dispatch_uninstall_directive(:rmdir, command:, force:, successor:)
end

#uninstall_phase(command:, skip: false, force: false, verbose: false, successor: nil, upgrade: false, reinstall: false, quit: true) ⇒ 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:

  • command (T.class_of(SystemCommand))
  • skip (Boolean) (defaults to: false)
  • force (Boolean) (defaults to: false)
  • verbose (Boolean) (defaults to: false)
  • successor (Cask, nil) (defaults to: nil)
  • upgrade (Boolean) (defaults to: false)
  • reinstall (Boolean) (defaults to: false)
  • quit (Boolean) (defaults to: true)


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
# File 'cask/artifact/uninstall.rb', line 24

def uninstall_phase(command:, skip: false, force: false, verbose: false, successor: nil, upgrade: false,
                    reinstall: false, quit: true)
  raw_on_upgrade = directives[:on_upgrade]
  on_upgrade_syms =
    case raw_on_upgrade
    when Symbol
      [raw_on_upgrade]
    when Array
      raw_on_upgrade.map(&:to_sym)
    else
      []
    end
  on_upgrade_set = on_upgrade_syms.to_set

  filtered_directives = ORDERED_DIRECTIVES.filter do |directive_sym|
    next false if directive_sym == :rmdir
    next false if directive_sym == :quit && !quit

    if (upgrade || reinstall) &&
       UPGRADE_REINSTALL_SKIP_DIRECTIVES.include?(directive_sym) &&
       on_upgrade_set.exclude?(directive_sym)
      next false
    end

    true
  end

  filtered_directives.each do |directive_sym|
    dispatch_uninstall_directive(directive_sym, command:, force:, successor:, upgrade:)
  end
end