Fix uninstall order.

This commit is contained in:
Markus Reiter 2017-05-23 15:37:33 +02:00
parent 0871e069a2
commit 38b5e4254b
2 changed files with 9 additions and 7 deletions

View File

@ -25,10 +25,17 @@ require "hbc/artifact/zap"
module Hbc module Hbc
module Artifact module Artifact
# NOTE: order is important here, since we want to extract nested containers # NOTE: Order is important here!
# before we handle any other artifacts #
# The `uninstall` stanza should be run first, as it may
# depend on other artifacts still being installed.
#
# We want to extract nested containers before we
# handle any other artifacts.
#
TYPES = [ TYPES = [
PreflightBlock, PreflightBlock,
Uninstall,
NestedContainer, NestedContainer,
Installer, Installer,
App, App,
@ -49,7 +56,6 @@ module Hbc
VstPlugin, VstPlugin,
Vst3Plugin, Vst3Plugin,
ScreenSaver, ScreenSaver,
Uninstall,
PostflightBlock, PostflightBlock,
Zap, Zap,
].freeze ].freeze

View File

@ -358,10 +358,6 @@ module Hbc
odebug "Un-installing artifacts" odebug "Un-installing artifacts"
artifacts = Artifact.for_cask(@cask, command: @command, verbose: verbose?, force: force?) artifacts = Artifact.for_cask(@cask, command: @command, verbose: verbose?, force: force?)
# Make sure the `uninstall` stanza is run first, as it
# may depend on other artifacts still being installed.
artifacts = artifacts.sort_by { |a| a.is_a?(Artifact::Uninstall) ? -1 : 1 }
odebug "#{artifacts.length} artifact/s defined", artifacts odebug "#{artifacts.length} artifact/s defined", artifacts
artifacts.each do |artifact| artifacts.each do |artifact|