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
This commit is contained in:
Joshua McKinney 2017-03-27 01:31:29 -05:00
parent 437db065ca
commit a90d1e1699
2 changed files with 9 additions and 4 deletions

View File

@ -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

View File

@ -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