2015-01-14 09:52:18 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
2016-11-07 03:34:36 +08:00
|
|
|
die () { echo "$@" ; exit 1; }
|
2015-01-14 09:52:18 +08:00
|
|
|
|
2016-11-04 13:15:18 +08:00
|
|
|
\. ../../nvm.sh
|
2015-01-14 09:52:18 +08:00
|
|
|
|
|
|
|
# Remove the stuff we're clobbering.
|
2016-06-27 06:52:26 +08:00
|
|
|
[ -e "${NVM_DIR}/versions/io.js/v1.0.0" ] && rm -R "${NVM_DIR}/versions/io.js/v1.0.0"
|
|
|
|
[ -e "${NVM_DIR}/versions/io.js/v1.0.1" ] && rm -R "${NVM_DIR}/versions/io.js/v1.0.1"
|
2015-01-14 09:52:18 +08:00
|
|
|
|
|
|
|
# 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
|
2016-06-27 06:52:26 +08:00
|
|
|
[ -d "${NVM_DIR}/versions/io.js/v1.0.0" ] || die "iojs v1.0.0 didn't exist"
|
|
|
|
[ -d "${NVM_DIR}/versions/io.js/v1.0.1" ] || die "iojs v1.0.1 didn't exist"
|
2015-01-14 09:52:18 +08:00
|
|
|
|
|
|
|
# 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)"
|