aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Howell2009-11-07 18:10:30 +0000
committerMax Howell2009-11-08 15:21:15 +0000
commit96d790edc18348ad027f37d5c1ce95f816c35d2d (patch)
tree92f0052370f4dee036c202635b538085355d12b2
parent86516e563fd7cd2d3777010d54cb4991acad844f (diff)
downloadbrew-96d790edc18348ad027f37d5c1ce95f816c35d2d.tar.bz2
Simplify the library path determination code a little
-rwxr-xr-xbin/brew17
1 files changed, 4 insertions, 13 deletions
diff --git a/bin/brew b/bin/brew
index ccb46f3a6..8fcd276c1 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