2024-08-12 10:30:59 +01:00
|
|
|
# typed: true # rubocop:todo Sorbet/StrictSigil
|
2019-04-19 15:38:03 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-09-03 19:39:07 +01:00
|
|
|
require "cask/artifact/abstract_uninstall"
|
2016-08-18 22:11:42 +03:00
|
|
|
|
2018-09-06 08:29:14 +02:00
|
|
|
module Cask
|
2016-09-24 13:52:43 +02:00
|
|
|
module Artifact
|
2020-08-19 10:23:41 +02:00
|
|
|
# Artifact corresponding to the `uninstall` stanza.
|
2017-04-06 00:33:31 +02:00
|
|
|
class Uninstall < AbstractUninstall
|
2024-12-11 11:03:23 -08:00
|
|
|
UPGRADE_REINSTALL_SKIP_DIRECTIVES = [:quit, :signal].freeze
|
|
|
|
|
2024-01-19 23:08:26 +11:00
|
|
|
def uninstall_phase(upgrade: false, reinstall: false, **options)
|
|
|
|
filtered_directives = ORDERED_DIRECTIVES.filter do |directive_sym|
|
|
|
|
next false if directive_sym == :rmdir
|
|
|
|
|
|
|
|
next false if (upgrade || reinstall) && UPGRADE_REINSTALL_SKIP_DIRECTIVES.include?(directive_sym)
|
|
|
|
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
filtered_directives.each do |directive_sym|
|
|
|
|
dispatch_uninstall_directive(directive_sym, **options)
|
|
|
|
end
|
2019-02-06 19:04:29 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def post_uninstall_phase(**options)
|
|
|
|
dispatch_uninstall_directive(:rmdir, **options)
|
2017-02-10 07:49:21 +01:00
|
|
|
end
|
2016-09-24 13:52:43 +02:00
|
|
|
end
|
|
|
|
end
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|