aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorXu Cheng2015-11-07 16:52:01 +0800
committerXu Cheng2015-11-09 15:34:20 +0800
commitac6b22fd696c02df6b3c53a13afe1a4b5e6922b4 (patch)
treeca4b6b2a8f6b135fa78f52e66f43da2939a26a8f /Library
parent82689d81f71082416eff8c737deefa5523a10cfb (diff)
downloadbrew-ac6b22fd696c02df6b3c53a13afe1a4b5e6922b4.tar.bz2
auto install certain external commands
Closes Homebrew/homebrew#45773. Signed-off-by: Xu Cheng <xucheng@me.com>
Diffstat (limited to 'Library')
-rwxr-xr-xLibrary/brew.rb22
1 files changed, 22 insertions, 0 deletions
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