From 8d6b6a451b854a4958ecd3812794f93afc083578 Mon Sep 17 00:00:00 2001 From: Mike McQuaid <mike@mikemcquaid.com> Date: Tue, 8 Dec 2015 10:40:47 +0000 Subject: [PATCH] brew.rb: handle cask autoinstall when cask tapped. Otherwise it would assume if `cask` was tapped it was also installed. --- Library/brew.rb | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/Library/brew.rb b/Library/brew.rb index 043a86821e..69a0b68e55 100755 --- a/Library/brew.rb +++ b/Library/brew.rb @@ -162,20 +162,26 @@ begin Tap.fetch("Homebrew", "services") end + command_installed = false + if possible_tap && !possible_tap.installed? possible_tap.install + command_installed = true + end - if cmd == "cask" - require "cmd/install" - brew_cask = Formulary.factory("brew-cask") - Homebrew.install_formula(brew_cask) - end + if cmd == "cask" && (brew_cask = Formulary.factory("brew-cask")) \ + && !brew_cask.installed? + require "cmd/install" + Homebrew.install_formula(brew_cask) + command_installed = true + end + if command_installed exec HOMEBREW_BREW_FILE, cmd, *ARGV + else + onoe "Unknown command: #{cmd}" + exit 1 end - - onoe "Unknown command: #{cmd}" - exit 1 end rescue FormulaUnspecifiedError -- GitLab