2015-01-21 15:46:29 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
2016-07-08 06:38:34 +08:00
|
|
|
set -ex
|
|
|
|
|
2016-11-04 13:15:18 +08:00
|
|
|
\. ../common.sh
|
2016-07-08 06:38:34 +08:00
|
|
|
|
2016-11-07 03:34:36 +08:00
|
|
|
die () { echo "$@" ; cleanup ; exit 1; }
|
2015-01-21 15:46:29 +08:00
|
|
|
|
2016-07-08 06:38:34 +08:00
|
|
|
VERSION="v3.99.0"
|
|
|
|
|
2015-01-21 15:46:29 +08:00
|
|
|
cleanup() {
|
2016-07-08 06:38:34 +08:00
|
|
|
unset -f make_echo cleanup
|
|
|
|
rm -rf "$(nvm_version_path "iojs-${VERSION}")"
|
2015-01-21 15:46:29 +08:00
|
|
|
}
|
|
|
|
|
2016-11-04 13:15:18 +08:00
|
|
|
\. ../../nvm.sh
|
2015-01-21 15:46:29 +08:00
|
|
|
|
2016-07-08 06:38:34 +08:00
|
|
|
nvm deactivate || die "unable to deactivate; current: >$(nvm current)<"
|
2015-01-21 15:46:29 +08:00
|
|
|
|
2016-07-08 06:38:34 +08:00
|
|
|
make_fake_iojs "${VERSION}" || die "unable to make_fake_iojs ${VERSION}"
|
2015-01-21 15:46:29 +08:00
|
|
|
|
2016-07-08 06:38:34 +08:00
|
|
|
IOJS_VERSION="$(nvm_version iojs)"
|
|
|
|
[ -n "${IOJS_VERSION}" ] || die 'expected an io.js version; got none'
|
2015-07-10 08:27:35 +08:00
|
|
|
|
2016-07-08 06:38:34 +08:00
|
|
|
EXPECTED_OUTPUT="$(nvm_add_iojs_prefix ${VERSION})"
|
|
|
|
[ "${IOJS_VERSION}" = "${EXPECTED_OUTPUT}" ] || die "iojs version was not >${EXPECTED_OUTPUT}; got >${IOJS_VERSION}<"
|
2015-09-21 10:45:53 +08:00
|
|
|
|
2016-07-08 06:38:34 +08:00
|
|
|
nvm use --delete-prefix iojs || die '`nvm use iojs` failed'
|
2015-07-10 08:27:35 +08:00
|
|
|
|
2020-11-04 08:05:34 +08:00
|
|
|
# Remove node_modules/.bin from the path so that the system version `which` is
|
|
|
|
# used in nvm_ls_current
|
|
|
|
PATH=$(echo "$PATH" | tr ":" "\n" | grep -v "node_modules/.bin" | tr "\n" ":") CURRENT="$(nvm current)"
|
2016-07-08 06:38:34 +08:00
|
|
|
echo "current: ${CURRENT}"
|
2015-09-21 10:45:53 +08:00
|
|
|
|
2016-07-08 06:38:34 +08:00
|
|
|
[ "${CURRENT}" = "${IOJS_VERSION}" ] || die "expected >${IOJS_VERSION}<; got >${CURRENT}<"
|
2015-01-21 15:46:29 +08:00
|
|
|
|
2016-07-08 06:38:34 +08:00
|
|
|
cleanup
|