Remove clone and update, these are better done by hand, add listlibs and a way to use the latest stable version
parent
2527ff6b1f
commit
7df245c569
|
@ -8,25 +8,24 @@ To install create a folder somewhere in your filesystem with the "`nvm.sh`" file
|
|||
|
||||
Or if you have `git` installed, then just clone it:
|
||||
|
||||
git clone git://gist.github.com/367305.git ~/.nvm
|
||||
git clone git://github.com/creationix/nvm.git ~/.nvm
|
||||
|
||||
Then add three lines to your bash profile:
|
||||
Then add two lines to your bash profile:
|
||||
|
||||
NVM_DIR=$HOME/.nvm
|
||||
. $NVM_DIR/nvm.sh
|
||||
nvm use v0.1.91
|
||||
nvm use
|
||||
|
||||
The first line tells your system where NVM is installed, you should already have nvm.sh there. The second line loads the nvm function into your bash shell so that it's available as a command. The third line sets your default node version.
|
||||
The first line loads the nvm function into your bash shell so that it's available as a command. The second line sets your default node version to the latest released version.
|
||||
|
||||
## Usage
|
||||
|
||||
To download, install, and use the v0.1.91 release of node do this:
|
||||
To download, install, and use the v0.1.94 release of node do this:
|
||||
|
||||
nvm install v0.1.91
|
||||
nvm install v0.1.94
|
||||
|
||||
And then in any new shell just use the installed version:
|
||||
|
||||
nvm use v0.1.91
|
||||
nvm use v0.1.94
|
||||
|
||||
If you want to track HEAD then use the clone command:
|
||||
|
||||
|
|
43
nvm.sh
43
nvm.sh
|
@ -20,46 +20,18 @@ nvm()
|
|||
echo "Usage:"
|
||||
echo " nvm help (Show this message)"
|
||||
echo " nvm install version (Download and install a released version)"
|
||||
echo " nvm clone (Clone and install HEAD version)"
|
||||
echo " nvm update (Pull and rebuild HEAD version)"
|
||||
echo " nvm list (Show all installed versions)"
|
||||
echo " nvm use version (Set this version in the PATH)"
|
||||
echo " nvm use (Use the latest stable version)"
|
||||
echo " nvm deactivate (Remove nvm entry from PATH)"
|
||||
echo " nvm addlib (Copies the module in cwd to the current env)"
|
||||
echo " nvm linklib (Links the module in cwd to the current env)"
|
||||
echo " nvm listlibs (Show the modules in the current env)"
|
||||
echo
|
||||
echo "Example:"
|
||||
echo " nvm install v0.1.91"
|
||||
echo " nvm install v0.1.94"
|
||||
echo
|
||||
;;
|
||||
"clone" )
|
||||
if [ $# -ne 1 ]; then
|
||||
nvm help
|
||||
return;
|
||||
fi
|
||||
mkdir -p "$NVM_DIR/src" && \
|
||||
cd "$NVM_DIR/src" && \
|
||||
git clone git://github.com/ry/node.git && \
|
||||
cd node && \
|
||||
./configure --debug --prefix="$NVM_DIR/HEAD" && \
|
||||
make && \
|
||||
make install && \
|
||||
nvm use HEAD
|
||||
cd $START
|
||||
;;
|
||||
"update" )
|
||||
if [ $# -ne 1 ]; then
|
||||
nvm help
|
||||
return;
|
||||
fi
|
||||
cd "$NVM_DIR/src/node" && \
|
||||
git pull origin master && \
|
||||
./configure --debug --prefix="$NVM_DIR/HEAD" && \
|
||||
make clean all && \
|
||||
make install && \
|
||||
nvm use HEAD
|
||||
cd $START
|
||||
;;
|
||||
"install" )
|
||||
if [ $# -ne 2 ]; then
|
||||
nvm help
|
||||
|
@ -107,7 +79,9 @@ nvm()
|
|||
;;
|
||||
"use" )
|
||||
if [ $# -ne 2 ]; then
|
||||
nvm help
|
||||
for f in $NVM_DIR/v*; do
|
||||
nvm use ${f##*/} > /dev/null
|
||||
done
|
||||
return;
|
||||
fi
|
||||
if [ ! -d $NVM_DIR/$2 ]; then
|
||||
|
@ -120,12 +94,15 @@ nvm()
|
|||
PATH="$NVM_DIR/$2/bin:$PATH"
|
||||
fi
|
||||
export PATH
|
||||
export NODE_PATH="$NVM_DIR/$2/lib"
|
||||
export NODE_PATH="$NVM_DIR/$2/lib/node"
|
||||
export NODE_BIN="$NVM_DIR/$2/bin"
|
||||
mkdir -p "$NODE_PATH"
|
||||
mkdir -p "$NODE_BIN"
|
||||
echo "Now using node $2"
|
||||
;;
|
||||
"listlibs" )
|
||||
ls $NODE_PATH | grep -v wafadmin
|
||||
;;
|
||||
"list" )
|
||||
if [ $# -ne 1 ]; then
|
||||
nvm help
|
||||
|
|
Loading…
Reference in New Issue