diff options
| author | Raymond Wanyoike | 2016-12-04 13:37:26 +0300 |
|---|---|---|
| committer | Raymond Wanyoike | 2016-12-04 13:37:26 +0300 |
| commit | 55ef924e7a9f99a9df1c2b7a9b33793f7ae27d8a (patch) | |
| tree | 1901c9b2fc4d4d7a0089372d315704b033667335 /Library | |
| parent | 697340ff3b2e7982bd51bae014ac6245489faf0e (diff) | |
| download | brew-55ef924e7a9f99a9df1c2b7a9b33793f7ae27d8a.tar.bz2 | |
cask reinstall: download and verify cask before uninstall
Closes: caskroom/homebrew-cask#27075
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/cli/reinstall.rb | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/cli/reinstall.rb b/Library/Homebrew/cask/lib/hbc/cli/reinstall.rb index 3560a4795..70a329c20 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/reinstall.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/reinstall.rb @@ -7,6 +7,24 @@ module Hbc begin cask = Hbc.load(cask_token) + installer = Installer.new(cask, + force: force, + skip_cask_deps: skip_cask_deps, + require_sha: require_sha) + installer.print_caveats + + # Download + begin + installer.satisfy_dependencies + installer.verify_has_sha if @require_sha && !@force + installer.download + installer.verify + rescue StandardError => e + installer.purge_versioned_files + raise e + end + + # Uninstall if cask.installed? # use copy of cask for uninstallation to avoid 'No such file or directory' bug installed_cask = cask @@ -26,10 +44,18 @@ module Hbc Installer.new(installed_cask, force: true).uninstall end - Installer.new(cask, - force: force, - skip_cask_deps: skip_cask_deps, - require_sha: require_sha).install + # Reinstall + begin + installer.extract_primary_container + installer.install_artifacts + installer.save_caskfile + installer.enable_accessibility_access + rescue StandardError => e + installer.purge_versioned_files + raise e + end + + puts installer.summary count += 1 rescue CaskUnavailableError => e warn_unavailable_with_suggestion cask_token, e |
