Fix reinstall/uninstall tests
This commit is contained in:
parent
522a229dbb
commit
72e673afae
@ -25,7 +25,7 @@ module Hbc
|
||||
|
||||
private
|
||||
|
||||
def move(source, target, force: false, command: nil, **options)
|
||||
def move(source, target, skip: false, force: false, command: nil, **options)
|
||||
if Utils.path_occupied?(target)
|
||||
message = "It seems there is already #{self.class.english_article} #{self.class.english_name} at '#{target}'"
|
||||
raise CaskError, "#{message}." unless force
|
||||
@ -34,6 +34,8 @@ module Hbc
|
||||
end
|
||||
|
||||
unless source.exist?
|
||||
return if skip
|
||||
|
||||
raise CaskError, "It seems the #{self.class.english_name} source '#{source}' is not there."
|
||||
end
|
||||
|
||||
|
||||
@ -368,7 +368,7 @@ module Hbc
|
||||
def uninstall
|
||||
oh1 "Uninstalling Cask #{@cask}"
|
||||
disable_accessibility_access
|
||||
uninstall_artifacts
|
||||
uninstall_artifacts(clear: true)
|
||||
purge_versioned_files
|
||||
purge_caskroom_path if force?
|
||||
end
|
||||
@ -390,10 +390,10 @@ module Hbc
|
||||
|
||||
def finalize_upgrade
|
||||
return unless upgrade?
|
||||
purge_versioned_files(upgrade: true)
|
||||
purge_versioned_files
|
||||
end
|
||||
|
||||
def uninstall_artifacts
|
||||
def uninstall_artifacts(clear: false)
|
||||
odebug "Un-installing artifacts"
|
||||
artifacts = @cask.artifacts
|
||||
|
||||
@ -402,7 +402,7 @@ module Hbc
|
||||
artifacts.each do |artifact|
|
||||
next unless artifact.respond_to?(:uninstall_phase)
|
||||
odebug "Un-installing artifact of class #{artifact.class}"
|
||||
artifact.uninstall_phase(command: @command, verbose: verbose?, force: force?)
|
||||
artifact.uninstall_phase(command: @command, verbose: verbose?, skip: clear, force: force?)
|
||||
end
|
||||
end
|
||||
|
||||
@ -425,8 +425,8 @@ module Hbc
|
||||
Utils.gain_permissions_remove(path, command: @command)
|
||||
end
|
||||
|
||||
def purge_versioned_files(upgrade: false)
|
||||
odebug "Purging files for version #{@cask.version} of Cask #{@cask}" unless upgrade?
|
||||
def purge_versioned_files
|
||||
ohai "Purging files for version #{@cask.version} of Cask #{@cask}"
|
||||
|
||||
# versioned staged distribution
|
||||
gain_permissions_remove(@cask.staged_path) if !@cask.staged_path.nil? && @cask.staged_path.exist?
|
||||
|
||||
@ -13,7 +13,8 @@ describe Hbc::CLI::Reinstall, :cask do
|
||||
Already downloaded: .*local-caffeine--1.2.3.zip
|
||||
==> Verifying checksum for Cask local-caffeine
|
||||
==> Uninstalling Cask local-caffeine
|
||||
==> Removing App '.*Caffeine.app'.
|
||||
==> Moving App 'Caffeine.app' to '.*Caffeine.app'.
|
||||
==> Purging files for version 1.2.3 of Cask local-caffeine
|
||||
==> Installing Cask local-caffeine
|
||||
==> Moving App 'Caffeine.app' to '.*Caffeine.app'.
|
||||
.*local-caffeine was successfully installed!
|
||||
|
||||
@ -12,7 +12,8 @@ describe Hbc::CLI::Uninstall, :cask do
|
||||
|
||||
output = Regexp.new <<~EOS
|
||||
==> Uninstalling Cask local-caffeine
|
||||
==> Removing App '.*Caffeine.app'.
|
||||
==> Moving App 'Caffeine.app' to '.*Caffeine.app'.
|
||||
==> Purging files for version 1.2.3 of Cask local-caffeine
|
||||
EOS
|
||||
|
||||
expect {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user