2012-10-11 07:17:09 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
2016-07-07 15:00:59 +08:00
|
|
|
set -ex
|
|
|
|
|
2016-11-07 03:34:36 +08:00
|
|
|
die () { echo "$@" ; exit 1; }
|
2013-05-04 00:46:21 +08:00
|
|
|
|
2022-12-28 05:16:10 +08:00
|
|
|
export NVM_DIR="$(cd ../.. && pwd)"
|
|
|
|
|
2016-11-04 13:15:18 +08:00
|
|
|
\. ../../nvm.sh
|
2018-06-01 06:26:30 +08:00
|
|
|
\. ../common.sh
|
|
|
|
|
|
|
|
make_fake_node v0.2.3
|
|
|
|
|
|
|
|
[ `expr $PATH : ".*v0.2.3/.*/bin.*"` = 0 ] || echo "WARNING: Unexpectedly found v0.2.3 already active" >&2
|
2016-07-07 15:00:59 +08:00
|
|
|
|
2015-09-21 19:47:37 +08:00
|
|
|
nvm use --delete-prefix v0.2.3 || die "Failed to activate v0.2.3"
|
2016-11-15 01:19:39 +08:00
|
|
|
[ `expr "$PATH" : ".*v0.2.3/.*/bin.*"` != 0 ] || die "PATH not set up properly"
|
|
|
|
[ `expr "$NODE_PATH" : ".*v0.2.3/.*/lib/node_modules.*"` = 0 ] || die "NODE_PATH should not contain (npm root -g)"
|
2014-11-30 00:52:09 +08:00
|
|
|
# ^ note: NODE_PATH should not contain `npm root -g` since globals should not be requireable
|
2016-12-17 02:57:22 +08:00
|
|
|
[ `expr "$NVM_BIN" : ".*v0.2.3/bin"` != 0 ] || die "NODE_BIN should contain bin directory path"
|
2013-05-04 00:46:21 +08:00
|
|
|
|
2014-12-03 16:04:12 +08:00
|
|
|
nvm deactivate || die "Failed to deactivate v0.2.3"
|
2016-11-15 01:19:39 +08:00
|
|
|
[ `expr "$PATH" : ".*v0.2.3/.*/bin.*"` = 0 ] || die "PATH not cleaned properly"
|
|
|
|
[ `expr "$NODE_PATH" : ".*v0.2.3/.*/lib/node_modules.*"` = 0 ] || die "NODE_PATH not cleaned properly"
|
2016-03-11 06:37:51 +08:00
|
|
|
[ "_$NVM_BIN" = "_" ] || die "NVM_BIN should be unset: got '$NVM_BIN'"
|