Assume people don't change their Homebrew dir

It checks the home directory location and the default Homebrew location
before falling back to `brew --prefix` (Sloooow!)

This also accounts for non macOS systems that don't have Homebrew.
This commit is contained in:
Daniel Barber 2019-07-16 17:47:48 -04:00 committed by Daniel Barber
parent 2af1b50124
commit cdd0d2ced8

View file

@ -3,9 +3,11 @@ PATH="$HOME/.bin:/usr/local/sbin:$PATH"
# load ASDF, either from home dir or brew install # load ASDF, either from home dir or brew install
if [ -f "$HOME/.asdf/asdf.sh" ]; then if [ -f "$HOME/.asdf/asdf.sh" ]; then
. $HOME/.asdf/asdf.sh . "$HOME/.asdf/asdf.sh"
elif ASDF_PREFIX=$(brew --prefix asdf); then elif [ -f "/usr/local/opt/asdf/asdf.sh" ]; then
. $ASDF_PREFIX/asdf.sh . "/usr/local/opt/asdf/asdf.sh"
elif which brew >/dev/null && ASDF_PREFIX=$(brew --prefix asdf); then
. "$ASDF_PREFIX/asdf.sh"
fi fi
# mkdir .git/safe in the root of repositories you trust # mkdir .git/safe in the root of repositories you trust