Add io.js support to `nvm_version_dir`

master
Jordan Harband 2015-01-12 00:33:13 -08:00
parent 654c37bc29
commit 3fa11c35cb
2 changed files with 3 additions and 0 deletions

2
nvm.sh
View File

@ -144,6 +144,8 @@ nvm_version_dir() {
NVM_WHICH_DIR="$1" NVM_WHICH_DIR="$1"
if [ -z "$NVM_WHICH_DIR" ] || [ "_$NVM_WHICH_DIR" = "_new" ]; then if [ -z "$NVM_WHICH_DIR" ] || [ "_$NVM_WHICH_DIR" = "_new" ]; then
echo "$NVM_DIR/versions/node" echo "$NVM_DIR/versions/node"
elif [ "_$NVM_WHICH_DIR" = "_iojs" ]; then
echo "$NVM_DIR/versions/io.js"
elif [ "_$NVM_WHICH_DIR" = "_old" ]; then elif [ "_$NVM_WHICH_DIR" = "_old" ]; then
echo "$NVM_DIR" echo "$NVM_DIR"
else else

View File

@ -5,6 +5,7 @@ die () { echo $@ ; exit 1; }
. ../../../nvm.sh . ../../../nvm.sh
[ "$(nvm_version_dir)" = "$NVM_DIR/versions/node" ] || die '"nvm_version_dir" did not return new dir path' [ "$(nvm_version_dir)" = "$NVM_DIR/versions/node" ] || die '"nvm_version_dir" did not return new dir path'
[ "$(nvm_version_dir iojs)" = "$NVM_DIR/versions/io.js" ] || die '"nvm_version_dir iojs" did not return iojs dir path'
[ "$(nvm_version_dir new)" = "$(nvm_version_dir)" ] || die '"nvm_version_dir new" did not return new dir path' [ "$(nvm_version_dir new)" = "$(nvm_version_dir)" ] || die '"nvm_version_dir new" did not return new dir path'
[ "$(nvm_version_dir old)" = "$NVM_DIR" ] || die '"nvm_version_dir old" did not return old dir path' [ "$(nvm_version_dir old)" = "$NVM_DIR" ] || die '"nvm_version_dir old" did not return old dir path'
[ "$(nvm_version_dir foo 2>&1)" = "unknown version dir" ] || die '"nvm_version_dir foo" did not error out' [ "$(nvm_version_dir foo 2>&1)" = "unknown version dir" ] || die '"nvm_version_dir foo" did not error out'