diff --git a/Library/Homebrew/cask/lib/hbc/artifact/moved.rb b/Library/Homebrew/cask/lib/hbc/artifact/moved.rb index ba1c8e9072..a2f890e4ce 100644 --- a/Library/Homebrew/cask/lib/hbc/artifact/moved.rb +++ b/Library/Homebrew/cask/lib/hbc/artifact/moved.rb @@ -8,11 +8,11 @@ module Hbc end def install_phase(**options) - move(**options) + move(source, target, **options) end def uninstall_phase(**options) - delete(**options) + move(target, source, **options) end def summarize_installed @@ -25,12 +25,12 @@ module Hbc private - def move(force: false, command: nil, **options) + def move(source, target, 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 opoo "#{message}; overwriting." - delete(force: force, command: command, **options) + delete(target, force: force, command: command, **options) end unless source.exist? @@ -49,7 +49,7 @@ module Hbc add_altname_metadata(target, source.basename, command: command) end - def delete(force: false, command: nil, **_) + def delete(target, force: false, command: nil, **_) ohai "Removing #{self.class.english_name} '#{target}'." raise CaskError, "Cannot remove undeletable #{self.class.english_name}." if MacOS.undeletable?(target) diff --git a/Library/Homebrew/cask/lib/hbc/installer.rb b/Library/Homebrew/cask/lib/hbc/installer.rb index e2f7714aea..cf71639efa 100644 --- a/Library/Homebrew/cask/lib/hbc/installer.rb +++ b/Library/Homebrew/cask/lib/hbc/installer.rb @@ -136,7 +136,7 @@ module Hbc def summary s = "" s << "#{Emoji.install_badge} " if Emoji.enabled? - s << "#{@cask} was successfully installed!" + s << "#{@cask} was successfully #{upgrade? ? "upgraded" : "installed"}!" end def download @@ -384,13 +384,13 @@ module Hbc def revert_upgrade return unless upgrade? opoo "Reverting upgrade for Cask #{@cask}" - reinstall + install_artifacts + enable_accessibility_access end def finalize_upgrade return unless upgrade? purge_versioned_files(upgrade: true) - oh1 "Cask #{@cask} was successfully upgraded!" end def uninstall_artifacts @@ -426,7 +426,7 @@ module Hbc end def purge_versioned_files(upgrade: false) - odebug "Purging files for version #{@cask.version} of Cask #{@cask}" + ohai "Purging files for version #{@cask.version} of Cask #{@cask}" unless upgrade? # versioned staged distribution gain_permissions_remove(@cask.staged_path) if !@cask.staged_path.nil? && @cask.staged_path.exist?