From a90d1e169939cea7006f7465fe8c04370005223d Mon Sep 17 00:00:00 2001 From: Joshua McKinney Date: Mon, 27 Mar 2017 01:31:29 -0500 Subject: [PATCH] Installer#reinstall instead of #install :reinstall Call an explicit method on Installer to reinstall rather than using a flag to indicate when we're reinstalling a cask --- Library/Homebrew/cask/lib/hbc/cli/reinstall.rb | 3 +-- Library/Homebrew/cask/lib/hbc/installer.rb | 10 ++++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/cask/lib/hbc/cli/reinstall.rb b/Library/Homebrew/cask/lib/hbc/cli/reinstall.rb index c27fa9f2fd..c2ed8f4625 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/reinstall.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/reinstall.rb @@ -10,8 +10,7 @@ module Hbc Installer.new(cask, force: force, skip_cask_deps: skip_cask_deps, - require_sha: require_sha, - reinstall: true).install + require_sha: require_sha).reinstall count += 1 rescue CaskUnavailableError => e diff --git a/Library/Homebrew/cask/lib/hbc/installer.rb b/Library/Homebrew/cask/lib/hbc/installer.rb index 69113e9fc8..c9b6b4e538 100644 --- a/Library/Homebrew/cask/lib/hbc/installer.rb +++ b/Library/Homebrew/cask/lib/hbc/installer.rb @@ -18,13 +18,13 @@ module Hbc PERSISTENT_METADATA_SUBDIRS = ["gpg"].freeze - def initialize(cask, command: SystemCommand, force: false, skip_cask_deps: false, require_sha: false, reinstall: false) + def initialize(cask, command: SystemCommand, force: false, skip_cask_deps: false, require_sha: false) @cask = cask @command = command @force = force @skip_cask_deps = skip_cask_deps @require_sha = require_sha - @reinstall = reinstall + @reinstall = false end def self.print_caveats(cask) @@ -94,6 +94,12 @@ module Hbc puts summary end + def reinstall + odebug "Hbc::Installer#reinstall" + @reinstall = true + install + end + def uninstall_if_neccessary return unless @cask.installed? && @reinstall installed_cask = @cask