Merge pull request #1982 from reitermarkus/fix-zap

Fix `uninstall` also running `zap`.
This commit is contained in:
Markus Reiter 2017-02-10 08:42:27 +01:00 committed by GitHub
commit c528f0d4cb
6 changed files with 28 additions and 8 deletions

View File

@ -3,6 +3,9 @@ require "hbc/artifact/uninstall_base"
module Hbc module Hbc
module Artifact module Artifact
class Uninstall < UninstallBase class Uninstall < UninstallBase
def uninstall_phase
dispatch_uninstall_directives
end
end end
end end
end end

View File

@ -54,10 +54,6 @@ module Hbc
path_strings - undeletable path_strings - undeletable
end end
def uninstall_phase
dispatch_uninstall_directives
end
def dispatch_uninstall_directives(expand_tilde: true) def dispatch_uninstall_directives(expand_tilde: true)
directives_set = @cask.artifacts[stanza] directives_set = @cask.artifacts[stanza]
ohai "Running #{stanza} process for #{@cask}; your password may be necessary" ohai "Running #{stanza} process for #{@cask}; your password may be necessary"

View File

@ -3,7 +3,7 @@ require "hbc/artifact/uninstall_base"
module Hbc module Hbc
module Artifact module Artifact
class Zap < UninstallBase class Zap < UninstallBase
def uninstall_phase def zap_phase
dispatch_uninstall_directives(expand_tilde: true) dispatch_uninstall_directives(expand_tilde: true)
end end
end end

View File

@ -331,7 +331,7 @@ module Hbc
uninstall_artifacts uninstall_artifacts
if Artifact::Zap.me?(@cask) if Artifact::Zap.me?(@cask)
ohai "Dispatching zap stanza" ohai "Dispatching zap stanza"
Artifact::Zap.new(@cask, command: @command).uninstall_phase Artifact::Zap.new(@cask, command: @command).zap_phase
else else
opoo "No zap stanza present for Cask '#{@cask}'" opoo "No zap stanza present for Cask '#{@cask}'"
end end

View File

@ -0,0 +1,21 @@
require "spec_helper"
describe Hbc::Artifact::Zap do
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-installable.rb") }
let(:zap_artifact) {
Hbc::Artifact::Zap.new(cask)
}
before do
shutup do
InstallHelper.install_without_artifacts(cask)
end
end
describe "#uninstall_phase" do
subject { zap_artifact }
it { is_expected.not_to respond_to(:uninstall_phase) }
end
end

View File

@ -14,10 +14,10 @@ describe Hbc::Artifact::Zap do
end end
end end
describe "uninstall_phase" do describe "#zap_phase" do
subject { subject {
shutup do shutup do
zap_artifact.uninstall_phase zap_artifact.zap_phase
end end
} }