From 86516e563fd7cd2d3777010d54cb4991acad844f Mon Sep 17 00:00:00 2001 From: Max Howell Date: Sat, 7 Nov 2009 18:09:48 +0000 Subject: [PATCH] Set ENV[HOMEBREW_BREW_FILE] Thus install.rb gets the path to the instantiating brew process rather than whichever is first in the PATH. Not to mention Homebrew doesn't *have* to be in the PATH. --- Library/Homebrew/global.rb | 4 ++++ Library/Homebrew/install.rb | 2 -- bin/brew | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/global.rb b/Library/Homebrew/global.rb index 52f3dd6a86..05fc144e2d 100644 --- a/Library/Homebrew/global.rb +++ b/Library/Homebrew/global.rb @@ -38,6 +38,10 @@ else HOMEBREW_CACHE=Pathname.new("~/Library/Caches/Homebrew").expand_path end +if not defined? HOMEBREW_BREW_FILE + HOMEBREW_BREW_FILE = ENV['HOMEBREW_BREW_FILE'] or `which brew`.chomp +end + HOMEBREW_PREFIX = Pathname.new(HOMEBREW_BREW_FILE).dirname.parent # Where we link under HOMEBREW_REPOSITORY = Pathname.new(HOMEBREW_BREW_FILE).realpath.dirname.parent # Where .git is found diff --git a/Library/Homebrew/install.rb b/Library/Homebrew/install.rb index 887705e707..24fb82148b 100755 --- a/Library/Homebrew/install.rb +++ b/Library/Homebrew/install.rb @@ -1,6 +1,4 @@ #!/usr/bin/ruby -HOMEBREW_BREW_FILE = `which brew`.strip - require 'global' def text_for_keg_only_formula f diff --git a/bin/brew b/bin/brew index 57352b4a14..ccb46f3a63 100755 --- a/bin/brew +++ b/bin/brew @@ -6,6 +6,7 @@ Dir.getwd rescue abort "The current working directory doesn't exist, cannot proceed." HOMEBREW_BREW_FILE = File.expand_path __FILE__ +ENV['HOMEBREW_BREW_FILE'] = HOMEBREW_BREW_FILE def homebrew_rubylib_path lib_path = "/../../Library/Homebrew"