Copy packages when applicable, whenever `nvm install` would normally `nvm use` and exit.
parent
622fdd2cd0
commit
486d14f5f8
14
nvm.sh
14
nvm.sh
|
@ -496,7 +496,9 @@ nvm() {
|
||||||
|
|
||||||
if [ -d "$(nvm_version_path "$VERSION")" ]; then
|
if [ -d "$(nvm_version_path "$VERSION")" ]; then
|
||||||
echo "$VERSION is already installed." >&2
|
echo "$VERSION is already installed." >&2
|
||||||
nvm use "$VERSION"
|
if nvm use "$VERSION" && [ ! -z "$COPY_PACKAGES_FROM" ] && [ "~$COPY_PACKAGES_FROM" != "~N/A" ]; then
|
||||||
|
nvm copy-packages "$COPY_PACKAGES_FROM"
|
||||||
|
fi
|
||||||
return $?
|
return $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -526,7 +528,9 @@ nvm() {
|
||||||
mv "$tmpdir" "$(nvm_version_path "$VERSION")"
|
mv "$tmpdir" "$(nvm_version_path "$VERSION")"
|
||||||
)
|
)
|
||||||
then
|
then
|
||||||
nvm use $VERSION
|
if nvm use "$VERSION" && [ ! -z "$COPY_PACKAGES_FROM" ] && [ "~$COPY_PACKAGES_FROM" != "~N/A" ]; then
|
||||||
|
nvm copy-packages "$COPY_PACKAGES_FROM"
|
||||||
|
fi
|
||||||
return $?
|
return $?
|
||||||
else
|
else
|
||||||
echo "Binary download failed, trying source." >&2
|
echo "Binary download failed, trying source." >&2
|
||||||
|
@ -570,7 +574,9 @@ nvm() {
|
||||||
$make $MAKE_CXX install
|
$make $MAKE_CXX install
|
||||||
)
|
)
|
||||||
then
|
then
|
||||||
nvm use $VERSION
|
if nvm use "$VERSION" && [ ! -z "$COPY_PACKAGES_FROM" ] && [ "~$COPY_PACKAGES_FROM" != "~N/A" ]; then
|
||||||
|
nvm copy-packages "$COPY_PACKAGES_FROM"
|
||||||
|
fi
|
||||||
if ! nvm_has "npm" ; then
|
if ! nvm_has "npm" ; then
|
||||||
echo "Installing npm..."
|
echo "Installing npm..."
|
||||||
if nvm_version_greater 0.2.0 "$VERSION"; then
|
if nvm_version_greater 0.2.0 "$VERSION"; then
|
||||||
|
@ -589,6 +595,8 @@ nvm() {
|
||||||
echo "nvm: install $VERSION failed!" >&2
|
echo "nvm: install $VERSION failed!" >&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
return $?
|
||||||
;;
|
;;
|
||||||
"uninstall" )
|
"uninstall" )
|
||||||
[ $# -ne 2 ] && nvm help && return
|
[ $# -ne 2 ] && nvm help && return
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
die () { echo $@ ; exit 1; }
|
||||||
|
|
||||||
|
. ../../nvm.sh
|
||||||
|
|
||||||
|
# Remove the stuff we're clobbering.
|
||||||
|
[ -e ../../v0.9.7 ] && rm -R ../../v0.9.7
|
||||||
|
[ -e ../../v0.9.12 ] && rm -R ../../v0.9.12
|
||||||
|
|
||||||
|
# Install from binary
|
||||||
|
nvm install 0.9.7
|
||||||
|
|
||||||
|
# Check
|
||||||
|
[ -d ../../v0.9.7 ] || die "nvm install 0.9.7 didn't install"
|
||||||
|
|
||||||
|
nvm use 0.9.7
|
||||||
|
|
||||||
|
node --version | grep v0.9.7 > /dev/null || die "nvm use 0.9.7 failed"
|
||||||
|
|
||||||
|
npm install -g is-nan@1.0.1 || die "npm install -g is-nan failed"
|
||||||
|
npm list --global | grep is-nan > /dev/null || die "is-nan isn't installed"
|
||||||
|
|
||||||
|
nvm ls 0.9 | grep v0.9.7 > /dev/null || die "nvm ls 0.9 didn't show v0.9.7"
|
||||||
|
|
||||||
|
nvm install 0.9.12 --copy-packages-from=0.9 || die "nvm install 0.9.12 --copy-packages-from=0.9 failed"
|
||||||
|
|
||||||
|
[ -d ../../v0.9.12 ] || die "nvm install 0.9.12 didn't install"
|
||||||
|
|
||||||
|
nvm use 0.9
|
||||||
|
node --version | grep v0.9.12 > /dev/null || die "nvm ls 0.9 didn't use v0.9.12"
|
||||||
|
|
||||||
|
npm list --global | grep is-nan > /dev/null || die "is-nan isn't installed"
|
||||||
|
|
Loading…
Reference in New Issue