diff options
| author | L. E. Segovia | 2017-11-10 10:05:18 -0300 |
|---|---|---|
| committer | L. E. Segovia | 2017-11-10 11:33:44 -0300 |
| commit | 72e673afaeec817c38465dcb9c652ef7556d0b52 (patch) | |
| tree | 19844f81e04570a4a88d0662dde39730e90874a2 /Library/Homebrew/cask | |
| parent | 522a229dbb0e558b8898df60095527e081500655 (diff) | |
| download | brew-72e673afaeec817c38465dcb9c652ef7556d0b52.tar.bz2 | |
Fix reinstall/uninstall tests
Diffstat (limited to 'Library/Homebrew/cask')
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/artifact/moved.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/installer.rb | 12 |
2 files changed, 9 insertions, 7 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/artifact/moved.rb b/Library/Homebrew/cask/lib/hbc/artifact/moved.rb index a2f890e4c..dacbe20b7 100644 --- a/Library/Homebrew/cask/lib/hbc/artifact/moved.rb +++ b/Library/Homebrew/cask/lib/hbc/artifact/moved.rb @@ -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 diff --git a/Library/Homebrew/cask/lib/hbc/installer.rb b/Library/Homebrew/cask/lib/hbc/installer.rb index 88b77c62c..03f2c6570 100644 --- a/Library/Homebrew/cask/lib/hbc/installer.rb +++ b/Library/Homebrew/cask/lib/hbc/installer.rb @@ -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? |
