aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorL. E. Segovia2017-11-06 21:27:02 -0300
committerL. E. Segovia2017-11-06 21:27:02 -0300
commit94d266e2d6c2e7c8c14dc9c6f117871e33be3133 (patch)
treeba87ce267fff10226fffd31dfce0ab738b69df5e /Library/Homebrew
parent84c128411f192b503bee9c7f7595ba1c43b25529 (diff)
downloadbrew-94d266e2d6c2e7c8c14dc9c6f117871e33be3133.tar.bz2
Rework uninstallation step
Now the artifacts get re-staged, and upon an uninstall/finalize_upgrade they are deleted by purge_versioned_files instead
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/cask/lib/hbc/artifact/moved.rb10
-rw-r--r--Library/Homebrew/cask/lib/hbc/installer.rb8
2 files changed, 9 insertions, 9 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/artifact/moved.rb b/Library/Homebrew/cask/lib/hbc/artifact/moved.rb
index ba1c8e907..a2f890e4c 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 e2f7714ae..cf71639ef 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?