aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/lib
diff options
context:
space:
mode:
authorMarkus Reiter2017-02-16 21:18:35 +0100
committerGitHub2017-02-16 21:18:35 +0100
commit93ef5092b0312117717c8dd31012fd70f093891f (patch)
tree568c4b42b53571d197f1516c1d1fff08fd1080a9 /Library/Homebrew/cask/lib
parent5a2a0638028ee49991e404c1bd6397c10659474b (diff)
parentecb17f4f1d265e1625828565ecbbdac6d5f989c6 (diff)
downloadbrew-93ef5092b0312117717c8dd31012fd70f093891f.tar.bz2
Merge pull request #2033 from reitermarkus/uninstall-first
Make sure `uninstall` is called before artifacts are removed.
Diffstat (limited to 'Library/Homebrew/cask/lib')
-rw-r--r--Library/Homebrew/cask/lib/hbc/installer.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/installer.rb b/Library/Homebrew/cask/lib/hbc/installer.rb
index cafc9d8b9..b86f3264d 100644
--- a/Library/Homebrew/cask/lib/hbc/installer.rb
+++ b/Library/Homebrew/cask/lib/hbc/installer.rb
@@ -318,7 +318,13 @@ module Hbc
def uninstall_artifacts
odebug "Un-installing artifacts"
artifacts = Artifact.for_cask(@cask, command: @command, 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
+
artifacts.each do |artifact|
next unless artifact.respond_to?(:uninstall_phase)
odebug "Un-installing artifact of class #{artifact.class}"