-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #616 from ljharb/iojs
Add `io.js` support. This branch adds support for https://github.com/iojs/io.js / https://iojs.org/ The following features should now work: - `nvm install iojs` will install the latest `io.js` version. `nvm ls iojs` and `nvm use iojs` will function as you'd expect. - `nvm install node` will install the latest stable `node` version. `nvm ls node` and `nvm use node` will function as you'd expect. - In general, a specific `io.js` version can be referenced with the "iojs-" prefix. If `node` were to ever release a `v1.0.0`, `v1.0.0` would refer to `node`, and `iojs-v1.0.0` would refer to `io.js`. In the near future, `node-v1.0.0` will also refer to `node` unambiguously. This applies to all `nvm` commands, including working with aliases and `.nvmrc` files. - `io.js`, unlike `node`, does not have a SunOS binary. Please open an issue on https://github.com/iojs/io.js if this is actually a problem for anyone, as currently it seems like this won't be for anybody. **Note**: checksum support upon installation is currently disabled. Relates to nodejs/node#368. **Note**: installation of `io.js` directly from source (via the `-s` option) is not yet enabled. This will be added soon. Relates to nodejs/node#40 nodejs/node#420 Fixes #590
- Loading branch information
Showing
28 changed files
with
771 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,6 @@ | |
|
||
. ../../../nvm.sh | ||
|
||
nvm ls node | ||
nvm ls node_ | ||
[ "$?" = "3" ] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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?!' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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?!' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 26 additions & 0 deletions
26
test/installation/io.js/install two versions and use the latest one
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 24 additions & 0 deletions
24
test/installation/io.js/install version specified in .nvmrc from binary
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
|
||
|
Oops, something went wrong.