mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-09-03 19:16:33 +00:00
Compare commits
89 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
0f1f3ed29c | ||
![]() |
2116d2ff91 | ||
![]() |
0b4c1e14cf | ||
![]() |
e1b7496cf0 | ||
![]() |
8a87133f71 | ||
![]() |
0792945824 | ||
![]() |
a6819b3018 | ||
![]() |
3d3d9d3a8d | ||
![]() |
3e74bac964 | ||
![]() |
1eaf6b53e4 | ||
![]() |
24c60e4e51 | ||
![]() |
8822bd719a | ||
![]() |
d90c1eca39 | ||
![]() |
223f388693 | ||
![]() |
cba5094652 | ||
![]() |
b5d9e547f2 | ||
![]() |
15598899b6 | ||
![]() |
c8f712a334 | ||
![]() |
2d9494af45 | ||
![]() |
2755227d40 | ||
![]() |
dd146519a2 | ||
![]() |
7243bd77d3 | ||
![]() |
7d113a2b2f | ||
![]() |
17df0b9912 | ||
![]() |
6cac732141 | ||
![]() |
9ee864b06f | ||
![]() |
0471d0ffd6 | ||
![]() |
43a7d78693 | ||
![]() |
879dda6c3d | ||
![]() |
ea12784629 | ||
![]() |
f1f11e3b7a | ||
![]() |
247bd310ef | ||
![]() |
dbeeb683da | ||
![]() |
39a75e616d | ||
![]() |
3cf68dc18d | ||
![]() |
654c37bc29 | ||
![]() |
c6a9f7baae | ||
![]() |
bb2564d6db | ||
![]() |
896a7eddd3 | ||
![]() |
8ae7b33632 | ||
![]() |
eb8c3414dd | ||
![]() |
9615672243 | ||
![]() |
78c1f2cf9d | ||
![]() |
ed22d3de2d | ||
![]() |
448bd38a55 | ||
![]() |
0ad5a450fe | ||
![]() |
d5e21be164 | ||
![]() |
797c5ab70b | ||
![]() |
952096d034 | ||
![]() |
dd3a3763ce | ||
![]() |
41c379839d | ||
![]() |
d9340b6a53 | ||
![]() |
b0d6c05d6e | ||
![]() |
0e209ce890 | ||
![]() |
9a57a891b9 | ||
![]() |
58ab2c3128 | ||
![]() |
d70f0357f5 | ||
![]() |
5143de9653 | ||
![]() |
5c336a7ccb | ||
![]() |
3d5ded1815 | ||
![]() |
f661617f1c | ||
![]() |
d28703f9e0 | ||
![]() |
b7983842aa | ||
![]() |
c12104cecd | ||
![]() |
98e0655198 | ||
![]() |
c46748a379 | ||
![]() |
8be97c8abb | ||
![]() |
7807a9f09e | ||
![]() |
835c006b5e | ||
![]() |
3fa11c35cb | ||
![]() |
34e51f9f02 | ||
![]() |
4b5885d69d | ||
![]() |
bf794ff8da | ||
![]() |
0bd7372c64 | ||
![]() |
0a142b7e7a | ||
![]() |
3fc82d6b2f | ||
![]() |
c6489440dc | ||
![]() |
67e8939311 | ||
![]() |
a26007ec0d | ||
![]() |
3f5ce8b93a | ||
![]() |
8328741792 | ||
![]() |
8e45afb9f1 | ||
![]() |
fd2fb24b03 | ||
![]() |
4708cc73ef | ||
![]() |
c91e8d0ba2 | ||
![]() |
f8b143c594 | ||
![]() |
9a4e9060d8 | ||
![]() |
3df0caefa5 | ||
![]() |
274369dc40 |
@@ -1,7 +1,7 @@
|
||||
language: c # defaults to ruby
|
||||
install:
|
||||
- sudo apt-get install zsh -y # ksh
|
||||
- (mkdir /tmp/urchin && cd /tmp/urchin && curl -s "$(curl -s http://registry.npmjs.org/urchin | grep -Eo '"tarball":\s*"[^"]+"' | tail -n 1 | awk -F\" '{ print $4 }')" -O && tar -x -f urchin*)
|
||||
- (mkdir /tmp/urchin && cd /tmp/urchin && curl -s "$(curl -s https://registry.npmjs.com/urchin | grep -Eo '"tarball":\s*"[^"]+"' | tail -n 1 | awk -F\" '{ print $4 }')" -O && tar -x -f urchin*)
|
||||
- chmod +x /tmp/urchin/package/urchin
|
||||
- '[ -z "$WITHOUT_CURL" ] || sudo apt-get remove curl -y'
|
||||
script:
|
||||
|
@@ -5,18 +5,18 @@
|
||||
First you'll need to make sure your system has a c++ compiler. For OSX, XCode will work, for Ubuntu, the build-essential and libssl-dev packages work.
|
||||
|
||||
Note: `nvm` does not support Windows (see [#284](https://github.com/creationix/nvm/issues/284)). Two alternatives exist, which are not supported nor developed by us:
|
||||
- [nvmw](http://github.com/hakobera/nvmw)
|
||||
- [nvm-windows](http://github.com/coreybutler/nvm-windows)
|
||||
- [nvmw](https://github.com/hakobera/nvmw)
|
||||
- [nvm-windows](https://github.com/coreybutler/nvm-windows)
|
||||
|
||||
### Install script
|
||||
|
||||
To install you could use the [install script][2] using cURL:
|
||||
|
||||
curl https://raw.githubusercontent.com/creationix/nvm/v0.21.0/install.sh | bash
|
||||
curl https://raw.githubusercontent.com/creationix/nvm/v0.23.3/install.sh | bash
|
||||
|
||||
or Wget:
|
||||
|
||||
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.21.0/install.sh | bash
|
||||
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.23.3/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>
|
||||
|
||||
@@ -72,6 +72,10 @@ In place of a version pointer like "0.10", you can use the special default alias
|
||||
nvm use stable
|
||||
nvm run unstable --version
|
||||
|
||||
If you want to install [io.js](https://github.com/iojs/io.js/):
|
||||
|
||||
nvm install iojs
|
||||
|
||||
If you want to use the system-installed version of node, you can use the special default alias "system":
|
||||
|
||||
nvm use system
|
||||
@@ -95,10 +99,17 @@ To set a default Node version to be used in any new shell, use the alias 'defaul
|
||||
|
||||
To use a mirror of the node binaries, set `$NVM_NODEJS_ORG_MIRROR`:
|
||||
|
||||
export NVM_NODEJS_ORG_MIRROR=http://nodejs.org/dist
|
||||
export NVM_NODEJS_ORG_MIRROR=https://nodejs.org/dist
|
||||
nvm install 0.10
|
||||
|
||||
NVM_NODEJS_ORG_MIRROR=http://nodejs.org/dist nvm install 0.10
|
||||
NVM_NODEJS_ORG_MIRROR=https://nodejs.org/dist nvm install 0.10
|
||||
|
||||
To use a mirror of the iojs binaries, set `$NVM_IOJS_ORG_MIRROR`:
|
||||
|
||||
export NVM_IOJS_ORG_MIRROR=https://iojs.org/dist
|
||||
nvm install iojs-v1.0.3
|
||||
|
||||
NVM_IOJS_ORG_MIRROR=https://iojs.org/dist nvm install iojs-v1.0.3
|
||||
|
||||
`nvm use` will not, by default, create a "current" symlink. Set `$NVM_SYMLINK_CURRENT` to "true" to enable this behavior, which is sometimes useful for IDEs.
|
||||
|
||||
@@ -191,7 +202,7 @@ After the v0.8.6 release of node, nvm tries to install from binary packages. But
|
||||
nvm install -s 0.8.6
|
||||
|
||||
[1]: https://github.com/creationix/nvm.git
|
||||
[2]: https://github.com/creationix/nvm/blob/v0.21.0/install.sh
|
||||
[2]: https://github.com/creationix/nvm/blob/v0.23.3/install.sh
|
||||
[3]: https://travis-ci.org/creationix/nvm
|
||||
[Urchin]: https://github.com/scraperwiki/urchin
|
||||
|
||||
|
46
install.sh
46
install.sh
@@ -4,13 +4,16 @@ set -e
|
||||
|
||||
nvm_has() {
|
||||
type "$1" > /dev/null 2>&1
|
||||
return $?
|
||||
}
|
||||
|
||||
if [ -z "$NVM_DIR" ]; then
|
||||
NVM_DIR="$HOME/.nvm"
|
||||
fi
|
||||
|
||||
nvm_latest_version() {
|
||||
echo "v0.23.3"
|
||||
}
|
||||
|
||||
#
|
||||
# Outputs the location to NVM depending on:
|
||||
# * The availability of $NVM_SOURCE
|
||||
@@ -22,19 +25,16 @@ nvm_source() {
|
||||
NVM_METHOD="$1"
|
||||
if [ -z "$NVM_SOURCE" ]; then
|
||||
local NVM_SOURCE
|
||||
else
|
||||
echo "$NVM_SOURCE"
|
||||
return 0
|
||||
fi
|
||||
if [ "_$NVM_METHOD" = "_script" ]; then
|
||||
NVM_SOURCE="https://raw.githubusercontent.com/creationix/nvm/v0.21.0/nvm.sh"
|
||||
elif [ "_$NVM_METHOD" = "_script-nvm-exec" ]; then
|
||||
NVM_SOURCE="https://raw.githubusercontent.com/creationix/nvm/v0.21.0/nvm-exec"
|
||||
elif [ "_$NVM_METHOD" = "_git" ] || [ -z "$NVM_METHOD" ]; then
|
||||
NVM_SOURCE="https://github.com/creationix/nvm.git"
|
||||
else
|
||||
echo >&2 "Unexpected value \"$NVM_METHOD\" for \$NVM_METHOD"
|
||||
return 1
|
||||
if [ "_$NVM_METHOD" = "_script" ]; then
|
||||
NVM_SOURCE="https://raw.githubusercontent.com/creationix/nvm/$(nvm_latest_version)/nvm.sh"
|
||||
elif [ "_$NVM_METHOD" = "_script-nvm-exec" ]; then
|
||||
NVM_SOURCE="https://raw.githubusercontent.com/creationix/nvm/$(nvm_latest_version)/nvm-exec"
|
||||
elif [ "_$NVM_METHOD" = "_git" ] || [ -z "$NVM_METHOD" ]; then
|
||||
NVM_SOURCE="https://github.com/creationix/nvm.git"
|
||||
else
|
||||
echo >&2 "Unexpected value \"$NVM_METHOD\" for \$NVM_METHOD"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
echo "$NVM_SOURCE"
|
||||
return 0
|
||||
@@ -45,7 +45,7 @@ nvm_download() {
|
||||
curl $*
|
||||
elif nvm_has "wget"; then
|
||||
# Emulate curl with wget
|
||||
ARGS=$(echo "$*" | sed -e 's/--progress-bar /--progress=bar /' \
|
||||
ARGS=$(echo "$*" | command sed -e 's/--progress-bar /--progress=bar /' \
|
||||
-e 's/-L //' \
|
||||
-e 's/-I /--server-response /' \
|
||||
-e 's/-s /-q /' \
|
||||
@@ -57,9 +57,9 @@ nvm_download() {
|
||||
|
||||
install_nvm_from_git() {
|
||||
if [ -d "$NVM_DIR/.git" ]; then
|
||||
echo "=> nvm is already installed in $NVM_DIR, trying to update"
|
||||
echo "=> nvm is already installed in $NVM_DIR, trying to update using git"
|
||||
printf "\r=> "
|
||||
cd "$NVM_DIR" && (git fetch 2> /dev/null || {
|
||||
cd "$NVM_DIR" && (command git fetch 2> /dev/null || {
|
||||
echo >&2 "Failed to update nvm, run 'git fetch' in $NVM_DIR yourself." && exit 1
|
||||
})
|
||||
else
|
||||
@@ -67,22 +67,22 @@ install_nvm_from_git() {
|
||||
echo "=> Downloading nvm from git to '$NVM_DIR'"
|
||||
printf "\r=> "
|
||||
mkdir -p "$NVM_DIR"
|
||||
git clone "$(nvm_source "git")" "$NVM_DIR"
|
||||
command git clone "$(nvm_source git)" "$NVM_DIR"
|
||||
fi
|
||||
cd "$NVM_DIR" && git checkout --quiet v0.21.0 && git branch --quiet -D master >/dev/null 2>&1
|
||||
cd "$NVM_DIR" && command git checkout --quiet $(nvm_latest_version) && command git branch --quiet -D master >/dev/null 2>&1
|
||||
return
|
||||
}
|
||||
|
||||
install_nvm_as_script() {
|
||||
local NVM_SOURCE
|
||||
NVM_SOURCE=$(nvm_source "script")
|
||||
NVM_SOURCE=$(nvm_source script)
|
||||
local NVM_EXEC_SOURCE
|
||||
NVM_EXEC_SOURCE=$(nvm_source "script-nvm-exec")
|
||||
NVM_EXEC_SOURCE=$(nvm_source script-nvm-exec)
|
||||
|
||||
# Downloading to $NVM_DIR
|
||||
mkdir -p "$NVM_DIR"
|
||||
if [ -d "$NVM_DIR/nvm.sh" ]; then
|
||||
echo "=> nvm is already installed in $NVM_DIR, trying to update"
|
||||
echo "=> nvm is already installed in $NVM_DIR, trying to update the script"
|
||||
else
|
||||
echo "=> Downloading nvm as script to '$NVM_DIR'"
|
||||
fi
|
||||
@@ -178,7 +178,7 @@ nvm_do_install() {
|
||||
# during the execution of the install script
|
||||
#
|
||||
nvm_reset() {
|
||||
unset -f nvm_do_install nvm_has nvm_download install_nvm_as_script install_nvm_from_git nvm_reset nvm_detect_profile
|
||||
unset -f nvm_do_install nvm_has nvm_download install_nvm_as_script install_nvm_from_git nvm_reset nvm_detect_profile nvm_latest_version
|
||||
}
|
||||
|
||||
[ "_$NVM_ENV" = "_testing" ] || nvm_do_install
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "nvm",
|
||||
"version": "0.21.0",
|
||||
"version": "0.23.3",
|
||||
"description": "Node Version Manager - Simple bash script to manage multiple active node.js versions",
|
||||
"directories": {
|
||||
"test": "test"
|
||||
@@ -31,7 +31,7 @@
|
||||
"homepage": "https://github.com/creationix/nvm",
|
||||
"devDependencies": {
|
||||
"replace": "~0.3.0",
|
||||
"semver": "~4.1.1",
|
||||
"semver": "~4.2.0",
|
||||
"urchin": "~0.0.5"
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
|
||||
. ../../../nvm.sh
|
||||
|
||||
die () { echo $@ ; exit 1; }
|
||||
|
||||
if [ -n "$ZSH_VERSION" ]; then
|
||||
# set clobber option in order to test that this does not produce any
|
||||
# incompatibilities
|
||||
setopt noclobber
|
||||
fi
|
||||
|
||||
nvm alias test-stable-1 0.0.2
|
||||
|
||||
nvm alias test-stable-1 | \grep -e "test-stable-1 -> 0.0.2 (-> v0.0.2)" \
|
||||
|| die "nvm alias test-stable-1 0.0.2 did not set test-stable-1 to 0.0.2"
|
||||
|
||||
nvm alias test-stable-1 0.0.1
|
||||
|
||||
nvm alias test-stable-1 | \grep -e "test-stable-1 -> 0.0.1 (-> v0.0.1)" \
|
||||
|| die "nvm alias test-stable-1 0.0.1 did not set test-stable-1 to 0.0.1"
|
@@ -2,7 +2,7 @@
|
||||
|
||||
mkdir -p ../../../v0.0.2
|
||||
mkdir -p ../../../v0.0.20
|
||||
mkdir -p ../../../versions/v0.12.0
|
||||
mkdir -p ../../../versions/node/v0.12.0
|
||||
|
||||
. ../../../nvm.sh
|
||||
|
||||
|
@@ -2,6 +2,6 @@
|
||||
|
||||
. ../../../nvm.sh
|
||||
|
||||
nvm ls node
|
||||
nvm ls io
|
||||
[ "$?" = "3" ]
|
||||
|
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
. ../../../nvm.sh
|
||||
|
||||
nvm ls node_
|
||||
[ "$?" = "3" ]
|
||||
|
@@ -8,11 +8,17 @@ mkdir ../../../v0.0.9
|
||||
mkdir ../../../v0.3.1
|
||||
mkdir ../../../v0.3.3
|
||||
mkdir ../../../v0.3.9
|
||||
mkdir -p ../../../versions/node/v0.12.87
|
||||
mkdir -p ../../../versions/node/v0.12.9
|
||||
mkdir -p ../../../versions/io.js/v0.1.2
|
||||
mkdir -p ../../../versions/io.js/v0.10.2
|
||||
|
||||
# The result should contain the version numbers.
|
||||
nvm ls | grep v0.0.1 &&
|
||||
nvm ls | grep v0.0.3 &&
|
||||
nvm ls | grep v0.0.9 &&
|
||||
nvm ls | grep v0.3.1 &&
|
||||
nvm ls | grep v0.3.3 &&
|
||||
nvm ls | grep v0.3.9
|
||||
nvm ls | grep v0.0.1 >/dev/null &&
|
||||
nvm ls | grep v0.0.3 >/dev/null &&
|
||||
nvm ls | grep v0.0.9 >/dev/null &&
|
||||
nvm ls | grep v0.3.1 >/dev/null &&
|
||||
nvm ls | grep v0.3.3 >/dev/null &&
|
||||
nvm ls | grep v0.3.9 >/dev/null &&
|
||||
nvm ls | grep v0.12.87 >/dev/null &&
|
||||
nvm ls | grep iojs-v0.1.2 >/dev/null
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
mkdir ../../../v0.1.3
|
||||
mkdir ../../../v0.2.3
|
||||
mkdir ../../../versions
|
||||
mkdir -p ../../../versions/node
|
||||
|
||||
. ../../../nvm.sh
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
die () { echo $@ ; exit 1; }
|
||||
|
||||
mkdir -p ../../../versions/v0.12.1
|
||||
mkdir -p ../../../versions/node/v0.12.1
|
||||
mkdir ../../../v0.1.3
|
||||
|
||||
. ../../../nvm.sh
|
||||
|
22
test/fast/Running "nvm use iojs" uses latest io.js version
Executable file
22
test/fast/Running "nvm use iojs" uses latest io.js version
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
|
||||
die () { echo $@ ; cleanup ; exit 1; }
|
||||
|
||||
cleanup() {
|
||||
rm -rf ../../alias/foo
|
||||
}
|
||||
|
||||
. ../../nvm.sh
|
||||
|
||||
echo 'foo' > ../../alias/foo
|
||||
|
||||
OUTPUT="$(nvm use foo 2>&1)"
|
||||
EXPECTED_OUTPUT='The alias "foo" leads to an infinite loop. Aborting.'
|
||||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] \
|
||||
|| die "'nvm use foo' did not output '$EXPECTED_OUTPUT'; got '$OUTPUT'"
|
||||
|
||||
EXIT_CODE="$(nvm use foo 2>/dev/null ; echo $?)"
|
||||
[ "_$EXIT_CODE" = "_8" ] || die "Expected exit code 8; got $EXIT_CODE"
|
||||
|
||||
cleanup;
|
||||
|
9
test/fast/Unit tests/nvm_add_iojs_prefix
Executable file
9
test/fast/Unit tests/nvm_add_iojs_prefix
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
die () { echo $@ ; exit 1; }
|
||||
|
||||
. ../../../nvm.sh
|
||||
|
||||
[ "_$(nvm_add_iojs_prefix 1)" = "_iojs-v1" ] || die '"nvm_add_iojs_prefix 1" did not return "iojs-v1"'
|
||||
[ "_$(nvm_add_iojs_prefix iojs-1)" = "_iojs-v1" ] || die '"nvm_add_iojs_prefix iojs-1" did not return "iojs-v1"'
|
||||
[ "_$(nvm_add_iojs_prefix iojs-1.2.3)" = "_iojs-v1.2.3" ] || die '"nvm_add_iojs_prefix iojs-1.2.3" did not return "iojs-v1.2.3"'
|
8
test/fast/Unit tests/nvm_alias_path
Executable file
8
test/fast/Unit tests/nvm_alias_path
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
die () { echo $@ ; exit 1; }
|
||||
|
||||
. ../../../nvm.sh
|
||||
|
||||
[ "_$(nvm_alias_path)" = "_$NVM_DIR/alias" ] || die "nvm_alias_path did not requrn correct location"
|
||||
|
12
test/fast/Unit tests/nvm_ensure_version_prefix
Executable file
12
test/fast/Unit tests/nvm_ensure_version_prefix
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
die () { echo $@ ; exit 1; }
|
||||
|
||||
. ../../../nvm.sh
|
||||
|
||||
[ "_$(nvm_ensure_version_prefix 1)" = "_v1" ] || die '"nvm_ensure_version_prefix 1" did not return "v1"'
|
||||
[ "_$(nvm_ensure_version_prefix v1)" = "_v1" ] || die '"nvm_ensure_version_prefix v1" did not return "v1"'
|
||||
[ "_$(nvm_ensure_version_prefix foo)" = "_foo" ] || die '"nvm_ensure_version_prefix foo" did not return "foo"'
|
||||
|
||||
[ "_$(nvm_ensure_version_prefix iojs-1)" = "_iojs-v1" ] || die '"nvm_ensure_version_prefix iojs-1" did not return "iojs-v1"'
|
||||
[ "_$(nvm_ensure_version_prefix iojs-v1)" = "_iojs-v1" ] || die '"nvm_ensure_version_prefix iojs-v1" did not return "iojs-v1"'
|
31
test/fast/Unit tests/nvm_has_system_iojs
Executable file
31
test/fast/Unit tests/nvm_has_system_iojs
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
|
||||
cleanup () {
|
||||
rm ../../../versions/io.js/v0.1.2/node
|
||||
rm ../../../versions/io.js/v0.1.2/iojs
|
||||
rmdir ../../../versions/io.js/v0.1.2
|
||||
}
|
||||
die () { echo $@ ; exit 1; }
|
||||
|
||||
. ../../../nvm.sh
|
||||
|
||||
mkdir ../../../versions/io.js/v0.1.2
|
||||
touch ../../../versions/io.js/v0.1.2/node
|
||||
touch ../../../versions/io.js/v0.1.2/iojs
|
||||
|
||||
nvm use iojs-v0.1.2
|
||||
|
||||
if command -v iojs; then
|
||||
nvm_has_system_iojs
|
||||
else
|
||||
! nvm_has_system_iojs
|
||||
fi
|
||||
|
||||
nvm deactivate /dev/null 2>&1
|
||||
|
||||
if command -v iojs; then
|
||||
nvm_has_system_iojs
|
||||
else
|
||||
! nvm_has_system_iojs
|
||||
fi
|
||||
|
7
test/fast/Unit tests/nvm_iojs_prefix
Executable file
7
test/fast/Unit tests/nvm_iojs_prefix
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
die () { echo $@ ; exit 1; }
|
||||
|
||||
. ../../../nvm.sh
|
||||
|
||||
[ "$(nvm_iojs_prefix)" = "iojs" ] || die '"nvm_iojs_prefix" did not return the string "iojs". why did this fail?!'
|
10
test/fast/Unit tests/nvm_is_iojs_version
Executable file
10
test/fast/Unit tests/nvm_is_iojs_version
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
die () { echo $@ ; exit 1; }
|
||||
|
||||
. ../../../nvm.sh
|
||||
|
||||
nvm_is_iojs_version 'iojs-' || die '"nvm_is_iojs_version iojs- was not true'
|
||||
nvm_is_iojs_version 'iojs-foo' || die '"nvm_is_iojs_version iojs- was not true'
|
||||
! nvm_is_iojs_version 'iojs' || die '"nvm_is_iojs_version iojs was not false'
|
||||
! nvm_is_iojs_version 'v1.0.0' || die '"nvm_is_iojs_version v1.0.0" was not false'
|
13
test/fast/Unit tests/nvm_is_valid_version
Executable file
13
test/fast/Unit tests/nvm_is_valid_version
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
die () { echo $@ ; exit 1; }
|
||||
|
||||
. ../../../nvm.sh
|
||||
|
||||
nvm_is_valid_version 0.1.2 || die "nvm_is_valid_version 0.1.2 did not return 0"
|
||||
nvm_is_valid_version foo && die "nvm_is_valid_version foo did not return 1"
|
||||
nvm_is_valid_version iojs-1 || die "nvm_is_valid_version iojs-1 did not return 0"
|
||||
nvm_is_valid_version iojs || die "nvm_is_valid_version iojs did not return 0"
|
||||
nvm_is_valid_version node || die "nvm_is_valid_version node did not return 0"
|
||||
nvm_is_valid_version stable || die "nvm_is_valid_version stable did not return 0"
|
||||
nvm_is_valid_version unstable || die "nvm_is_valid_version unstable did not return 0"
|
@@ -1,6 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
die () { echo $@ ; exit 1; }
|
||||
TEST_PWD=$(pwd)
|
||||
TEST_DIR="$TEST_PWD/nvm_ls_current_tmp"
|
||||
|
||||
cleanup() { rm -rf "$TEST_DIR"; unset -f return_zero; unalias node; }
|
||||
die () { echo $@ ; cleanup ; exit 1; }
|
||||
|
||||
. ../../../nvm.sh
|
||||
|
||||
@@ -8,12 +12,10 @@ return_zero () { return 0; }
|
||||
|
||||
[ "$(nvm deactivate > /dev/null 2>&1 ; nvm_ls_current)" = "system" ] || die 'when deactivated, did not return "system"'
|
||||
|
||||
TEST_PWD=$(pwd)
|
||||
TEST_DIR="$TEST_PWD/nvm_ls_current_tmp"
|
||||
rm -rf "$TEST_DIR"
|
||||
mkdir "$TEST_DIR"
|
||||
ln -s "$(which which)" "$TEST_DIR/which"
|
||||
ln -s "$(which dirname)" "$TEST_DIR/dirname"
|
||||
ln -s "$(command which which)" "$TEST_DIR/which"
|
||||
ln -s "$(command which dirname)" "$TEST_DIR/dirname"
|
||||
|
||||
[ "$(PATH="$TEST_DIR" nvm_ls_current)" = "none" ] || die 'when node not installed, nvm_ls_current did not return "none"'
|
||||
[ "@$(PATH="$TEST_DIR" nvm_ls_current 2> /dev/stdout 1> /dev/null)@" = "@@" ] || die 'when node not installed, nvm_ls_current returned error output'
|
||||
@@ -24,5 +26,7 @@ chmod a+x "$TEST_DIR/node"
|
||||
|
||||
[ "$(alias nvm_tree_contains_path='return_zero' && PATH="$TEST_DIR" nvm_ls_current)" = "VERSION FOO!" ] || die 'when activated, did not return nvm node version'
|
||||
|
||||
rm -rf "$TEST_DIR"
|
||||
alias node='node --harmony'
|
||||
[ "$(alias nvm_tree_contains_path='return_zero' && PATH="$TEST_DIR" nvm_ls_current)" = "VERSION FOO!" ] || die 'when activated and node aliased, did not return nvm node version'
|
||||
|
||||
cleanup
|
||||
|
34
test/fast/Unit tests/nvm_ls_remote_iojs
Executable file
34
test/fast/Unit tests/nvm_ls_remote_iojs
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/bin/sh
|
||||
|
||||
die () { echo $@ ; cleanup ; exit 1; }
|
||||
|
||||
cleanup() {
|
||||
unset -f nvm_download
|
||||
}
|
||||
|
||||
. ../../../nvm.sh
|
||||
|
||||
# sample output at the time the test was written
|
||||
nvm_download() {
|
||||
echo 'version date files npm v8 uv zlib openssl modules'
|
||||
echo 'v1.0.1 2015-01-14 linux-armv7l,linux-x64,linux-x86,osx-x64-tar,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi'
|
||||
echo 'v1.0.0 2015-01-14 linux-armv7l,linux-x64,linux-x86,osx-x64-tar,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi'
|
||||
}
|
||||
|
||||
OUTPUT="$(nvm_ls_remote_iojs foo)"
|
||||
EXIT_CODE="$(nvm_ls_remote_iojs foo >/dev/null 2>&1 ; echo $?)"
|
||||
[ "_$OUTPUT" = "_N/A" ] || die "nonexistent version did not report N/A"
|
||||
[ "_$EXIT_CODE" = "_3" ] || die "nonexistent version did not exit with code 3, got $EXIT_CODE"
|
||||
|
||||
OUTPUT="$(nvm_ls_remote_iojs)"
|
||||
EXPECTED_OUTPUT="$(nvm_download | \egrep -o 'v[0-9]+\.[0-9]+\.[0-9]+' | sort -t. -u -k 1.2,1n -k 2,2n -k 3,3n | sed -e 's/^/iojs-/')"
|
||||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "bare nvm_ls_remote_iojs did not output expected sorted versions; got $(echo "$OUTPUT") expected $(echo "$EXPECTED_OUTPUT")"
|
||||
|
||||
OUTPUT="$(nvm_ls_remote_iojs 1.0)"
|
||||
EXPECTED_OUTPUT="iojs-v1.0.0
|
||||
iojs-v1.0.1"
|
||||
|
||||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm_ls_remote_iojs 1.0 did not output 1.0.x versions; got $OUTPUT"
|
||||
|
||||
cleanup
|
||||
|
7
test/fast/Unit tests/nvm_node_prefix
Executable file
7
test/fast/Unit tests/nvm_node_prefix
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
die () { echo $@ ; exit 1; }
|
||||
|
||||
. ../../../nvm.sh
|
||||
|
||||
[ "$(nvm_node_prefix)" = "node" ] || die '"nvm_node_prefix" did not return the string "node". why did this fail?!'
|
@@ -3,7 +3,7 @@
|
||||
die () { echo $@ ; cleanup ; exit 1; }
|
||||
|
||||
cleanup() {
|
||||
unset -f nvm_ls_remote
|
||||
unset -f nvm_ls_remote nvm_ls_remote_iojs
|
||||
}
|
||||
|
||||
. ../../../nvm.sh
|
||||
@@ -11,25 +11,51 @@ cleanup() {
|
||||
nvm_ls_remote() {
|
||||
echo "N/A"
|
||||
}
|
||||
|
||||
OUTPUT="$(nvm_remote_version foo)"
|
||||
EXIT_CODE="$(nvm_remote_version foo >/dev/null 2>&1 ; echo $?)"
|
||||
|
||||
[ "_$OUTPUT" = "_N/A" ] || die "nonexistent version did not report N/A"
|
||||
[ "_$EXIT_CODE" = "_3" ] || die "nonexistent version did not exit with code 3, got $EXIT_CODE"
|
||||
|
||||
nvm_ls_remote() {
|
||||
echo "test output"
|
||||
echo "more test output"
|
||||
echo "pattern received: _$1_"
|
||||
nvm_ls_remote_iojs() {
|
||||
echo "N/A"
|
||||
}
|
||||
OUTPUT="$(nvm_remote_version iojs-foo)"
|
||||
EXIT_CODE="$(nvm_remote_version iojs-foo >/dev/null 2>&1 ; echo $?)"
|
||||
[ "_$OUTPUT" = "_N/A" ] || die "nonexistent version did not report N/A"
|
||||
[ "_$EXIT_CODE" = "_3" ] || die "nonexistent version did not exit with code 3, got $EXIT_CODE"
|
||||
|
||||
|
||||
nvm_ls_remote() {
|
||||
if ! nvm_is_iojs_version "$1"; then
|
||||
echo "test output"
|
||||
echo "more test output"
|
||||
echo "pattern received: _$1_"
|
||||
fi
|
||||
}
|
||||
nvm_ls_remote_iojs() {
|
||||
if nvm_is_iojs_version "$1"; then
|
||||
echo "test iojs output"
|
||||
echo "more iojs test output"
|
||||
echo "iojs pattern received: _$1_"
|
||||
fi
|
||||
}
|
||||
OUTPUT="$(nvm_remote_version foo)"
|
||||
EXIT_CODE="$(nvm_remote_version foo >/dev/null 2>&1 ; echo $?)"
|
||||
|
||||
[ "_$OUTPUT" = "_pattern received: _foo_" ] \
|
||||
|| die "nvm_remote_version foo did not return last line only of nvm_ls_remote foo; got $OUTPUT"
|
||||
[ "_$EXIT_CODE" = "_0" ] || die "nvm_remote_version foo did not exit with 0, got $EXIT_CODE"
|
||||
|
||||
OUTPUT="$(nvm_remote_version iojs-foo)"
|
||||
EXIT_CODE="$(nvm_remote_version iojs-foo >/dev/null 2>&1 ; echo $?)"
|
||||
[ "_$OUTPUT" = "_iojs pattern received: _iojs-foo_" ] \
|
||||
|| die "nvm_remote_version iojs-foo did not return last line only of nvm_ls_remote_iojs foo; got $OUTPUT"
|
||||
[ "_$EXIT_CODE" = "_0" ] || die "nvm_remote_version iojs-foo did not exit with 0, got $EXIT_CODE"
|
||||
|
||||
OUTPUT="$(nvm_remote_version stable)"
|
||||
EXIT_CODE="$(nvm_remote_version stable >/dev/null 2>&1 ; echo $?)"
|
||||
[ "_$OUTPUT" = "_$(nvm_ls_remote stable)" ] \
|
||||
|| die "nvm_remote_version stable did not return contents of nvm_ls_remote stable; got $OUTPUT"
|
||||
[ "_$EXIT_CODE" = "_0" ] || die "nvm_remote_version stable did not exit with 0, got $EXIT_CODE"
|
||||
|
||||
cleanup
|
||||
|
||||
|
78
test/fast/Unit tests/nvm_remote_versions
Executable file
78
test/fast/Unit tests/nvm_remote_versions
Executable file
@@ -0,0 +1,78 @@
|
||||
#!/bin/sh
|
||||
|
||||
die () { echo $@ ; cleanup ; exit 1; }
|
||||
|
||||
cleanup() {
|
||||
unset -f nvm_ls_remote nvm_ls_remote_iojs
|
||||
}
|
||||
|
||||
. ../../../nvm.sh
|
||||
|
||||
OUTPUT="$(nvm_remote_versions stable 2>&1)"
|
||||
EXPECTED_OUTPUT="Implicit aliases are not supported in nvm_remote_versions."
|
||||
EXIT_CODE="$(nvm_remote_versions stable >/dev/null 2>&1; echo $?)"
|
||||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "implicit alias 'stable' did not error out with correct message, got $OUTPUT"
|
||||
[ "_$EXIT_CODE" = "_1" ] || die "implicit alias 'stable' did not exit with code 1, got $EXIT_CODE"
|
||||
|
||||
OUTPUT="$(nvm_remote_versions unstable 2>&1)"
|
||||
EXPECTED_OUTPUT="Implicit aliases are not supported in nvm_remote_versions."
|
||||
EXIT_CODE="$(nvm_remote_versions unstable >/dev/null 2>&1; echo $?)"
|
||||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "implicit alias 'unstable' did not error out with correct message, got $OUTPUT"
|
||||
[ "_$EXIT_CODE" = "_1" ] || die "implicit alias 'unstable' did not exit with code 1, got $EXIT_CODE"
|
||||
|
||||
nvm_ls_remote() {
|
||||
echo "N/A"
|
||||
}
|
||||
OUTPUT="$(nvm_remote_versions foo)"
|
||||
EXIT_CODE="$(nvm_remote_versions foo >/dev/null 2>&1 ; echo $?)"
|
||||
[ "_$OUTPUT" = "_N/A" ] || die "nonexistent version did not report N/A"
|
||||
[ "_$EXIT_CODE" = "_3" ] || die "nonexistent version did not exit with code 3, got $EXIT_CODE"
|
||||
|
||||
nvm_ls_remote_iojs() {
|
||||
echo "N/A"
|
||||
}
|
||||
OUTPUT="$(nvm_remote_versions iojs-foo)"
|
||||
EXIT_CODE="$(nvm_remote_versions iojs-foo >/dev/null 2>&1 ; echo $?)"
|
||||
[ "_$OUTPUT" = "_N/A" ] || die "nonexistent version did not report N/A"
|
||||
[ "_$EXIT_CODE" = "_3" ] || die "nonexistent version did not exit with code 3, got $EXIT_CODE"
|
||||
|
||||
|
||||
nvm_ls_remote() {
|
||||
echo "test output"
|
||||
echo "more test output"
|
||||
echo "pattern received: _$1_"
|
||||
}
|
||||
nvm_ls_remote_iojs() {
|
||||
echo "test iojs output"
|
||||
echo "more iojs test output"
|
||||
echo "iojs pattern received: _$1_"
|
||||
}
|
||||
|
||||
OUTPUT="$(nvm_remote_versions foo)"
|
||||
EXIT_CODE="$(nvm_remote_versions foo >/dev/null 2>&1 ; echo $?)"
|
||||
[ "_$OUTPUT" = "_$(nvm_ls_remote foo)
|
||||
$(nvm_ls_remote_iojs foo)" ] \
|
||||
|| die "nvm_remote_versions foo did not return contents of nvm_ls_remote foo combined with nvm_ls_remote_iojs foo; got $OUTPUT"
|
||||
[ "_$EXIT_CODE" = "_0" ] || die "nvm_remote_versions foo did not exit with 0, got $EXIT_CODE"
|
||||
|
||||
OUTPUT="$(nvm_remote_versions node)"
|
||||
EXIT_CODE="$(nvm_remote_versions node >/dev/null 2>&1 ; echo $?)"
|
||||
[ "_$OUTPUT" = "_$(nvm_ls_remote)" ] \
|
||||
|| die "nvm_remote_versions node did not return contents of nvm_ls_remote; got $OUTPUT"
|
||||
[ "_$EXIT_CODE" = "_0" ] || die "nvm_remote_versions node did not exit with 0, got $EXIT_CODE"
|
||||
|
||||
OUTPUT="$(nvm_remote_versions iojs-foo)"
|
||||
EXIT_CODE="$(nvm_remote_versions iojs-foo >/dev/null 2>&1 ; echo $?)"
|
||||
[ "_$OUTPUT" = "_$(nvm_ls_remote iojs-foo)
|
||||
$(nvm_ls_remote_iojs iojs-foo)" ] \
|
||||
|| die "nvm_remote_versions iojs-foo did not return contents of nvm_ls_remote iojs-foo combined with nvm_ls_remote_iojs iojs-foo; got $OUTPUT"
|
||||
[ "_$EXIT_CODE" = "_0" ] || die "nvm_remote_versions iojs-foo did not exit with 0, got $EXIT_CODE"
|
||||
|
||||
OUTPUT="$(nvm_remote_versions iojs)"
|
||||
EXIT_CODE="$(nvm_remote_versions iojs >/dev/null 2>&1 ; echo $?)"
|
||||
[ "_$OUTPUT" = "_$(nvm_ls_remote_iojs)" ] \
|
||||
|| die "nvm_remote_versions iojs did not return contents of nvm_ls_remote_iojs; got $OUTPUT"
|
||||
[ "_$EXIT_CODE" = "_0" ] || die "nvm_remote_versions iojs did not exit with 0, got $EXIT_CODE"
|
||||
|
||||
cleanup
|
||||
|
10
test/fast/Unit tests/nvm_strip_iojs_prefix
Executable file
10
test/fast/Unit tests/nvm_strip_iojs_prefix
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
die () { echo $@ ; exit 1; }
|
||||
|
||||
. ../../../nvm.sh
|
||||
|
||||
[ "_$(nvm_strip_iojs_prefix iojs)" = "_" ] || die '"nvm_strip_iojs_prefix iojs" did not return an empty string'
|
||||
[ "_$(nvm_strip_iojs_prefix iojs-)" = "_" ] || die '"nvm_strip_iojs_prefix iojs-" did not return an empty string'
|
||||
[ "_$(nvm_strip_iojs_prefix iojs-foo)" = "_foo" ] || die '"nvm_strip_iojs_prefix iojs-foo" did not return "foo"'
|
||||
[ "_$(nvm_strip_iojs_prefix iojsfoo)" = "_iojsfoo" ] || die '"nvm_strip_iojs_prefix iojsfoo" did not return "iojsfoo"'
|
@@ -4,7 +4,7 @@ die () { echo $@ ; exit 1; }
|
||||
|
||||
. ../../../nvm.sh
|
||||
|
||||
TEST_PATH=$NVM_DIR/v0.10.5/bin:/usr/bin:$NVM_DIR/v0.11.5/bin:$NVM_DIR/v0.9.5/bin:/usr/local/bin:$NVM_DIR/v0.2.5/bin
|
||||
TEST_PATH=$NVM_DIR/v0.10.5/bin:/usr/bin:$NVM_DIR/v0.11.5/bin:$NVM_DIR/v0.9.5/bin:/usr/local/bin:$NVM_DIR/v0.2.5/bin:$NVM_DIR/versions/node/v0.12.0/bin:$NVM_DIR/versions/io.js/v1.0.0/bin
|
||||
|
||||
STRIPPED_PATH=`nvm_strip_path "$TEST_PATH" "/bin"`
|
||||
|
||||
|
48
test/fast/Unit tests/nvm_version
Executable file
48
test/fast/Unit tests/nvm_version
Executable file
@@ -0,0 +1,48 @@
|
||||
#!/bin/sh
|
||||
|
||||
die () { echo $@ ; cleanup ; exit 1; }
|
||||
cleanup () {
|
||||
unset -f nvm_ls_current nvm_ls
|
||||
}
|
||||
|
||||
. ../../../nvm.sh
|
||||
|
||||
nvm_ls_current() {
|
||||
echo "CURRENT!"
|
||||
return 7
|
||||
}
|
||||
|
||||
OUTPUT="$(nvm_version current)"
|
||||
EXPECTED_OUTPUT="CURRENT!"
|
||||
EXIT_CODE="$(nvm_version current 2>&1 >/dev/null ; echo $?)"
|
||||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die '"nvm_version current" did not return nvm_ls_current output'
|
||||
[ "_$EXIT_CODE" = "_7" ] || die '"nvm_version current" did not return nvm_ls_current exit code'
|
||||
|
||||
OUTPUT="$(nvm_version)"
|
||||
EXPECTED_OUTPUT="CURRENT!"
|
||||
EXIT_CODE="$(nvm_version 2>&1 >/dev/null ; echo $?)"
|
||||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die '"nvm_version" did not return nvm_ls_current output'
|
||||
[ "_$EXIT_CODE" = "_7" ] || die '"nvm_version" did not return nvm_ls_current exit code'
|
||||
|
||||
nvm_ls() {
|
||||
echo "line 1"
|
||||
echo "line 2"
|
||||
echo "pattern: $1"
|
||||
}
|
||||
[ "_$(nvm_version foo)" = "_pattern: foo" ] || die '"nvm_version foo" did not pass the pattern to "nvm_ls", or return the last line'
|
||||
[ "_$(nvm_version node)" = "_pattern: stable" ] || die '"nvm_version node" did not pass "stable" to "nvm_ls"'
|
||||
[ "_$(nvm_version node-)" = "_pattern: stable" ] || die '"nvm_version node-" did not pass "stable" to "nvm_ls"'
|
||||
|
||||
nvm_ls() { echo "N/A"; }
|
||||
OUTPUT="$(nvm_version foo)"
|
||||
EXPECTED_OUTPUT="N/A"
|
||||
EXIT_CODE="$(nvm_version foo 2>&1 >/dev/null ; echo $?)"
|
||||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die '"nvm_version" did not return N/A when nvm_ls returns N/A'
|
||||
[ "_$EXIT_CODE" = "_3" ] || die '"nvm_version" returning N/A did not exit code with code 3'
|
||||
|
||||
nvm_ls() { echo; }
|
||||
OUTPUT="$(nvm_version foo)"
|
||||
EXPECTED_OUTPUT="N/A"
|
||||
EXIT_CODE="$(nvm_version foo 2>&1 >/dev/null ; echo $?)"
|
||||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die '"nvm_version" did not return N/A when nvm_ls returns nothing'
|
||||
[ "_$EXIT_CODE" = "_3" ] || die '"nvm_version" returning N/A did not exit code with code 3'
|
@@ -4,7 +4,8 @@ die () { echo $@ ; exit 1; }
|
||||
|
||||
. ../../../nvm.sh
|
||||
|
||||
[ "$(nvm_version_dir)" = "$NVM_DIR/versions" ] || die '"nvm_version_dir" did not return new dir path'
|
||||
[ "$(nvm_version_dir)" = "$NVM_DIR/versions/node" ] || die '"nvm_version_dir" did not return new dir path'
|
||||
[ "$(nvm_version_dir iojs)" = "$NVM_DIR/versions/io.js" ] || die '"nvm_version_dir iojs" did not return iojs dir path'
|
||||
[ "$(nvm_version_dir new)" = "$(nvm_version_dir)" ] || die '"nvm_version_dir new" did not return new dir path'
|
||||
[ "$(nvm_version_dir old)" = "$NVM_DIR" ] || die '"nvm_version_dir old" did not return old dir path'
|
||||
[ "$(nvm_version_dir foo 2>&1)" = "unknown version dir" ] || die '"nvm_version_dir foo" did not error out'
|
||||
|
@@ -7,5 +7,6 @@ die () { echo $@ ; exit 1; }
|
||||
[ "$(nvm_version_path foo)" = "$NVM_DIR/foo" ] || die '"nvm_version_path foo" did not return correct location'
|
||||
[ "$(nvm_version_path 2>&1)" = "version is required" ] || die '"nvm_version_path" did not error out'
|
||||
[ "$(nvm_version_path v0.11.0)" = "$NVM_DIR/v0.11.0" ] || die 'old version has the wrong path'
|
||||
[ "$(nvm_version_path v0.12.0)" = "$NVM_DIR/versions/v0.12.0" ] || die 'new version has the wrong path'
|
||||
[ "$(nvm_version_path v0.12.0)" = "$NVM_DIR/versions/node/v0.12.0" ] || die 'new version has the wrong path'
|
||||
[ "$(nvm_version_path iojs-v0.12.0)" = "$NVM_DIR/versions/io.js/v0.12.0" ] || die 'iojs version has the wrong path'
|
||||
|
||||
|
26
test/installation/io.js/install already installed uses it
Executable file
26
test/installation/io.js/install already installed uses it
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
|
||||
die () { echo $@ ; exit 1; }
|
||||
|
||||
. ../../../nvm.sh
|
||||
|
||||
[ "$(nvm install invalid.invalid 2>&1)" = "Version 'invalid.invalid' not found - try \`nvm ls-remote\` to browse available versions." ] || die "nvm installing an invalid version did not print a nice error message"
|
||||
|
||||
# Remove the stuff we're clobbering.
|
||||
[ -e ../../../versions/io.js/v1.0.0 ] && rm -R ../../../versions/io.js/v1.0.0
|
||||
[ -e ../../../versions/io.js/v1.0.1 ] && rm -R ../../../versions/io.js/v1.0.1
|
||||
|
||||
# Install from binary
|
||||
nvm install iojs-v1.0.0
|
||||
nvm install iojs-v1.0.1
|
||||
|
||||
nvm use iojs-v1.0.0
|
||||
|
||||
node --version | grep v1.0.0 || die "precondition failed: iojs node doesn't start at v1.0.0"
|
||||
iojs --version | grep v1.0.0 || die "precondition failed: iojs binary doesn't start at v1.0.0"
|
||||
|
||||
nvm install iojs-v1.0.1
|
||||
|
||||
node --version | grep v1.0.1 || die "nvm install on already installed version doesn't use it (node binary)"
|
||||
iojs --version | grep v1.0.1 || die "nvm install on already installed version doesn't use it (iojs binary)"
|
||||
|
19
test/installation/io.js/install from binary
Executable file
19
test/installation/io.js/install from binary
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
|
||||
die () { echo $@ ; exit 1; }
|
||||
|
||||
. ../../../nvm.sh
|
||||
|
||||
NVM_TEST_VERSION="v1.0.0"
|
||||
NVM_PREFIXED_TEST_VERSION="iojs-$NVM_TEST_VERSION"
|
||||
|
||||
# Remove the stuff we're clobbering.
|
||||
[ -e ../../../$NVM_TEST_VERSION ] && rm -R ../../../$NVM_TEST_VERSION
|
||||
|
||||
# Install from binary
|
||||
nvm install $NVM_PREFIXED_TEST_VERSION || die "install $NVM_PREFIXED_TEST_VERSION failed"
|
||||
|
||||
# Check
|
||||
[ -d ../../../versions/io.js/$NVM_TEST_VERSION ]
|
||||
nvm run $NVM_PREFIXED_TEST_VERSION --version | grep $NVM_TEST_VERSION || die "'nvm run $NVM_PREFIXED_TEST_VERSION --version | grep $NVM_TEST_VERSION' failed"
|
||||
|
26
test/installation/io.js/install two versions and use the latest one
Executable file
26
test/installation/io.js/install two versions and use the latest one
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
|
||||
die () { echo $@ ; exit 1; }
|
||||
|
||||
. ../../../nvm.sh
|
||||
|
||||
# Remove the stuff we're clobbering.
|
||||
[ -e ../../../versions/io.js/v1.0.0 ] && rm -R ../../../versions/io.js/v1.0.0
|
||||
[ -e ../../../versions/io.js/v1.0.1 ] && rm -R ../../../versions/io.js/v1.0.1
|
||||
|
||||
# Install from binary
|
||||
nvm install iojs-v1.0.0 || die "'nvm install iojs-v1.0.0' failed"
|
||||
nvm i iojs-v1.0.1 || die "'nvm i iojs-v1.0.1' failed"
|
||||
|
||||
# Check
|
||||
[ -d ../../../versions/io.js/v1.0.0 ] || die "iojs v1.0.0 didn't exist"
|
||||
[ -d ../../../versions/io.js/v1.0.1 ] || die "iojs v1.0.1 didn't exist"
|
||||
|
||||
# Use the first one
|
||||
nvm use iojs-1.0.0 || die "'nvm use iojs-1.0.0' failed"
|
||||
|
||||
# Use the latest one
|
||||
nvm use iojs-1 || die "'nvm use iojs-1' failed"
|
||||
[ "_$(node --version)" = "_v1.0.1" ] || die "'node --version' was not v1.0.1, got: $(node --version)"
|
||||
[ "_$(iojs --version)" = "_v1.0.1" ] || die "'iojs --version' was not v1.0.1, got: $(iojs --version)"
|
||||
|
24
test/installation/io.js/install version specified in .nvmrc from binary
Executable file
24
test/installation/io.js/install version specified in .nvmrc from binary
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
|
||||
die () { echo $@ ; exit 1; }
|
||||
|
||||
. ../../../nvm.sh
|
||||
|
||||
NVM_TEST_VERSION=v1.0.0
|
||||
NVM_PREFIXED_TEST_VERSION="iojs-$NVM_TEST_VERSION"
|
||||
VERSION_PATH="../../../versions/io.js/$NVM_TEST_VERSION"
|
||||
|
||||
# Remove the stuff we're clobbering.
|
||||
[ -e $VERSION_PATH ] && rm -R $VERSION_PATH
|
||||
|
||||
# Install from binary
|
||||
echo "$NVM_PREFIXED_TEST_VERSION" > .nvmrc
|
||||
|
||||
nvm install || die "'nvm install' failed"
|
||||
|
||||
# Check
|
||||
[ -d $VERSION_PATH ] || die "./$VERSION_PATH did not exist"
|
||||
nvm run $NVM_PREFIXED_TEST_VERSION --version | grep $NVM_TEST_VERSION \
|
||||
|| "'nvm run $NVM_PREFIXED_TEST_VERSION --version | grep $NVM_TEST_VERSION' failed"
|
||||
|
||||
|
32
test/installation/io.js/install while reinstalling packages
Executable file
32
test/installation/io.js/install while reinstalling packages
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
|
||||
die () { echo $@ ; exit 1; }
|
||||
|
||||
. ../../../nvm.sh
|
||||
|
||||
# Remove the stuff we're clobbering.
|
||||
[ -e ../../../versions/io.js/v1.0.0 ] && rm -R ../../../versions/io.js/v1.0.0
|
||||
[ -e ../../../versions/io.js/v1.0.1 ] && rm -R ../../../versions/io.js/v1.0.1
|
||||
|
||||
# Install from binary
|
||||
nvm install iojs-v1.0.0
|
||||
|
||||
# Check
|
||||
[ -d ../../../versions/io.js/v1.0.0 ] || die "nvm install iojs-v1.0.0 didn't install"
|
||||
|
||||
node --version | grep v1.0.0 > /dev/null || die "nvm install didn't use iojs-v1.0.0"
|
||||
|
||||
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 iojs-1 | grep iojs-v1.0.0 > /dev/null || die "nvm ls iojs-1 didn't show iojs-v1.0.0"
|
||||
|
||||
nvm install iojs-v1.0.1 --reinstall-packages-from=iojs-1.0.0 || die "nvm install iojs-v1.0.1 --reinstall-packages-from=iojs-1.0.0 failed"
|
||||
|
||||
[ -d ../../../versions/io.js/v1.0.1 ] || die "nvm install iojs-v1.0.1 didn't install"
|
||||
|
||||
nvm use iojs-1
|
||||
node --version | grep v1.0.1 > /dev/null || die "nvm use iojs-1 didn't use v1.0.1"
|
||||
|
||||
npm list --global | grep is-nan > /dev/null || die "is-nan isn't installed"
|
||||
|
20
test/installation/io.js/nvm install v1 works
Executable file
20
test/installation/io.js/nvm install v1 works
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
|
||||
die () { echo $@ ; exit 1; }
|
||||
|
||||
. ../../../nvm.sh
|
||||
|
||||
NVM_VERSION="v1"
|
||||
NVM_PREFIXED_TEST_VERSION="$(nvm ls-remote "$NVM_VERSION" | tail -n1 | sed 's/^[ ]*//;s/[ ]*$//')"
|
||||
NVM_TEST_VERSION="$(nvm_strip_iojs_prefix "$NVM_PREFIXED_TEST_VERSION")"
|
||||
|
||||
# Remove the stuff we're clobbering.
|
||||
[ -e ../../../$NVM_TEST_VERSION ] && rm -R ../../../$NVM_TEST_VERSION
|
||||
|
||||
# Install from binary
|
||||
nvm install "$NVM_VERSION" || die "nvm install $NVM_VERSION failed"
|
||||
|
||||
# Check
|
||||
[ -d ../../../versions/io.js/$NVM_TEST_VERSION ]
|
||||
nvm run $NVM_PREFIXED_TEST_VERSION --version | grep $NVM_TEST_VERSION || die "'nvm run $NVM_PREFIXED_TEST_VERSION --version | grep $NVM_TEST_VERSION' failed"
|
||||
|
14
test/installation/io.js/teardown_dir
Executable file
14
test/installation/io.js/teardown_dir
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
. ../../../nvm.sh
|
||||
nvm deactivate
|
||||
nvm uninstall iojs-v1.0.0
|
||||
|
||||
if [ -f ".nvmrc" ]; then
|
||||
rm .nvmrc
|
||||
fi
|
||||
|
||||
if [ -f ".nvmrc.bak" ]; then
|
||||
mv .nvmrc.bak .nvmrc
|
||||
fi
|
||||
|
@@ -2,13 +2,13 @@
|
||||
|
||||
die () { echo $@ ; exit 1; }
|
||||
|
||||
. ../../nvm.sh
|
||||
. ../../../nvm.sh
|
||||
|
||||
[ "$(nvm install invalid.invalid 2>&1)" = "Version 'invalid.invalid' not found - try \`nvm ls-remote\` to browse available versions." ] || die "nvm installing an invalid version did not print a nice error message"
|
||||
|
||||
# Remove the stuff we're clobbering.
|
||||
[ -e ../../v0.9.7 ] && rm -R ../../v0.9.7
|
||||
[ -e ../../v0.9.12 ] && rm -R ../../v0.9.12
|
||||
[ -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
|
@@ -2,17 +2,17 @@
|
||||
|
||||
die () { echo $@ ; exit 1; }
|
||||
|
||||
. ../../nvm.sh
|
||||
. ../../../nvm.sh
|
||||
|
||||
NVM_TEST_VERSION=v0.10.7
|
||||
|
||||
# Remove the stuff we're clobbering.
|
||||
[ -e ../../$NVM_TEST_VERSION ] && rm -R ../../$NVM_TEST_VERSION
|
||||
[ -e ../../../$NVM_TEST_VERSION ] && rm -R ../../../$NVM_TEST_VERSION
|
||||
|
||||
# Install from binary
|
||||
nvm install $NVM_TEST_VERSION || die "install $NVM_TEST_VERSION failed"
|
||||
|
||||
# Check
|
||||
[ -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"
|
||||
|
@@ -2,17 +2,17 @@
|
||||
|
||||
die () { echo $@ ; exit 1; }
|
||||
|
||||
. ../../nvm.sh
|
||||
. ../../../nvm.sh
|
||||
|
||||
NVM_TEST_VERSION=v0.10.7
|
||||
|
||||
# Remove the stuff we're clobbering.
|
||||
[ -e ../../$NVM_TEST_VERSION ] && rm -R ../../$NVM_TEST_VERSION
|
||||
[ -e ../../../$NVM_TEST_VERSION ] && rm -R ../../../$NVM_TEST_VERSION
|
||||
|
||||
# Install from source
|
||||
nvm install -s $NVM_TEST_VERSION || die "'nvm install -s $NVM_TEST_VERSION' failed"
|
||||
|
||||
# Check
|
||||
[ -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"
|
||||
|
18
test/installation/node/install from source implicitly
Executable file
18
test/installation/node/install from source implicitly
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
die () { echo $@ ; exit 1; }
|
||||
|
||||
. ../../../nvm.sh
|
||||
|
||||
NVM_TEST_VERSION=v0.8.5
|
||||
|
||||
# Remove the stuff we're clobbering.
|
||||
[ -e ../../../$NVM_TEST_VERSION ] && rm -R ../../../$NVM_TEST_VERSION
|
||||
|
||||
# Install from source implicitly (v0.8.6 is when binaries started)
|
||||
nvm install $NVM_TEST_VERSION || die "'nvm install -s $NVM_TEST_VERSION' failed"
|
||||
|
||||
# Check
|
||||
[ -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"
|
||||
|
@@ -2,19 +2,19 @@
|
||||
|
||||
die () { echo $@ ; exit 1; }
|
||||
|
||||
. ../../nvm.sh
|
||||
. ../../../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
|
||||
[ -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 || die "'nvm install 0.9.7' failed"
|
||||
nvm i 0.9.12 || die "'nvm i 0.9.12' failed"
|
||||
|
||||
# Check
|
||||
[ -d ../../v0.9.7 ] || die "v0.9.7 didn't exist"
|
||||
[ -d ../../v0.9.12 ] || die "v0.9.12 didn't exist"
|
||||
[ -d ../../../v0.9.7 ] || die "v0.9.7 didn't exist"
|
||||
[ -d ../../../v0.9.12 ] || die "v0.9.12 didn't exist"
|
||||
|
||||
# Use the first one
|
||||
nvm use 0.9.7 || die "'nvm use 0.9.7' failed"
|
@@ -2,12 +2,12 @@
|
||||
|
||||
die () { echo $@ ; exit 1; }
|
||||
|
||||
. ../../nvm.sh
|
||||
. ../../../nvm.sh
|
||||
|
||||
NVM_TEST_VERSION=v0.10.7
|
||||
|
||||
# Remove the stuff we're clobbering.
|
||||
[ -e ../../$NVM_TEST_VERSION ] && rm -R ../../$NVM_TEST_VERSION
|
||||
[ -e ../../../$NVM_TEST_VERSION ] && rm -R ../../../$NVM_TEST_VERSION
|
||||
|
||||
# Install from binary
|
||||
echo "$NVM_TEST_VERSION" > .nvmrc
|
||||
@@ -15,7 +15,7 @@ echo "$NVM_TEST_VERSION" > .nvmrc
|
||||
nvm install || die "'nvm install' failed"
|
||||
|
||||
# Check
|
||||
[ -d ../../$NVM_TEST_VERSION ] || die "./$NVM_TEST_VERSION did not exist"
|
||||
[ -d ../../../$NVM_TEST_VERSION ] || die "./$NVM_TEST_VERSION did not exist"
|
||||
nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION \
|
||||
|| "'nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION' failed"
|
||||
|
@@ -2,12 +2,12 @@
|
||||
|
||||
die () { echo $@ ; exit 1; }
|
||||
|
||||
. ../../nvm.sh
|
||||
. ../../../nvm.sh
|
||||
|
||||
NVM_TEST_VERSION=v0.10.7
|
||||
|
||||
# Remove the stuff we're clobbering.
|
||||
[ -e ../../$NVM_TEST_VERSION ] && rm -R ../../$NVM_TEST_VERSION
|
||||
[ -e ../../../$NVM_TEST_VERSION ] && rm -R ../../../$NVM_TEST_VERSION
|
||||
|
||||
# Install from binary
|
||||
echo "$NVM_TEST_VERSION" > .nvmrc
|
||||
@@ -15,7 +15,7 @@ echo "$NVM_TEST_VERSION" > .nvmrc
|
||||
nvm install -s || "'nvm install -s' failed"
|
||||
|
||||
# Check
|
||||
[ -d ../../$NVM_TEST_VERSION ] || die "$NVM_TEST_VERSION did not exist"
|
||||
[ -d ../../../$NVM_TEST_VERSION ] || die "$NVM_TEST_VERSION did not exist"
|
||||
nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION \
|
||||
|| die "'nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION' failed"
|
||||
|
@@ -2,17 +2,17 @@
|
||||
|
||||
die () { echo $@ ; exit 1; }
|
||||
|
||||
. ../../nvm.sh
|
||||
. ../../../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
|
||||
[ -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"
|
||||
[ -d ../../../v0.9.7 ] || die "nvm install 0.9.7 didn't install"
|
||||
|
||||
nvm use 0.9.7
|
||||
|
||||
@@ -25,7 +25,7 @@ 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 --reinstall-packages-from=0.9 || die "nvm install 0.9.12 --reinstall-packages-from=0.9 failed"
|
||||
|
||||
[ -d ../../v0.9.12 ] || die "nvm install 0.9.12 didn't install"
|
||||
[ -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"
|
6
test/installation/node/setup_dir
Executable file
6
test/installation/node/setup_dir
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ -f ".nvmrc" ]; then
|
||||
mv .nvmrc .nvmrc.bak
|
||||
fi
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
. ../../nvm.sh
|
||||
. ../../../nvm.sh
|
||||
nvm deactivate
|
||||
nvm uninstall v0.10.7
|
||||
|
@@ -7,8 +7,3 @@ die () { echo $@ ; exit 1; }
|
||||
nvm install 0.10
|
||||
|
||||
[ "$(nvm current)" = "$(node -v)" ] || die "Failed to find current version: got \"$(nvm current)\", expected \"$(node -v)\""
|
||||
|
||||
nvm install 0.6.21
|
||||
[ "$(node -v)" = "v0.6.21-pre" ] || die "v0.6.21-pre not installed with v0.6.21"
|
||||
[ "$(nvm current)" = "v0.6.21" ] || die "v0.6.21-pre not reported as v0.6.21"
|
||||
|
||||
|
10
test/slow/node 0.6.21 should install 0.6.21-pre
Executable file
10
test/slow/node 0.6.21 should install 0.6.21-pre
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
die () { echo $@ ; exit 1; }
|
||||
|
||||
. ../../nvm.sh
|
||||
|
||||
nvm install 0.6.21 || die 'v0.6.21 installation failed'
|
||||
[ "_$(node -v)" = "_v0.6.21-pre" ] || die "v0.6.21-pre not installed with v0.6.21, got $(node -v)"
|
||||
[ "_$(nvm current)" = "_v0.6.21" ] || die "v0.6.21-pre not reported as v0.6.21, got $(nvm current)"
|
||||
|
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
die () { echo $@ ; exit 1; }
|
||||
|
||||
. ../../../nvm.sh
|
||||
|
||||
[ "$(nvm run 0.2 --version 2>&1)" = "v0.2 is not installed yet" ] || die "\`nvm run\` with an uninstalled node version failed to error out correctly"
|
||||
[ "$(nvm run iojs-0.2 --version 2>&1)" = "iojs-v0.2 is not installed yet" ] || die "\`nvm run\` with an uninstalled iojs version failed to error out correctly"
|
14
test/slow/nvm use/Running "nvm use iojs" uses latest io.js version
Executable file
14
test/slow/nvm use/Running "nvm use iojs" uses latest io.js version
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
die () { echo $@ ; exit 1; }
|
||||
|
||||
. ../../../nvm.sh
|
||||
|
||||
nvm deactivate 2>&1 >/dev/null || die 'deactivate failed'
|
||||
|
||||
nvm use iojs || die 'nvm use iojs failed'
|
||||
OUTPUT="$(nvm current)"
|
||||
EXPECTED_OUTPUT="iojs-v1.0.1"
|
||||
|
||||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] \
|
||||
|| die "'nvm use iojs' + 'nvm current' did not output '$EXPECTED_OUTPUT'; got '$OUTPUT'"
|
14
test/slow/nvm use/Running "nvm use node" uses latest stable node version
Executable file
14
test/slow/nvm use/Running "nvm use node" uses latest stable node version
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
die () { echo $@ ; exit 1; }
|
||||
|
||||
. ../../../nvm.sh
|
||||
|
||||
nvm deactivate 2>&1 >/dev/null || die 'deactivate failed'
|
||||
|
||||
nvm use node || die 'nvm use node failed'
|
||||
OUTPUT="$(nvm current)"
|
||||
EXPECTED_OUTPUT="$(nvm_version stable)"
|
||||
|
||||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] \
|
||||
|| die "'nvm use node' + 'nvm current' did not output '$EXPECTED_OUTPUT'; got '$OUTPUT'"
|
14
test/slow/nvm use/Running "nvm use v1.0.0" uses iojs-v1.0.0 iojs version
Executable file
14
test/slow/nvm use/Running "nvm use v1.0.0" uses iojs-v1.0.0 iojs version
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
die () { echo $@ ; exit 1; }
|
||||
|
||||
. ../../../nvm.sh
|
||||
|
||||
nvm deactivate 2>&1 >/dev/null || die 'deactivate failed'
|
||||
|
||||
nvm use 'v1.0.0' || die 'nvm use v1.0.0 failed'
|
||||
OUTPUT="$(nvm current)"
|
||||
EXPECTED_OUTPUT="$(nvm_version v1.0.0)"
|
||||
|
||||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] \
|
||||
|| die "'nvm use v1.0.0' + 'nvm current' did not output '$EXPECTED_OUTPUT'; got '$OUTPUT'"
|
16
test/slow/nvm use/setup_dir
Executable file
16
test/slow/nvm use/setup_dir
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
. ../../../nvm.sh
|
||||
|
||||
mkdir -p ../../../.nvm_use_bak
|
||||
if [ -d "../../../v*" ]; then
|
||||
mv "../../../v*" ../../../.nvm_use_bak/
|
||||
fi
|
||||
|
||||
for VERSION in "0.8.7" "0.9.1" "0.10.1" "0.11.1"; do
|
||||
nvm install "v$VERSION"
|
||||
done
|
||||
|
||||
for VERSION in "1.0.0" "1.0.1"; do
|
||||
nvm install "iojs-v$VERSION"
|
||||
done
|
16
test/slow/nvm use/teardown_dir
Executable file
16
test/slow/nvm use/teardown_dir
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
. ../../../nvm.sh
|
||||
|
||||
for VERSION in "0.8.7" "0.9.1" "0.10.1" "0.11.1"; do
|
||||
nvm uninstall "$VERSION"
|
||||
done
|
||||
|
||||
for VERSION in "1.0.0" "1.0.1"; do
|
||||
nvm uninstall "iojs-v$VERSION"
|
||||
done
|
||||
|
||||
if [ -d ../../../.nvm_use_bak/* ]; then
|
||||
mv ../../../.nvm_use_bak/* ../../../
|
||||
fi
|
||||
rmdir ../../../.nvm_use_bak
|
@@ -31,7 +31,7 @@ wget() {
|
||||
--2014-12-21 18:11:14-- http://latest.nvm.sh/
|
||||
Resolving latest.nvm.sh... 50.31.209.229
|
||||
Connecting to latest.nvm.sh|50.31.209.229|:80... connected.
|
||||
HTTP request sent, awaiting response...
|
||||
HTTP request sent, awaiting response...
|
||||
HTTP/1.1 301 Moved Permanently
|
||||
Location: https://github.com/creationix/nvm/releases/latest
|
||||
Content-Type: text/html; charset=utf-8
|
||||
@@ -41,7 +41,7 @@ Location: https://github.com/creationix/nvm/releases/latest [following]
|
||||
--2014-12-21 18:11:15-- https://github.com/creationix/nvm/releases/latest
|
||||
Resolving github.com... 192.30.252.130
|
||||
Connecting to github.com|192.30.252.130|:443... connected.
|
||||
HTTP request sent, awaiting response...
|
||||
HTTP request sent, awaiting response...
|
||||
HTTP/1.1 302 Found
|
||||
Server: GitHub.com
|
||||
Date: Mon, 22 Dec 2014 02:11:15 GMT
|
||||
@@ -68,7 +68,7 @@ HTTP request sent, awaiting response...
|
||||
Location: $URL [following]
|
||||
--2014-12-21 18:11:15-- $URL
|
||||
Reusing existing connection to github.com:443.
|
||||
HTTP request sent, awaiting response...
|
||||
HTTP request sent, awaiting response...
|
||||
HTTP/1.1 200 OK
|
||||
Server: GitHub.com
|
||||
Date: Mon, 22 Dec 2014 02:11:15 GMT
|
28
test/sourcing/Sourcing nvm.sh with --install and .nvmrc should install it
Executable file
28
test/sourcing/Sourcing nvm.sh with --install and .nvmrc should install it
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
|
||||
die () { echo $@ ; exit 1; }
|
||||
supports_source_options () {
|
||||
[ "_$(echo 'echo $1' | . /dev/stdin yes)" = "_yes" ]
|
||||
}
|
||||
|
||||
if ! supports_source_options; then
|
||||
echo 'this shell does not support passing options on sourcing'
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
echo '0.10.2' > ../../.nvmrc || die 'creation of .nvmrc failed'
|
||||
|
||||
. ../../nvm.sh --install
|
||||
EXIT_CODE="$(echo $?)"
|
||||
|
||||
echo 'sourcing complete.'
|
||||
|
||||
nvm_version 0.10.2 >/dev/null 2>&1 || die "v0.10.2 not installed: $(nvm ls)"
|
||||
|
||||
[ "_$(nvm_rc_version | \grep -o -e 'with version .*$')" = "_with version <0.10.2>" ] || die "nvm_rc_version $(nvm_rc_version)"
|
||||
|
||||
[ "_$EXIT_CODE" = "_0" ] || die "sourcing returned nonzero exit code: $EXIT_CODE"
|
||||
|
||||
NVM_LS_CURRENT="$(nvm ls current | \grep -o v0.10.2)"
|
||||
[ "_$NVM_LS_CURRENT" = '_v0.10.2' ] || die "'nvm ls current' did not return '-> v0.10.2', got '$NVM_LS_CURRENT' `nvm ls`"
|
||||
|
32
test/sourcing/Sourcing nvm.sh with --install should install the default
Executable file
32
test/sourcing/Sourcing nvm.sh with --install should install the default
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
|
||||
die () { echo $@ ; exit 1; }
|
||||
supports_source_options () {
|
||||
[ "_$(echo 'echo $1' | . /dev/stdin yes)" = "_yes" ]
|
||||
}
|
||||
|
||||
if ! supports_source_options; then
|
||||
echo 'this shell does not support passing options on sourcing'
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
echo '0.10.2' > ../../alias/default || die 'creation of default alias failed'
|
||||
|
||||
echo 'sourcing nvm with --install...'
|
||||
|
||||
. ../../nvm.sh --install
|
||||
EXIT_CODE="$(echo $?)"
|
||||
|
||||
echo 'sourcing complete.'
|
||||
|
||||
nvm_version 0.10.2 >/dev/null 2>&1 || die "v0.10.2 not installed: $(nvm ls)"
|
||||
|
||||
[ "_$EXIT_CODE" = "_0" ] || die "sourcing returned nonzero exit code: $EXIT_CODE"
|
||||
|
||||
NVM_LS_CURRENT="$(nvm ls current | \grep -o v0.10.2)"
|
||||
[ "_$NVM_LS_CURRENT" = '_v0.10.2' ] || die "'nvm ls current' did not return '-> v0.10.2', got '$NVM_LS_CURRENT'"
|
||||
|
||||
NVM_ALIAS_DEFAULT="$(nvm alias default)"
|
||||
[ "_$NVM_ALIAS_DEFAULT" = "_default -> 0.10.2 (-> v0.10.2)" ] \
|
||||
|| die "'nvm alias default did not return 'default -> 0.10.2 (-> v0.10.2)', got '$NVM_ALIAS_DEFAULT'"
|
||||
|
Reference in New Issue
Block a user