2014-09-29 15:09:17 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
. ../../../nvm.sh
|
|
|
|
|
|
|
|
die () { echo $@ ; cleanup ; exit 1; }
|
|
|
|
cleanup () {
|
2014-10-22 16:26:34 +08:00
|
|
|
rm -rf ../../../alias/stable
|
|
|
|
rm -rf ../../../alias/unstable
|
2015-02-11 06:41:45 +08:00
|
|
|
rm -rf ../../../alias/node
|
|
|
|
rm -rf ../../../alias/iojs
|
2014-09-29 15:09:17 +08:00
|
|
|
rm -rf ../../../v0.8.1
|
|
|
|
rm -rf ../../../v0.9.1
|
2015-02-11 06:41:45 +08:00
|
|
|
rm -rf ../../../versions/io.js/v0.2.1
|
2014-09-29 15:09:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
mkdir ../../../v0.8.1
|
|
|
|
mkdir ../../../v0.9.1
|
2015-02-11 06:41:45 +08:00
|
|
|
mkdir -p ../../../versions/io.js/v0.2.1
|
2014-09-29 15:09:17 +08:00
|
|
|
|
|
|
|
EXPECTED_STABLE="$(nvm_print_implicit_alias local stable)"
|
|
|
|
STABLE_VERSION="$(nvm_version "$EXPECTED_STABLE")"
|
|
|
|
|
|
|
|
EXPECTED_UNSTABLE="$(nvm_print_implicit_alias local unstable)"
|
|
|
|
UNSTABLE_VERSION="$(nvm_version "$EXPECTED_UNSTABLE")"
|
|
|
|
|
|
|
|
[ "_$STABLE_VERSION" != "_$UNSTABLE_VERSION" ] \
|
|
|
|
|| die "stable and unstable versions are the same!"
|
|
|
|
|
|
|
|
nvm alias stable "$EXPECTED_UNSTABLE"
|
|
|
|
nvm alias unstable "$EXPECTED_STABLE"
|
2015-02-11 06:41:45 +08:00
|
|
|
nvm alias node stable
|
|
|
|
nvm alias iojs unstable
|
2014-09-29 15:09:17 +08:00
|
|
|
|
|
|
|
NVM_ALIAS_OUTPUT=$(nvm alias)
|
|
|
|
|
2015-02-11 06:41:45 +08:00
|
|
|
echo "$NVM_ALIAS_OUTPUT" | command grep -e "^stable -> $EXPECTED_UNSTABLE (-> $UNSTABLE_VERSION)$" \
|
2014-09-29 15:09:17 +08:00
|
|
|
|| die "nvm alias did not contain the overridden 'stable' alias"
|
|
|
|
|
2015-02-11 06:41:45 +08:00
|
|
|
echo "$NVM_ALIAS_OUTPUT" | command grep -e "^unstable -> $EXPECTED_STABLE (-> $STABLE_VERSION)$" \
|
2014-09-29 15:09:17 +08:00
|
|
|
|| die "nvm alias did not contain the overridden 'unstable' alias"
|
|
|
|
|
2015-02-11 06:41:45 +08:00
|
|
|
echo "$NVM_ALIAS_OUTPUT" | command grep -e "^node -> stable (-> $UNSTABLE_VERSION)$" \
|
|
|
|
|| die "nvm alias did not contain the overridden 'node' alias"
|
|
|
|
|
|
|
|
echo "$NVM_ALIAS_OUTPUT" | command grep -e "^iojs -> unstable (-> $STABLE_VERSION)$" \
|
|
|
|
|| die "nvm alias did not contain the overridden 'iojs' alias"
|
|
|
|
|
2014-09-29 15:09:17 +08:00
|
|
|
cleanup
|
|
|
|
|