bin/brew: set more HOMEBREW_* env from Bash.

This commit is contained in:
Mike McQuaid 2015-12-25 22:42:00 +00:00
parent 3e0828c29a
commit effca7d9c6
2 changed files with 21 additions and 11 deletions

View File

@ -31,21 +31,16 @@ unless defined? HOMEBREW_BREW_FILE
end end
# Where we link under # Where we link under
HOMEBREW_PREFIX = Pathname.new(HOMEBREW_BREW_FILE).dirname.parent HOMEBREW_PREFIX = Pathname.new(ENV["HOMEBREW_PREFIX"])
# Where .git is found # Where .git is found
HOMEBREW_REPOSITORY = Pathname.new(HOMEBREW_BREW_FILE).realpath.dirname.parent HOMEBREW_REPOSITORY = Pathname.new(ENV["HOMEBREW_REPOSITORY"])
HOMEBREW_LIBRARY = HOMEBREW_REPOSITORY/"Library" HOMEBREW_LIBRARY = Pathname.new(ENV["HOMEBREW_LIBRARY"])
HOMEBREW_CONTRIB = HOMEBREW_REPOSITORY/"Library/Contributions" HOMEBREW_CONTRIB = HOMEBREW_REPOSITORY/"Library/Contributions"
# Where we store built products; /usr/local/Cellar if it exists, # Where we store built products
# otherwise a Cellar relative to the Repository. HOMEBREW_CELLAR = Pathname.new(ENV["HOMEBREW_CELLAR"])
HOMEBREW_CELLAR = if (HOMEBREW_PREFIX+"Cellar").exist?
HOMEBREW_PREFIX+"Cellar"
else
HOMEBREW_REPOSITORY+"Cellar"
end
HOMEBREW_LOGS = Pathname.new(ENV["HOMEBREW_LOGS"] || "~/Library/Logs/Homebrew/").expand_path HOMEBREW_LOGS = Pathname.new(ENV["HOMEBREW_LOGS"] || "~/Library/Logs/Homebrew/").expand_path

View File

@ -21,7 +21,18 @@ then
chdir "$BREW_SYMLINK_DIRECTORY" && pwd -P)" chdir "$BREW_SYMLINK_DIRECTORY" && pwd -P)"
fi fi
BREW_LIBRARY_DIRECTORY="$(chdir "$BREW_FILE_DIRECTORY"/../Library && pwd -P)" HOMEBREW_PREFIX="$(chdir "$(dirname "$(dirname "$HOMEBREW_BREW_FILE")")" && pwd -P)"
HOMEBREW_REPOSITORY="$(chdir "$BREW_FILE_DIRECTORY"/../ && pwd -P)"
HOMEBREW_LIBRARY="$(chdir "$BREW_FILE_DIRECTORY"/../Library && pwd -P)"
# Where we store built products; /usr/local/Cellar if it exists,
# otherwise a Cellar relative to the Repository.
if [ -d "$HOMEBREW_PREFIX/Cellar" ]
then
HOMEBREW_CELLAR="$HOMEBREW_PREFIX/Cellar"
else
HOMEBREW_CELLAR="$HOMEBREW_REPOSITORY/Cellar"
fi
# Users may have these set, pointing the system Ruby # Users may have these set, pointing the system Ruby
# at non-system gem paths # at non-system gem paths
@ -45,5 +56,9 @@ fi
export HOMEBREW_BREW_FILE export HOMEBREW_BREW_FILE
export HOMEBREW_RUBY_PATH export HOMEBREW_RUBY_PATH
export HOMEBREW_PREFIX
export HOMEBREW_REPOSITORY
export HOMEBREW_LIBRARY
export HOMEBREW_CELLAR
exec "$HOMEBREW_RUBY_PATH" -W0 "$BREW_LIBRARY_DIRECTORY/brew.rb" "$@" exec "$HOMEBREW_RUBY_PATH" -W0 "$BREW_LIBRARY_DIRECTORY/brew.rb" "$@"