aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/lib/hbc/cli
diff options
context:
space:
mode:
authorJoshua McKinney2017-03-18 17:48:20 -0500
committerJoshua McKinney2017-03-19 13:14:16 -0500
commit367fdb971839c0b3686ca23a6de76da75cc80580 (patch)
tree56b82be0f60a2b8c6c15a238880a4504c5d2305e /Library/Homebrew/cask/lib/hbc/cli
parent76955b47bd2ae3eba1b041430d7e1aeab246de0d (diff)
downloadbrew-367fdb971839c0b3686ca23a6de76da75cc80580.tar.bz2
Refactor brew cask reinstall
The implementation of the reinstall command was the same as Installer#install, aside from the uninstall of the existing cask. Moved this within the class to DRY up the implementation.
Diffstat (limited to 'Library/Homebrew/cask/lib/hbc/cli')
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/reinstall.rb29
1 files changed, 5 insertions, 24 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/cli/reinstall.rb b/Library/Homebrew/cask/lib/hbc/cli/reinstall.rb
index b52c43328..c27fa9f2f 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/reinstall.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/reinstall.rb
@@ -7,30 +7,11 @@ module Hbc
begin
cask = CaskLoader.load(cask_token)
- installer = Installer.new(cask,
- force: force,
- skip_cask_deps: skip_cask_deps,
- require_sha: require_sha)
- installer.print_caveats
- installer.fetch
-
- if cask.installed?
- # use copy of cask for uninstallation to avoid 'No such file or directory' bug
- installed_cask = cask
-
- # 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
-
- # Always force uninstallation, ignore method parameter
- Installer.new(installed_cask, force: true).uninstall
- end
-
- installer.stage
- installer.install_artifacts
- installer.enable_accessibility_access
- puts installer.summary
+ Installer.new(cask,
+ force: force,
+ skip_cask_deps: skip_cask_deps,
+ require_sha: require_sha,
+ reinstall: true).install
count += 1
rescue CaskUnavailableError => e