aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJoshua McKinney2017-04-17 17:21:02 -0700
committerJoshua McKinney2017-04-18 01:49:54 -0700
commitcb28ab640e191500d480308ca262366184518022 (patch)
treea945170fa6232d87ca2bf434067b62ea16c5dee2 /Library
parenta90d1e169939cea7006f7465fe8c04370005223d (diff)
downloadbrew-cb28ab640e191500d480308ca262366184518022.tar.bz2
Refactor uninstall existing cask
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cask/lib/hbc/installer.rb12
1 files changed, 5 insertions, 7 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/installer.rb b/Library/Homebrew/cask/lib/hbc/installer.rb
index c9b6b4e53..51b0490f5 100644
--- a/Library/Homebrew/cask/lib/hbc/installer.rb
+++ b/Library/Homebrew/cask/lib/hbc/installer.rb
@@ -84,7 +84,7 @@ module Hbc
print_caveats
fetch
- uninstall_if_neccessary
+ uninstall_existing_cask if @reinstall
oh1 "Installing Cask #{@cask}"
stage
@@ -100,14 +100,12 @@ module Hbc
install
end
- def uninstall_if_neccessary
- return unless @cask.installed? && @reinstall
- installed_cask = @cask
+ def uninstall_existing_cask
+ return unless @cask.installed?
# use the same cask file that was used for installation, if possible
- if (installed_caskfile = installed_cask.installed_caskfile).exist?
- installed_cask = CaskLoader.load_from_file(installed_caskfile)
- end
+ installed_caskfile = @cask.installed_caskfile
+ installed_cask = installed_caskfile.exist? ? CaskLoader.load_from_file(installed_caskfile) : @cask
# Always force uninstallation, ignore method parameter
Installer.new(installed_cask, force: true).uninstall