aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorAdam Vandenberg2009-10-05 11:52:05 -0700
committerMax Howell2009-11-04 16:27:34 +0000
commit3087888fb0d57fd812faa484fb234c5b748b87a6 (patch)
treed5cfa789d3025bd13fe3e2c91eaf4df70dca081d /Library
parentffe4f25d87741199cfba2052ff810712ef94854b (diff)
downloadbrew-3087888fb0d57fd812faa484fb234c5b748b87a6.tar.bz2
Rewrite of HOMEBREW_ folder locations
This rewrite attempts to sort out where the Prefix, Cellar, and Repository are relative to the real and symlinked 'brew' command. Also included is a --config option which dumps all of these variables. Any top-level script must define a "BREW_FILE" that gives the path to brew as it exists in the path. 'brew' itself just uses __FILE__ and install.rb does a `which brew` (there may be a better way?) The Prefix is always relative to the location of brew as it exists in the path. Thus, whether or not /usr/local/bin/brew is a symlink or real file, the Prefix is always /usr/local. If you have brew in some other prefix, such as /nonstandard/bin/brew, then '/nonstandard/ will be managed by brew instead. The Repository, Cellar, and "Library/Homebrew" required code is always found relative to the "real" path or brew. If brew is a real file in /usr/local/bin/brew, then everything else will be found in /usr/local and we'll expect a /usr/local/.git Otherwise, we dereference brew's symlink and look for everything else relative to that path instead.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/global.rb13
-rwxr-xr-xLibrary/Homebrew/install.rb3
2 files changed, 8 insertions, 8 deletions
diff --git a/Library/Homebrew/global.rb b/Library/Homebrew/global.rb
index 757fb8d74..07c5f315c 100644
--- a/Library/Homebrew/global.rb
+++ b/Library/Homebrew/global.rb
@@ -28,6 +28,8 @@ require 'hardware'
ARGV.extend(HomebrewArgvExtension)
+HOMEBREW_VERSION = 0.4
+HOMEBREW_WWW = 'http://bit.ly/Homebrew'
if Process.uid == 0
# technically this is not the correct place, this cache is for *all users*
@@ -37,14 +39,9 @@ else
HOMEBREW_CACHE=Pathname.new("~/Library/Caches/Homebrew").expand_path
end
-HOMEBREW_PREFIX = (Pathname.getwd+__FILE__).dirname.parent.parent.cleanpath
-HOMEBREW_CELLAR = HOMEBREW_PREFIX+'Cellar'
-HOMEBREW_VERSION = 0.4
-HOMEBREW_WWW = 'http://bit.ly/Homebrew'
-
-# we use Library as we allow people to symlink their Homebrew into another
-# directory so they can hack in one place and use it in another
-HOMEBREW_REPOSITORY = (HOMEBREW_PREFIX+'Library').realpath.parent
+HOMEBREW_PREFIX = Pathname.new(BREW_FILE).dirname.parent # Where we link under
+HOMEBREW_REPOSITORY = Pathname.new(BREW_FILE).realpath.dirname.parent # Where .git is found
+HOMEBREW_CELLAR = HOMEBREW_REPOSITORY+'Cellar' # Where we build into
MACOS_FULL_VERSION = `/usr/bin/sw_vers -productVersion`.chomp
MACOS_VERSION = /(10\.\d+)(\.\d+)?/.match(MACOS_FULL_VERSION).captures.first.to_f
diff --git a/Library/Homebrew/install.rb b/Library/Homebrew/install.rb
index 927e976bc..a27cd2e4f 100755
--- a/Library/Homebrew/install.rb
+++ b/Library/Homebrew/install.rb
@@ -1,4 +1,6 @@
#!/usr/bin/ruby
+BREW_FILE = `which brew`.strip
+
require 'global'
require 'brew.h'
@@ -8,6 +10,7 @@ require 'formula'
require 'hardware'
require 'keg'
+
show_summary_heading = false
def text_for_keg_only_formula f