From ac6b22fd696c02df6b3c53a13afe1a4b5e6922b4 Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Sat, 7 Nov 2015 16:52:01 +0800 Subject: auto install certain external commands Closes Homebrew/homebrew#45773. Signed-off-by: Xu Cheng --- Library/brew.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'Library') diff --git a/Library/brew.rb b/Library/brew.rb index 4d90e0840..043a86821 100755 --- a/Library/brew.rb +++ b/Library/brew.rb @@ -152,6 +152,28 @@ begin elsif (path = which("brew-#{cmd}.rb")) && require?(path) exit Homebrew.failed? ? 1 : 0 else + require "tap" + possible_tap = case cmd + when *%w[brewdle brewdler bundle bundler] + Tap.fetch("Homebrew", "bundle") + when "cask" + Tap.fetch("caskroom", "cask") + when "services" + Tap.fetch("Homebrew", "services") + end + + if possible_tap && !possible_tap.installed? + possible_tap.install + + if cmd == "cask" + require "cmd/install" + brew_cask = Formulary.factory("brew-cask") + Homebrew.install_formula(brew_cask) + end + + exec HOMEBREW_BREW_FILE, cmd, *ARGV + end + onoe "Unknown command: #{cmd}" exit 1 end -- cgit v1.2.3