2019-02-19 13:11:32 +00:00
|
|
|
raise "HOMEBREW_BREW_FILE was not exported! Please call bin/brew directly!" unless ENV["HOMEBREW_BREW_FILE"]
|
2019-01-12 15:59:08 +00:00
|
|
|
|
|
|
|
# Path to `bin/brew` main executable in `HOMEBREW_PREFIX`
|
|
|
|
HOMEBREW_BREW_FILE = Pathname.new(ENV["HOMEBREW_BREW_FILE"])
|
|
|
|
|
|
|
|
class MissingEnvironmentVariables < RuntimeError; end
|
|
|
|
|
|
|
|
def get_env_or_raise(env)
|
2019-02-19 13:11:32 +00:00
|
|
|
raise MissingEnvironmentVariables, "#{env} was not exported!" unless ENV[env]
|
2019-02-19 13:12:52 +00:00
|
|
|
|
2019-01-09 17:03:02 +00:00
|
|
|
ENV[env]
|
2015-04-28 22:37:26 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
# Where we link under
|
2019-01-09 17:03:02 +00:00
|
|
|
HOMEBREW_PREFIX = Pathname.new(get_env_or_raise("HOMEBREW_PREFIX"))
|
2015-04-28 22:37:26 -04:00
|
|
|
|
2018-10-18 21:42:43 -04:00
|
|
|
# Where `.git` is found
|
2019-01-09 17:03:02 +00:00
|
|
|
HOMEBREW_REPOSITORY = Pathname.new(get_env_or_raise("HOMEBREW_REPOSITORY"))
|
2015-04-28 22:37:26 -04:00
|
|
|
|
2016-07-02 06:03:04 +02:00
|
|
|
# Where we store most of Homebrew, taps, and various metadata
|
2019-01-09 17:03:02 +00:00
|
|
|
HOMEBREW_LIBRARY = Pathname.new(get_env_or_raise("HOMEBREW_LIBRARY"))
|
2016-07-02 06:03:04 +02:00
|
|
|
|
2016-07-15 19:03:45 +01:00
|
|
|
# Where shim scripts for various build and SCM tools are stored
|
|
|
|
HOMEBREW_SHIMS_PATH = HOMEBREW_LIBRARY/"Homebrew/shims"
|
2015-04-28 22:37:26 -04:00
|
|
|
|
2016-09-16 13:51:21 +01:00
|
|
|
# Where we store symlinks to currently linked kegs
|
2016-09-17 15:00:46 +01:00
|
|
|
HOMEBREW_LINKED_KEGS = HOMEBREW_PREFIX/"var/homebrew/linked"
|
2016-09-16 13:51:21 +01:00
|
|
|
|
2016-09-17 13:25:32 +01:00
|
|
|
# Where we store symlinks to currently version-pinned kegs
|
2016-09-17 15:00:46 +01:00
|
|
|
HOMEBREW_PINNED_KEGS = HOMEBREW_PREFIX/"var/homebrew/pinned"
|
2016-09-16 13:51:21 +01:00
|
|
|
|
2016-06-08 17:29:03 +08:00
|
|
|
# Where we store lock files
|
2018-09-06 18:38:43 +01:00
|
|
|
HOMEBREW_LOCKS = HOMEBREW_PREFIX/"var/homebrew/locks"
|
2016-06-08 17:29:03 +08:00
|
|
|
|
2015-12-25 22:42:00 +00:00
|
|
|
# Where we store built products
|
2019-01-09 17:03:02 +00:00
|
|
|
HOMEBREW_CELLAR = Pathname.new(get_env_or_raise("HOMEBREW_CELLAR"))
|
2015-04-28 22:37:26 -04:00
|
|
|
|
2016-05-03 16:01:42 +08:00
|
|
|
# Where downloads (bottles, source tarballs, etc.) are cached
|
2019-01-09 17:03:02 +00:00
|
|
|
HOMEBREW_CACHE = Pathname.new(get_env_or_raise("HOMEBREW_CACHE"))
|
2016-05-03 16:01:42 +08:00
|
|
|
|
|
|
|
# Where brews installed via URL are cached
|
|
|
|
HOMEBREW_CACHE_FORMULA = HOMEBREW_CACHE/"Formula"
|
|
|
|
|
2016-07-02 06:03:04 +02:00
|
|
|
# Where build, postinstall, and test logs of formulae are written to
|
2019-01-09 17:03:02 +00:00
|
|
|
HOMEBREW_LOGS = Pathname.new(get_env_or_raise("HOMEBREW_LOGS")).expand_path
|
2015-04-28 22:37:26 -04:00
|
|
|
|
2018-10-18 21:42:43 -04:00
|
|
|
# Must use `/tmp` instead of `TMPDIR` because long paths break Unix domain sockets
|
2018-07-03 15:41:33 +01:00
|
|
|
HOMEBREW_TEMP = begin
|
2019-01-09 17:03:02 +00:00
|
|
|
tmp = Pathname.new(get_env_or_raise("HOMEBREW_TEMP"))
|
2018-07-03 15:41:33 +01:00
|
|
|
tmp.mkpath unless tmp.exist?
|
|
|
|
tmp.realpath
|
|
|
|
end
|