From 96d790edc18348ad027f37d5c1ce95f816c35d2d Mon Sep 17 00:00:00 2001 From: Max Howell Date: Sat, 7 Nov 2009 18:10:30 +0000 Subject: [PATCH] Simplify the library path determination code a little --- bin/brew | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/bin/brew b/bin/brew index ccb46f3a63..8fcd276c1f 100755 --- a/bin/brew +++ b/bin/brew @@ -5,19 +5,10 @@ # odd exceptions. Reduce our support burden by showing a user-friendly error. 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 +HOMEBREW_BREW_FILE = ENV['HOMEBREW_BREW_FILE'] = File.expand_path(__FILE__) -def homebrew_rubylib_path - lib_path = "/../../Library/Homebrew" - - # Library/Homebrew is relative to the real path of brew - brew_path = __FILE__ - brew_path = File.readlink(brew_path) if File.symlink? brew_path - return File.expand_path(brew_path+lib_path) -end - -$:.unshift homebrew_rubylib_path +require 'pathname' +$:.unshift((Pathname.new(__FILE__).realpath.dirname.parent+"Library"+"Homebrew").to_s) require 'global' case ARGV.first @@ -65,7 +56,7 @@ HOMEBREW_CACHE: #{HOMEBREW_CACHE} HOMEBREW_REPOSITORY: #{HOMEBREW_REPOSITORY} \tWhere is our .git? -library path: #{homebrew_rubylib_path} +Library path: #{$:.first} \tWhat do we put on the ruby path? EOS end