Use NVM_PATH instead of NODE_PATH

master
Tim Caswell 2010-05-14 10:39:54 -07:00
parent b542e3e205
commit 359a83e6c5
1 changed files with 15 additions and 14 deletions

29
nvm.sh
View File

@ -51,28 +51,31 @@ nvm()
"deactivate" ) "deactivate" )
if [[ $PATH == *$NVM_DIR/*/bin* ]]; then if [[ $PATH == *$NVM_DIR/*/bin* ]]; then
export PATH=${PATH%$NVM_DIR/*/bin*}${PATH#*$NVM_DIR/*/bin:} export PATH=${PATH%$NVM_DIR/*/bin*}${PATH#*$NVM_DIR/*/bin:}
unset NODE_PATH
echo "$NVM_DIR/*/bin removed from \$PATH" echo "$NVM_DIR/*/bin removed from \$PATH"
else else
echo "Could not find $NVM_DIR/*/bin in \$PATH" echo "Could not find $NVM_DIR/*/bin in \$PATH"
fi fi
unset NVM_PATH
unset NVM_DIR
unset NVM_BIN
echo "Unset NVM_PATH, NVM_BIN, and NVM_DIR."
;; ;;
"addlib" ) "addlib" )
mkdir -p $NODE_PATH mkdir -p $NVM_PATH
mkdir -p $NODE_BIN mkdir -p $NVM_BIN
if [ -d `pwd`/lib ]; then if [ -d `pwd`/lib ]; then
cp -r `pwd`/lib/ "$NODE_PATH/" cp -r `pwd`/lib/ "$NVM_PATH/"
cp -r `pwd`/bin/ "$NODE_BIN/" cp -r `pwd`/bin/ "$NVM_BIN/"
else else
echo "Can't find lib dir at `pwd`/lib" echo "Can't find lib dir at `pwd`/lib"
fi fi
;; ;;
"linklib" ) "linklib" )
mkdir -p $NODE_PATH mkdir -p $NVM_PATH
mkdir -p $NODE_BIN mkdir -p $NVM_BIN
if [ -d `pwd`/lib ]; then if [ -d `pwd`/lib ]; then
ln -sf `pwd`/lib/* "$NODE_PATH/" ln -sf `pwd`/lib/* "$NVM_PATH/"
ln -sf `pwd`/bin/* "$NODE_BIN/" ln -sf `pwd`/bin/* "$NVM_BIN/"
else else
echo "Can't find lib dir at `pwd`/lib" echo "Can't find lib dir at `pwd`/lib"
fi fi
@ -94,14 +97,12 @@ nvm()
PATH="$NVM_DIR/$2/bin:$PATH" PATH="$NVM_DIR/$2/bin:$PATH"
fi fi
export PATH export PATH
export NODE_PATH="$NVM_DIR/$2/lib/node" export NVM_PATH="$NVM_DIR/$2/lib/node"
export NODE_BIN="$NVM_DIR/$2/bin" export NVM_BIN="$NVM_DIR/$2/bin"
mkdir -p "$NODE_PATH"
mkdir -p "$NODE_BIN"
echo "Now using node $2" echo "Now using node $2"
;; ;;
"listlibs" ) "listlibs" )
ls $NODE_PATH | grep -v wafadmin ls $NVM_PATH | grep -v wafadmin
;; ;;
"list" ) "list" )
if [ $# -ne 1 ]; then if [ $# -ne 1 ]; then