2015-04-28 22:37:26 -04:00
|
|
|
def cache
|
2015-06-15 21:18:12 -04:00
|
|
|
if ENV["HOMEBREW_CACHE"]
|
|
|
|
Pathname.new(ENV["HOMEBREW_CACHE"]).expand_path
|
2015-04-28 22:37:26 -04:00
|
|
|
else
|
|
|
|
# we do this for historic reasons, however the cache *should* be the same
|
|
|
|
# directory whichever user is used and whatever instance of brew is executed
|
|
|
|
home_cache = Pathname.new("~/Library/Caches/Homebrew").expand_path
|
|
|
|
if home_cache.directory? and home_cache.writable_real?
|
|
|
|
home_cache
|
|
|
|
else
|
|
|
|
Pathname.new("/Library/Caches/Homebrew").extend Module.new {
|
|
|
|
def mkpath
|
|
|
|
unless exist?
|
|
|
|
super
|
|
|
|
chmod 0775
|
|
|
|
end
|
|
|
|
end
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
HOMEBREW_CACHE = cache
|
|
|
|
undef cache
|
|
|
|
|
|
|
|
# Where brews installed via URL are cached
|
|
|
|
HOMEBREW_CACHE_FORMULA = HOMEBREW_CACHE+"Formula"
|
|
|
|
|
2015-08-03 13:09:07 +01:00
|
|
|
unless defined? HOMEBREW_BREW_FILE
|
|
|
|
HOMEBREW_BREW_FILE = ENV["HOMEBREW_BREW_FILE"] || which("brew").to_s
|
2015-04-28 22:37:26 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
# Where we link under
|
|
|
|
HOMEBREW_PREFIX = Pathname.new(HOMEBREW_BREW_FILE).dirname.parent
|
|
|
|
|
|
|
|
# Where .git is found
|
|
|
|
HOMEBREW_REPOSITORY = Pathname.new(HOMEBREW_BREW_FILE).realpath.dirname.parent
|
|
|
|
|
|
|
|
HOMEBREW_LIBRARY = HOMEBREW_REPOSITORY/"Library"
|
|
|
|
HOMEBREW_CONTRIB = HOMEBREW_REPOSITORY/"Library/Contributions"
|
|
|
|
|
|
|
|
# Where we store built products; /usr/local/Cellar if it exists,
|
|
|
|
# otherwise a Cellar relative to the Repository.
|
|
|
|
HOMEBREW_CELLAR = if (HOMEBREW_PREFIX+"Cellar").exist?
|
|
|
|
HOMEBREW_PREFIX+"Cellar"
|
|
|
|
else
|
|
|
|
HOMEBREW_REPOSITORY+"Cellar"
|
|
|
|
end
|
|
|
|
|
2015-08-03 13:09:07 +01:00
|
|
|
HOMEBREW_LOGS = Pathname.new(ENV["HOMEBREW_LOGS"] || "~/Library/Logs/Homebrew/").expand_path
|
2015-04-28 22:37:26 -04:00
|
|
|
|
2015-08-03 13:09:07 +01:00
|
|
|
HOMEBREW_TEMP = Pathname.new(ENV.fetch("HOMEBREW_TEMP", "/tmp"))
|
2015-04-28 22:37:27 -04:00
|
|
|
|
2015-08-03 13:09:07 +01:00
|
|
|
unless defined? HOMEBREW_LIBRARY_PATH
|
2015-04-28 22:37:27 -04:00
|
|
|
HOMEBREW_LIBRARY_PATH = Pathname.new(__FILE__).realpath.parent.join("Homebrew")
|
|
|
|
end
|
|
|
|
|
|
|
|
HOMEBREW_LOAD_PATH = HOMEBREW_LIBRARY_PATH
|