[New] After installing, ensure that the default is set.

Jordan Harband 2016-02-04 00:26:33 -08:00
parent 731c2f3f70
commit 44541b416f
4 changed files with 14 additions and 0 deletions

2
nvm.sh
View File

@ -1730,6 +1730,7 @@ nvm() {
if nvm use "$VERSION" && [ ! -z "$REINSTALL_PACKAGES_FROM" ] && [ "_$REINSTALL_PACKAGES_FROM" != "_N/A" ]; then
nvm reinstall-packages "$REINSTALL_PACKAGES_FROM"
fi
nvm_ensure_default_set "$provided_version"
return $?
fi
@ -1775,6 +1776,7 @@ nvm() {
fi
if [ "$NVM_INSTALL_SUCCESS" = true ] && nvm use "$VERSION"; then
nvm_ensure_default_set "$provided_version"
if [ ! -z "$REINSTALL_PACKAGES_FROM" ] \
&& [ "_$REINSTALL_PACKAGES_FROM" != "_N/A" ]; then
nvm reinstall-packages "$REINSTALL_PACKAGES_FROM"

View File

@ -4,6 +4,8 @@ die () { echo $@ ; exit 1; }
. ../../../nvm.sh
nvm unalias default || die 'unable to unalias default'
NVM_TEST_VERSION=v0.10.7
# Remove the stuff we're clobbering.
@ -16,3 +18,6 @@ nvm install $NVM_TEST_VERSION || die "install $NVM_TEST_VERSION failed"
[ -d ../../../$NVM_TEST_VERSION ]
nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION || die "'nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION' failed"
# ensure default is set
NVM_CURRENT_DEFAULT="$(nvm_alias default)"
[ "$NVM_CURRENT_DEFAULT" = "$NVM_TEST_VERSION" ] || die "wrong default alias: $(nvm alias)"

View File

@ -4,6 +4,8 @@ die () { echo $@ ; exit 1; }
. ../../../nvm.sh
nvm unalias default || die 'unable to unalias default'
NVM_TEST_VERSION=v0.10.7
# Remove the stuff we're clobbering.
@ -16,3 +18,6 @@ nvm install -s $NVM_TEST_VERSION || die "'nvm install -s $NVM_TEST_VERSION' fail
[ -d ../../../$NVM_TEST_VERSION ]
nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION || "'nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION' failed"
# ensure default is set
NVM_CURRENT_DEFAULT="$(nvm_alias default)"
[ "$NVM_CURRENT_DEFAULT" = "$NVM_TEST_VERSION" ] || die "wrong default alias: $(nvm alias)"

View File

@ -1,6 +1,7 @@
#!/bin/sh
mkdir -p ../../alias
rm -rf ../../alias/default
rm -f ../../.nvmrc
rm -rf ../../v0.10.7
rm -rf ../../v0.9.7
@ -8,5 +9,6 @@ rm -rf ../../v0.9.12
. ../../nvm.sh
nvm install 0.10.1 || echo >&2 'nvm install 0.10.1 failed'
nvm unalias default || 'removing default alias failed'
nvm unload || echo >&2 'nvm unload failed'