2013-01-12 12:30:12 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
2016-08-11 16:40:03 +08:00
|
|
|
set -ex
|
|
|
|
|
2014-10-03 17:35:39 +08:00
|
|
|
die () { echo $@ ; exit 1; }
|
|
|
|
|
2016-08-11 16:40:03 +08:00
|
|
|
set +e # TODO: fix
|
2016-11-04 13:15:18 +08:00
|
|
|
\. ../../nvm.sh
|
2016-08-11 16:40:03 +08:00
|
|
|
set -e
|
|
|
|
|
|
|
|
nvm deactivate || die 'deactivate failed'
|
2013-01-12 12:30:12 +08:00
|
|
|
|
2016-02-04 16:26:33 +08:00
|
|
|
nvm unalias default || die 'unable to unalias default'
|
|
|
|
|
2014-04-20 07:48:14 +08:00
|
|
|
NVM_TEST_VERSION=v0.10.7
|
2014-02-22 10:15:40 +08:00
|
|
|
|
2013-01-12 12:30:12 +08:00
|
|
|
# Remove the stuff we're clobbering.
|
2016-08-11 16:40:03 +08:00
|
|
|
nvm uninstall "${NVM_TEST_VERSION}" || die 'nvm uninstall failed'
|
2013-01-12 12:30:12 +08:00
|
|
|
|
|
|
|
# Install from source
|
2016-08-11 16:40:03 +08:00
|
|
|
nvm install -s "${NVM_TEST_VERSION}" || die "'nvm install -s ${NVM_TEST_VERSION}' failed"
|
2013-01-12 12:30:12 +08:00
|
|
|
|
|
|
|
# Check
|
2016-08-11 16:40:03 +08:00
|
|
|
[ -d ../../$NVM_TEST_VERSION ] || die "../../${NVM_TEST_VERSION} is not a directory"
|
|
|
|
nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION || "'nvm run ${NVM_TEST_VERSION} --version | grep ${NVM_TEST_VERSION}' failed"
|
2014-04-20 07:48:14 +08:00
|
|
|
|
2016-02-04 16:26:33 +08:00
|
|
|
# ensure default is set
|
|
|
|
NVM_CURRENT_DEFAULT="$(nvm_alias default)"
|
2016-08-11 16:40:03 +08:00
|
|
|
[ "${NVM_CURRENT_DEFAULT}" = "${NVM_TEST_VERSION}" ] || die "wrong default alias: $(nvm alias)"
|