From 486fa0bf193fab23a1c1836ba4dc6bd5c1c05df9 Mon Sep 17 00:00:00 2001
From: Markus Reiter <me@reitermark.us>
Date: Fri, 10 Feb 2017 07:49:21 +0100
Subject: [PATCH] Fix `uninstall` also running `zap`.

---
 Library/Homebrew/cask/lib/hbc/artifact/uninstall.rb      | 3 +++
 Library/Homebrew/cask/lib/hbc/artifact/uninstall_base.rb | 4 ----
 Library/Homebrew/cask/lib/hbc/artifact/zap.rb            | 2 +-
 Library/Homebrew/cask/lib/hbc/installer.rb               | 2 +-
 Library/Homebrew/cask/test/cask/artifact/zap_test.rb     | 4 ++--
 5 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/Library/Homebrew/cask/lib/hbc/artifact/uninstall.rb b/Library/Homebrew/cask/lib/hbc/artifact/uninstall.rb
index 8b5603064e..5a3dc098d9 100644
--- a/Library/Homebrew/cask/lib/hbc/artifact/uninstall.rb
+++ b/Library/Homebrew/cask/lib/hbc/artifact/uninstall.rb
@@ -3,6 +3,9 @@ require "hbc/artifact/uninstall_base"
 module Hbc
   module Artifact
     class Uninstall < UninstallBase
+      def uninstall_phase
+        dispatch_uninstall_directives
+      end
     end
   end
 end
diff --git a/Library/Homebrew/cask/lib/hbc/artifact/uninstall_base.rb b/Library/Homebrew/cask/lib/hbc/artifact/uninstall_base.rb
index e18e9c3115..ce2b1f51a1 100644
--- a/Library/Homebrew/cask/lib/hbc/artifact/uninstall_base.rb
+++ b/Library/Homebrew/cask/lib/hbc/artifact/uninstall_base.rb
@@ -54,10 +54,6 @@ module Hbc
         path_strings - undeletable
       end
 
-      def uninstall_phase
-        dispatch_uninstall_directives
-      end
-
       def dispatch_uninstall_directives(expand_tilde: true)
         directives_set = @cask.artifacts[stanza]
         ohai "Running #{stanza} process for #{@cask}; your password may be necessary"
diff --git a/Library/Homebrew/cask/lib/hbc/artifact/zap.rb b/Library/Homebrew/cask/lib/hbc/artifact/zap.rb
index b31e2ef11a..7793e57728 100644
--- a/Library/Homebrew/cask/lib/hbc/artifact/zap.rb
+++ b/Library/Homebrew/cask/lib/hbc/artifact/zap.rb
@@ -3,7 +3,7 @@ require "hbc/artifact/uninstall_base"
 module Hbc
   module Artifact
     class Zap < UninstallBase
-      def uninstall_phase
+      def zap_phase
         dispatch_uninstall_directives(expand_tilde: true)
       end
     end
diff --git a/Library/Homebrew/cask/lib/hbc/installer.rb b/Library/Homebrew/cask/lib/hbc/installer.rb
index 776a3acd28..cafc9d8b9e 100644
--- a/Library/Homebrew/cask/lib/hbc/installer.rb
+++ b/Library/Homebrew/cask/lib/hbc/installer.rb
@@ -331,7 +331,7 @@ module Hbc
       uninstall_artifacts
       if Artifact::Zap.me?(@cask)
         ohai "Dispatching zap stanza"
-        Artifact::Zap.new(@cask, command: @command).uninstall_phase
+        Artifact::Zap.new(@cask, command: @command).zap_phase
       else
         opoo "No zap stanza present for Cask '#{@cask}'"
       end
diff --git a/Library/Homebrew/cask/test/cask/artifact/zap_test.rb b/Library/Homebrew/cask/test/cask/artifact/zap_test.rb
index ea546728b5..37a65f863e 100644
--- a/Library/Homebrew/cask/test/cask/artifact/zap_test.rb
+++ b/Library/Homebrew/cask/test/cask/artifact/zap_test.rb
@@ -14,10 +14,10 @@ describe Hbc::Artifact::Zap do
     end
   end
 
-  describe "uninstall_phase" do
+  describe "#zap_phase" do
     subject {
       shutup do
-        zap_artifact.uninstall_phase
+        zap_artifact.zap_phase
       end
     }
 
-- 
GitLab