Compare commits

...

16 Commits

Author SHA1 Message Date
Jordan Harband
2176894a5b v0.31.0 2016-02-15 09:18:15 -08:00
Jordan Harband
cf7d5d8042 Merge pull request #1011 from dohse/keep-parameters
[Fix] Do not modify args of sourcing script when parsing `--install`/`--no-use` arg

Fixes #976.
2016-02-15 09:17:24 -08:00
Jonas Dohse
7135873f80 Do not modify parameters of sourcing script in zsh
When sourcing a script without parameters in zsh the sourced scripts
gets the same parameters as the sourcing file and is able to modify
these parameters. Prevent nvm from removing all parameters of sourcing
script by processing a copy of the parameters in a function.
2016-02-15 17:49:46 +01:00
Jordan Harband
dc9020b133 Merge pull request #1004 from tlevine/env-bash
[Fix] use env bash rather than /bin/bash
2016-02-14 12:05:10 -08:00
Thomas Levine
0eaa7e0bde use env bash in nvm-exec and install.sh 2016-02-14 19:34:19 +00:00
Thomas Levine
06b81f0f36 use env bash rather than /bin/bash
My bash is not installed in /bin/bash.
2016-02-14 19:34:19 +00:00
gmisra
8a20234586 Document how to reload nvm after upgrading 2016-02-09 19:12:22 -08:00
Jordan Harband
44541b416f [New] After installing, ensure that the default is set. 2016-02-04 00:26:33 -08:00
Jordan Harband
731c2f3f70 Add nvm_get_minor_version 2016-02-04 11:16:09 -08:00
Jordan Harband
de64a2d95f [Fix] nvm_format_version should only return 3 version groups 2016-02-06 22:34:49 -08:00
Jordan Harband
77e0449c89 [Fix] nvm-exec: properly exit when failing; improve error messages, suppress nvm use --help output
Fixes #997.
2016-02-04 11:19:34 -08:00
Sébastien Larivière
649e416017 [Refactor]Double quote to prevent globbing and word splitting. 2016-01-30 22:17:15 -05:00
Jordan Harband
754a0d7c5b Merge pull request #981 from woodb/node-v4-checksums
[New] Added support for sha256 checksums on `io.js` / merged `node`.

Fixes #664, relates to #736 and #687.
2016-01-24 10:40:06 -08:00
Brandon Wood
f73bfb6578 Updated warning message when sha256sum utility not found
Relates to @ljharb's comment on the warning message not including all of the
utilties searched for.

https://github.com/creationix/nvm/pull/981#discussion_r50638351
2016-01-24 11:53:19 -06:00
Brandon Wood
f1bca106a8 Added (optional) support for sha256 checksum utils
This commit adds (optional) support for additional sha256 checksum utilities
for newer versions of node.js and io.js that use sha256 checksums rather than
sha1.

If nothing is found to do a sha256 checksum on the client machine, a warning is
printed and things continue on as normal.

Following comments from @ljharb on incorporating some of @DomT4's PR
creationix/nvm#664, and making this checksum optional.  If I could I would
gladly include this as an addon to the now closed PR creationix/nvm#664. I am
choosing not to file it onto that PR because it's closed and (currently)
significantly behind the master branch.

@DomT4 did the hard work of actually finding all the different ways in which
one could verify a sha256 checksum, I've just included those here in an effort
to move forward with sha256 checksum support.
2016-01-24 10:31:26 -06:00
Brandon Wood
560c8c9500 Added support for sha256 checksums 2016-01-23 21:25:03 -06:00
13 changed files with 180 additions and 48 deletions

View File

@@ -25,11 +25,11 @@ Homebrew installation is not supported.
To install or update nvm, you can use the [install script][2] using cURL: To install or update nvm, you can use the [install script][2] using cURL:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.30.2/install.sh | bash curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash
or Wget: or Wget:
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.30.2/install.sh | bash wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash
<sub>The script clones the nvm repository to `~/.nvm` and adds the source line to your profile (`~/.bash_profile`, `~/.zshrc` or `~/.profile`).</sub> <sub>The script clones the nvm repository to `~/.nvm` and adds the source line to your profile (`~/.bash_profile`, `~/.zshrc` or `~/.profile`).</sub>
@@ -61,6 +61,10 @@ For manual upgrade with `git`, change to the `$NVM_DIR`, pull down the latest ch
cd "$NVM_DIR" && git pull origin master && git checkout `git describe --abbrev=0 --tags` cd "$NVM_DIR" && git pull origin master && git checkout `git describe --abbrev=0 --tags`
After upgrading, don't forget to activate the new version:
. "$NVM_DIR/nvm.sh"
## Usage ## Usage
You can create an `.nvmrc` file containing version number in the project root directory (or any parent directory). You can create an `.nvmrc` file containing version number in the project root directory (or any parent directory).
@@ -260,7 +264,7 @@ After the v0.8.6 release of node, nvm tries to install from binary packages. But
If setting the `default` alias does not establish the node version in new shells (i.e. `nvm current` yields `system`), ensure that the system's node PATH is set before the `nvm.sh` source line in your shell profile (see [#658](https://github.com/creationix/nvm/issues/658)) If setting the `default` alias does not establish the node version in new shells (i.e. `nvm current` yields `system`), ensure that the system's node PATH is set before the `nvm.sh` source line in your shell profile (see [#658](https://github.com/creationix/nvm/issues/658))
[1]: https://github.com/creationix/nvm.git [1]: https://github.com/creationix/nvm.git
[2]: https://github.com/creationix/nvm/blob/v0.30.2/install.sh [2]: https://github.com/creationix/nvm/blob/v0.31.0/install.sh
[3]: https://travis-ci.org/creationix/nvm [3]: https://travis-ci.org/creationix/nvm
[Urchin]: https://github.com/scraperwiki/urchin [Urchin]: https://github.com/scraperwiki/urchin
[Fish]: http://fishshell.com [Fish]: http://fishshell.com

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
{ # this ensures the entire script is downloaded # { # this ensures the entire script is downloaded #
@@ -11,7 +11,7 @@ if [ -z "$NVM_DIR" ]; then
fi fi
nvm_latest_version() { nvm_latest_version() {
echo "v0.30.2" echo "v0.31.0"
} }
# #
@@ -69,7 +69,7 @@ install_nvm_from_git() {
mkdir -p "$NVM_DIR" mkdir -p "$NVM_DIR"
command git clone "$(nvm_source git)" "$NVM_DIR" command git clone "$(nvm_source git)" "$NVM_DIR"
fi fi
cd "$NVM_DIR" && command git checkout --quiet $(nvm_latest_version) cd "$NVM_DIR" && command git checkout --quiet "$(nvm_latest_version)"
if [ ! -z "$(cd "$NVM_DIR" && git show-ref refs/heads/master)" ]; then if [ ! -z "$(cd "$NVM_DIR" && git show-ref refs/heads/master)" ]; then
if git branch --quiet 2>/dev/null; then if git branch --quiet 2>/dev/null; then
cd "$NVM_DIR" && command git branch --quiet -D master >/dev/null 2>&1 cd "$NVM_DIR" && command git branch --quiet -D master >/dev/null 2>&1
@@ -123,15 +123,15 @@ nvm_detect_profile() {
local DETECTED_PROFILE local DETECTED_PROFILE
DETECTED_PROFILE='' DETECTED_PROFILE=''
local SHELLTYPE local SHELLTYPE
SHELLTYPE="$(basename /$SHELL)" SHELLTYPE="$(basename "/$SHELL")"
if [ $SHELLTYPE = "bash" ]; then if [ "$SHELLTYPE" = "bash" ]; then
if [ -f "$HOME/.bashrc" ]; then if [ -f "$HOME/.bashrc" ]; then
DETECTED_PROFILE="$HOME/.bashrc" DETECTED_PROFILE="$HOME/.bashrc"
elif [ -f "$HOME/.bash_profile" ]; then elif [ -f "$HOME/.bash_profile" ]; then
DETECTED_PROFILE="$HOME/.bash_profile" DETECTED_PROFILE="$HOME/.bash_profile"
fi fi
elif [ $SHELLTYPE = "zsh" ]; then elif [ "$SHELLTYPE" = "zsh" ]; then
DETECTED_PROFILE="$HOME/.zshrc" DETECTED_PROFILE="$HOME/.zshrc"
fi fi

View File

@@ -1,13 +1,14 @@
#!/bin/bash #!/usr/bin/env bash
DIR="$(command cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" DIR="$(command cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. "$DIR/nvm.sh" --no-use . "$DIR/nvm.sh" --no-use
if [ -n "$NODE_VERSION" ]; then if [ -n "$NODE_VERSION" ]; then
nvm use $NODE_VERSION > /dev/null || (echo "NODE_VERSION not set" >&2 && exit 127) nvm use $NODE_VERSION > /dev/null || exit 127
else elif ! nvm use >/dev/null 2>&1; then
nvm use > /dev/null || (echo "No .nvmrc file found" >&2 && exit 127) echo "No NODE_VERSION provided; no .nvmrc file found" >&2
exit 127
fi fi
exec "$@" exec "$@"

82
nvm.sh
View File

@@ -339,10 +339,12 @@ nvm_ensure_version_prefix() {
nvm_format_version() { nvm_format_version() {
local VERSION local VERSION
VERSION="$(nvm_ensure_version_prefix "$1")" VERSION="$(nvm_ensure_version_prefix "$1")"
if [ "_$(nvm_num_version_groups "$VERSION")" != "_3" ]; then local NUM_GROUPS
NUM_GROUPS="$(nvm_num_version_groups "$VERSION")"
if [ $NUM_GROUPS -lt 3 ]; then
nvm_format_version "${VERSION%.}.0" nvm_format_version "${VERSION%.}.0"
else else
echo "$VERSION" echo "$VERSION" | cut -f1-3 -d.
fi fi
} }
@@ -759,6 +761,7 @@ nvm_ls_remote_index_tab() {
nvm_checksum() { nvm_checksum() {
local NVM_CHECKSUM local NVM_CHECKSUM
if [ -z "$3" ] || [ "$3" == "sha1" ]; then
if nvm_has "sha1sum" && ! nvm_is_alias "sha1sum"; then if nvm_has "sha1sum" && ! nvm_is_alias "sha1sum"; then
NVM_CHECKSUM="$(command sha1sum "$1" | command awk '{print $1}')" NVM_CHECKSUM="$(command sha1sum "$1" | command awk '{print $1}')"
elif nvm_has "sha1" && ! nvm_is_alias "sha1"; then elif nvm_has "sha1" && ! nvm_is_alias "sha1"; then
@@ -769,6 +772,27 @@ nvm_checksum() {
echo "Unaliased sha1sum, sha1, or shasum not found." >&2 echo "Unaliased sha1sum, sha1, or shasum not found." >&2
return 2 return 2
fi fi
else
if nvm_has "sha256sum" && ! nvm_is_alias "sha256sum"; then
NVM_CHECKSUM="$(sha256sum "$1" | awk '{print $1}')"
elif nvm_has "shasum" && ! nvm_is_alias "shasum"; then
NVM_CHECKSUM="$(shasum -a 256 "$1" | awk '{print $1}')"
elif nvm_has "sha256" && ! nvm_is_alias "sha256"; then
NVM_CHECKSUM="$(sha256 -q "$1" | awk '{print $1}')"
elif nvm_has "gsha256sum" && ! nvm_is_alias "gsha256sum"; then
NVM_CHECKSUM="$(gsha256sum "$1" | awk '{print $1}')"
elif nvm_has "openssl" && ! nvm_is_alias "openssl"; then
NVM_CHECKSUM="$(openssl dgst -sha256 "$1" | rev | awk '{print $1}' | rev)"
elif nvm_has "libressl" && ! nvm_is_alias "libressl"; then
NVM_CHECKSUM="$(libressl dgst -sha256 "$1" | rev | awk '{print $1}' | rev)"
elif nvm_has "bssl" && ! nvm_is_alias "bssl"; then
NVM_CHECKSUM="$(bssl sha256sum "$1" | awk '{print $1}')"
else
echo "Unaliased sha256sum, shasum, sha256, gsha256sum, openssl, libressl, or bssl not found." >&2
echo "WARNING: Continuing *without checksum verification*" >&2
return
fi
fi
if [ "_$NVM_CHECKSUM" = "_$2" ]; then if [ "_$NVM_CHECKSUM" = "_$2" ]; then
return return
@@ -971,6 +995,34 @@ nvm_get_arch() {
echo "$NVM_ARCH" echo "$NVM_ARCH"
} }
nvm_get_minor_version() {
local VERSION
VERSION="$1"
if [ -z "$VERSION" ]; then
echo 'a version is required' >&2
return 1
fi
case "$VERSION" in
v | .* | *..* | v*[!.0123456789]* | [!v]*[!.0123456789]* | [!v0123456789]* | v[!0123456789]*)
echo 'invalid version number' >&2
return 2
;;
esac
local PREFIXED_VERSION
PREFIXED_VERSION="$(nvm_format_version "$VERSION")"
local MINOR
MINOR="$(echo "$PREFIXED_VERSION" | command grep -e '^v' | command cut -c2- | command cut -d . -f 1,2)"
if [ -z "$MINOR" ]; then
echo 'invalid version number! (please report this)' >&2
return 3
fi
echo "$MINOR"
}
nvm_ensure_default_set() { nvm_ensure_default_set() {
local VERSION local VERSION
VERSION="$1" VERSION="$1"
@@ -1051,8 +1103,7 @@ nvm_install_merged_node_binary() {
fi fi
if ( if (
[ "$NVM_INSTALL_ERRORED" != true ] && \ [ "$NVM_INSTALL_ERRORED" != true ] && \
echo "WARNING: checksums are currently disabled for node.js v4.0 and later" >&2 && \ nvm_checksum "$tmptarball" "$sum" "sha256" && \
# nvm_checksum "$tmptarball" "$sum" && \
command tar -x${tar_compression_flag}f "$tmptarball" -C "$tmpdir" --strip-components 1 && \ command tar -x${tar_compression_flag}f "$tmptarball" -C "$tmpdir" --strip-components 1 && \
command rm -f "$tmptarball" && \ command rm -f "$tmptarball" && \
command mkdir -p "$VERSION_PATH" && \ command mkdir -p "$VERSION_PATH" && \
@@ -1126,8 +1177,7 @@ nvm_install_iojs_binary() {
fi fi
if ( if (
[ "$NVM_INSTALL_ERRORED" != true ] && \ [ "$NVM_INSTALL_ERRORED" != true ] && \
echo "WARNING: checksums are currently disabled for io.js" >&2 && \ nvm_checksum "$tmptarball" "$sum" "sha256" && \
# nvm_checksum "$tmptarball" "$sum" && \
command tar -x${tar_compression_flag}f "$tmptarball" -C "$tmpdir" --strip-components 1 && \ command tar -x${tar_compression_flag}f "$tmptarball" -C "$tmpdir" --strip-components 1 && \
command rm -f "$tmptarball" && \ command rm -f "$tmptarball" && \
command mkdir -p "$VERSION_PATH" && \ command mkdir -p "$VERSION_PATH" && \
@@ -1680,6 +1730,7 @@ nvm() {
if nvm use "$VERSION" && [ ! -z "$REINSTALL_PACKAGES_FROM" ] && [ "_$REINSTALL_PACKAGES_FROM" != "_N/A" ]; then if nvm use "$VERSION" && [ ! -z "$REINSTALL_PACKAGES_FROM" ] && [ "_$REINSTALL_PACKAGES_FROM" != "_N/A" ]; then
nvm reinstall-packages "$REINSTALL_PACKAGES_FROM" nvm reinstall-packages "$REINSTALL_PACKAGES_FROM"
fi fi
nvm_ensure_default_set "$provided_version"
return $? return $?
fi fi
@@ -1725,6 +1776,7 @@ nvm() {
fi fi
if [ "$NVM_INSTALL_SUCCESS" = true ] && nvm use "$VERSION"; then if [ "$NVM_INSTALL_SUCCESS" = true ] && nvm use "$VERSION"; then
nvm_ensure_default_set "$provided_version"
if [ ! -z "$REINSTALL_PACKAGES_FROM" ] \ if [ ! -z "$REINSTALL_PACKAGES_FROM" ] \
&& [ "_$REINSTALL_PACKAGES_FROM" != "_N/A" ]; then && [ "_$REINSTALL_PACKAGES_FROM" != "_N/A" ]; then
nvm reinstall-packages "$REINSTALL_PACKAGES_FROM" nvm reinstall-packages "$REINSTALL_PACKAGES_FROM"
@@ -2300,7 +2352,7 @@ $NVM_LS_REMOTE_POST_MERGED_OUTPUT" | command grep -v "N/A" | command sed '/^$/d'
nvm_remote_version "$2" nvm_remote_version "$2"
;; ;;
"--version" ) "--version" )
echo "0.30.2" echo "0.31.0"
;; ;;
"unload" ) "unload" )
unset -f nvm nvm_print_versions nvm_checksum \ unset -f nvm nvm_print_versions nvm_checksum \
@@ -2325,7 +2377,8 @@ $NVM_LS_REMOTE_POST_MERGED_OUTPUT" | command grep -v "N/A" | command sed '/^$/d'
nvm_print_npm_version nvm_npm_global_modules \ nvm_print_npm_version nvm_npm_global_modules \
nvm_has_system_node nvm_has_system_iojs \ nvm_has_system_node nvm_has_system_iojs \
nvm_download nvm_get_latest nvm_has nvm_get_latest \ nvm_download nvm_get_latest nvm_has nvm_get_latest \
nvm_supports_source_options nvm_auto nvm_supports_xz > /dev/null 2>&1 nvm_supports_source_options nvm_auto nvm_supports_xz \
nvm_process_parameters > /dev/null 2>&1
unset RC_VERSION NVM_NODEJS_ORG_MIRROR NVM_DIR NVM_CD_FLAGS > /dev/null 2>&1 unset RC_VERSION NVM_NODEJS_ORG_MIRROR NVM_DIR NVM_CD_FLAGS > /dev/null 2>&1
;; ;;
* ) * )
@@ -2367,8 +2420,10 @@ nvm_auto() {
fi fi
} }
NVM_AUTO_MODE='use' nvm_process_parameters() {
if nvm_supports_source_options; then local NVM_AUTO_MODE
NVM_AUTO_MODE='use'
if nvm_supports_source_options; then
while [ $# -ne 0 ] while [ $# -ne 0 ]
do do
case "$1" in case "$1" in
@@ -2377,7 +2432,10 @@ if nvm_supports_source_options; then
esac esac
shift shift
done done
fi fi
nvm_auto "$NVM_AUTO_MODE" nvm_auto "$NVM_AUTO_MODE"
}
nvm_process_parameters "$@"
} # this ensures the entire script is downloaded # } # this ensures the entire script is downloaded #

View File

@@ -1,6 +1,6 @@
{ {
"name": "nvm", "name": "nvm",
"version": "0.30.2", "version": "0.31.0",
"description": "Node Version Manager - Simple bash script to manage multiple active node.js versions", "description": "Node Version Manager - Simple bash script to manage multiple active node.js versions",
"directories": { "directories": {
"test": "test" "test": "test"

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
export NVM_SYMLINK_CURRENT=true export NVM_SYMLINK_CURRENT=true
. ../../nvm.sh . ../../nvm.sh

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
. ../../nvm.sh . ../../nvm.sh

View File

@@ -0,0 +1,5 @@
#!/bin/sh
set -- yes
. ../../nvm.sh
[ "$1" = yes ]

View File

@@ -4,11 +4,18 @@ die () { echo $@ ; exit 1; }
. ../../../nvm.sh . ../../../nvm.sh
OUTPUT="$(nvm_format_version 0.1.2)" INPUT="0.1.2"
OUTPUT="$(nvm_format_version "$INPUT")"
EXPECTED_OUTPUT="v0.1.2" EXPECTED_OUTPUT="v0.1.2"
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm_format_version 0.1.2 did not return $EXPECTED_OUTPUT; got $OUTPUT" [ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm_format_version $INPUT did not return $EXPECTED_OUTPUT; got $OUTPUT"
OUTPUT="$(nvm_format_version 0.1)" INPUT="0.1"
OUTPUT="$(nvm_format_version "$INPUT")"
EXPECTED_OUTPUT="v0.1.0" EXPECTED_OUTPUT="v0.1.0"
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm_format_version 0.1.0 did not return $EXPECTED_OUTPUT; got $OUTPUT" [ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm_format_version $INPUT did not return $EXPECTED_OUTPUT; got $OUTPUT"
INPUT="1.2.3.4.5"
OUTPUT="$(nvm_format_version "$INPUT")"
EXPECTED_OUTPUT="v1.2.3"
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm_format_version $INPUT did not return $EXPECTED_OUTPUT; got $OUTPUT"

View File

@@ -0,0 +1,45 @@
#!/bin/sh
die () { echo $@ ; exit 1; }
. ../../../nvm.sh
expect () {
INPUT="$1"
EXPECTED_OUTPUT="$2"
OUTPUT="$(nvm_get_minor_version "$INPUT")"
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm_get_minor_version $INPUT did not return $EXPECTED_OUTPUT; got $OUTPUT"
V_OUTPUT="$(nvm_get_minor_version "v$INPUT")"
[ "_$V_OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm_get_minor_version v$INPUT did not return $EXPECTED_OUTPUT; got $V_OUTPUT"
}
fail_with () {
INPUT="$1"
EXPECTED_CODE="$2"
EXIT_CODE="$(nvm_get_minor_version "$INPUT" >/dev/null 2>&1; echo $?)"
[ "_$EXIT_CODE" = "_$EXPECTED_CODE" ] || die "nvm_get_minor_version "$INPUT" did not fail with code "$EXPECTED_CODE"; got $EXIT_CODE"
}
expect 1 1.0
expect 1. 1.0
expect 1.2 1.2
expect 1.2. 1.2
expect 1.2.3 1.2
expect 1.2.3. 1.2
expect 1.2.3.4 1.2
fail_with '' 1
fail_with '.' 2
fail_with '..' 2
fail_with v 2
fail_with .a 2
fail_with .1 2
fail_with v.1 2
fail_with a.b 2
fail_with 1.a 2
fail_with a.1 2
fail_with v1.a 2
fail_with va.1 2

View File

@@ -4,6 +4,8 @@ die () { echo $@ ; exit 1; }
. ../../../nvm.sh . ../../../nvm.sh
nvm unalias default || die 'unable to unalias default'
NVM_TEST_VERSION=v0.10.7 NVM_TEST_VERSION=v0.10.7
# Remove the stuff we're clobbering. # 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 ] [ -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" 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.sh
nvm unalias default || die 'unable to unalias default'
NVM_TEST_VERSION=v0.10.7 NVM_TEST_VERSION=v0.10.7
# Remove the stuff we're clobbering. # 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 ] [ -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" 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 #!/bin/sh
mkdir -p ../../alias mkdir -p ../../alias
rm -rf ../../alias/default
rm -f ../../.nvmrc rm -f ../../.nvmrc
rm -rf ../../v0.10.7 rm -rf ../../v0.10.7
rm -rf ../../v0.9.7 rm -rf ../../v0.9.7
@@ -8,5 +9,6 @@ rm -rf ../../v0.9.12
. ../../nvm.sh . ../../nvm.sh
nvm install 0.10.1 || echo >&2 'nvm install 0.10.1 failed' 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' nvm unload || echo >&2 'nvm unload failed'