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
|
|
|
|
|
|
|
NVM_TEST_VERSION="v1.0.0"
|
|
|
|
NVM_PREFIXED_TEST_VERSION="iojs-$NVM_TEST_VERSION"
|
|
|
|
|
|
|
|
# Remove the stuff we're clobbering.
|
2016-06-27 06:52:26 +08:00
|
|
|
[ -e "${NVM_DIR}/versions/io.js/${NVM_TEST_VERSION}" ] && rm -R "${NVM_DIR}/versions/io.js/${NVM_TEST_VERSION}"
|
2019-01-22 15:46:29 +08:00
|
|
|
[ -e "${NVM_DIR}/.cache/bin/${NVM_TEST_VERSION}-linux-x64/" ] && rm -R "${NVM_DIR}/.cache/bin/${NVM_TEST_VERSION}-linux-x64/"
|
2015-01-14 09:52:18 +08:00
|
|
|
|
|
|
|
# Install from binary
|
2019-01-22 15:46:29 +08:00
|
|
|
OUTPUT_HEAD="$(2>&1 nvm install --no-progress $NVM_PREFIXED_TEST_VERSION | tac | tail -n 1)" || die "install $NVM_PREFIXED_TEST_VERSION failed"
|
|
|
|
EXPECTED_OUTPUT_HEAD="Downloading and installing io.js v1.0.0..."
|
|
|
|
|
|
|
|
[ "${OUTPUT_HEAD}" = "${EXPECTED_OUTPUT_HEAD}" ] || die "expected >${EXPECTED_OUTPUT_HEAD}<; got >${OUTPUT_HEAD}<"
|
2015-01-14 09:52:18 +08:00
|
|
|
|
|
|
|
# Check
|
2016-06-27 06:52:26 +08:00
|
|
|
[ -d "${NVM_DIR}/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"
|