aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorMax Howell2012-08-28 09:52:13 -0400
committerMax Howell2012-08-29 12:41:36 -0400
commitcf59297ccdecb786ed949d122e4cfeeae9856b12 (patch)
treeb3cf05d83d6a896a30aa251806cb93c41bb28b34 /bin
parent7116a5bd3d9d1cb8866a7bb0650f85cbaf6a1dc5 (diff)
downloadhomebrew-cf59297ccdecb786ed949d122e4cfeeae9856b12.tar.bz2
Make `brew --prefix` very fast
Because people use this in .bash_profile etc. We should be as fast as possible.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/brew5
1 files changed, 5 insertions, 0 deletions
diff --git a/bin/brew b/bin/brew
index 93fbbe9f2..27596b22e 100755
--- a/bin/brew
+++ b/bin/brew
@@ -5,6 +5,11 @@ std_trap = trap("INT") { exit! 130 } # no backtrace thanks
HOMEBREW_BREW_FILE = ENV['HOMEBREW_BREW_FILE'] = File.expand_path(__FILE__)
+if ARGV == %w{--prefix}
+ puts File.dirname(File.dirname(HOMEBREW_BREW_FILE))
+ exit 0
+end
+
require 'pathname'
HOMEBREW_LIBRARY_PATH = Pathname.new(__FILE__).realpath.dirname.parent.join("Library/Homebrew").to_s
$:.unshift(HOMEBREW_LIBRARY_PATH + '/vendor')