[fix] `nvm exec`: show “io.js” for io.js versions.
parent
0dd2846215
commit
6fb94e0dab
8
nvm.sh
8
nvm.sh
|
@ -2225,7 +2225,13 @@ nvm() {
|
||||||
return $EXIT_CODE
|
return $EXIT_CODE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ $NVM_SILENT -eq 1 ] || echo "Running node $VERSION$(nvm use --silent "$VERSION" && nvm_print_npm_version)"
|
if [ "${NVM_SILENT:-0}" != '1' ]; then
|
||||||
|
if nvm_is_iojs_version "$VERSION"; then
|
||||||
|
echo "Running io.js $(nvm_strip_iojs_prefix "$VERSION")$(nvm use --silent "$VERSION" && nvm_print_npm_version)"
|
||||||
|
else
|
||||||
|
echo "Running node $VERSION$(nvm use --silent "$VERSION" && nvm_print_npm_version)"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
NODE_VERSION="$VERSION" "$NVM_DIR/nvm-exec" "$@"
|
NODE_VERSION="$VERSION" "$NVM_DIR/nvm-exec" "$@"
|
||||||
;;
|
;;
|
||||||
"ls" | "list" )
|
"ls" | "list" )
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
die () { echo $@ ; exit 1; }
|
||||||
|
|
||||||
|
. ../../../nvm.sh
|
||||||
|
|
||||||
|
nvm use 0.10
|
||||||
|
NPM_VERSION_TEN="$(npm --version)"
|
||||||
|
NODE_VERSION_TEN="$(node --version)"
|
||||||
|
|
||||||
|
nvm use 1.0.0 && [ "$(node --version)" = "v1.0.0" ] || die "\`nvm use\` failed!"
|
||||||
|
NPM_VERSION_ONE="$(npm --version)"
|
||||||
|
|
||||||
|
OUTPUT="$(nvm exec 0.10 npm --version)"
|
||||||
|
EXPECTED_OUTPUT="Running node ${NODE_VERSION_TEN} (npm v${NPM_VERSION_TEN})
|
||||||
|
${NPM_VERSION_TEN}"
|
||||||
|
[ "$OUTPUT" = "$EXPECTED_OUTPUT" ] || die "\`nvm exec\` failed to report node preamble; expected '$EXPECTED_OUTPUT', got '$OUTPUT'"
|
||||||
|
|
||||||
|
OUTPUT="$(nvm exec --silent 0.10 npm --version | head -1)"
|
||||||
|
EXPECTED_OUTPUT="${NPM_VERSION_TEN}"
|
||||||
|
[ "$OUTPUT" = "$EXPECTED_OUTPUT" ] || die "\`nvm exec --silent\` failed to node suppress preamble; expected '$EXPECTED_OUTPUT', got '$OUTPUT'"
|
||||||
|
|
||||||
|
OUTPUT="$(nvm exec 1 npm --version)"
|
||||||
|
EXPECTED_OUTPUT="Running io.js v1.0.0 (npm v${NPM_VERSION_ONE})
|
||||||
|
${NPM_VERSION_ONE}"
|
||||||
|
[ "$OUTPUT" = "$EXPECTED_OUTPUT" ] || die "\`nvm exec\` failed to report io.js preamble; expected '$EXPECTED_OUTPUT', got '$OUTPUT'"
|
||||||
|
|
||||||
|
OUTPUT="$(nvm exec --silent 1 npm --version | head -1)"
|
||||||
|
EXPECTED_OUTPUT="${NPM_VERSION_ONE}"
|
||||||
|
[ "$OUTPUT" = "$EXPECTED_OUTPUT" ] || die "\`nvm exec --silent\` failed to suppress io.js preamble; expected '$EXPECTED_OUTPUT', got '$OUTPUT'"
|
||||||
|
|
|
@ -8,7 +8,7 @@ nvm use 0.10
|
||||||
NPM_VERSION_TEN="$(npm --version)"
|
NPM_VERSION_TEN="$(npm --version)"
|
||||||
TEST_STRING="foo bar"
|
TEST_STRING="foo bar"
|
||||||
|
|
||||||
nvm use 0.11.7 && [ "$(node --version)" = "v0.11.7" ] || die "\`nvm use\` failed!"
|
nvm use 1.0.0 && [ "$(node --version)" = "v1.0.0" ] || die "\`nvm use\` failed!"
|
||||||
|
|
||||||
[ "$(nvm exec 0.10 npm --version | tail -1)" = "$NPM_VERSION_TEN" ] || die "`nvm exec` failed to run with the correct version"
|
[ "$(nvm exec 0.10 npm --version | tail -1)" = "$NPM_VERSION_TEN" ] || die "`nvm exec` failed to run with the correct version"
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ die () { echo $@ ; exit 1; }
|
||||||
nvm use 0.10.7
|
nvm use 0.10.7
|
||||||
NPM_VERSION_TEN="$(npm --version)"
|
NPM_VERSION_TEN="$(npm --version)"
|
||||||
|
|
||||||
nvm use 0.11.7 && [ "$(node --version)" = "v0.11.7" ] || die "\`nvm use\` failed!"
|
nvm use 1.0.0 && [ "$(node --version)" = "v1.0.0" ] || die "\`nvm use\` failed!"
|
||||||
|
|
||||||
echo "0.10.7" > .nvmrc
|
echo "0.10.7" > .nvmrc
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
. ../../../nvm.sh
|
. ../../../nvm.sh
|
||||||
nvm install 0.10.7
|
nvm install 0.10.7
|
||||||
nvm install 0.11.7
|
nvm install 1.0.0
|
||||||
|
|
||||||
if [ -f ".nvmrc" ]; then
|
if [ -f ".nvmrc" ]; then
|
||||||
mv .nvmrc .nvmrc.bak
|
mv .nvmrc .nvmrc.bak
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
. ../../../nvm.sh
|
. ../../../nvm.sh
|
||||||
nvm deactivate
|
nvm deactivate
|
||||||
nvm uninstall v0.10.7
|
nvm uninstall v0.10.7
|
||||||
nvm uninstall v0.11.7
|
nvm uninstall v1.0.0
|
||||||
|
|
||||||
rm .nvmrc
|
rm .nvmrc
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue