diff --git a/Library/brew.rb b/Library/brew.rb index 043a86821ea4066ec6f2664f23c64e4d5279193b..69a0b68e5560653d3d4940481c43f377940dfe30 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