Skip sourcing nvm.sh if it's already available

This commit is contained in:
Thomas Goyne 2017-09-18 16:19:33 -07:00
parent ada601354c
commit 5189915980

View File

@ -232,12 +232,16 @@ cleanup
trap cleanup EXIT trap cleanup EXIT
# Use a consistent version of Node if possible. # Use a consistent version of Node if possible.
if [ -f "$NVM_DIR/nvm.sh" ]; then if [[ -z "$(command -v nvm)" ]]; then
. "$NVM_DIR/nvm.sh" || true if [ -f "$NVM_DIR/nvm.sh" ]; then
elif [ -x "$(command -v brew)" ] && [ -f "$(brew --prefix nvm)/nvm.sh" ]; then . "$NVM_DIR/nvm.sh" || true
# we must be on mac and nvm was installed with brew elif [ -x "$(command -v brew)" ] && [ -f "$(brew --prefix nvm)/nvm.sh" ]; then
# TODO: change the mac slaves to use manual nvm installation # we must be on mac and nvm was installed with brew
. "$(brew --prefix nvm)/nvm.sh" || true # TODO: change the mac slaves to use manual nvm installation
. "$(brew --prefix nvm)/nvm.sh" || true
elif [ -f "$HOME/.nvm/nvm.sh" ]; then
. ~/.nvm/nvm.sh
fi
fi fi
if [[ "$(command -v nvm)" ]]; then if [[ "$(command -v nvm)" ]]; then
nvm install 6.5.0 nvm install 6.5.0