This commit is contained in:
Michał Koźmiński 2013-08-30 13:08:34 -07:00
commit 65eafca98d
2 changed files with 21 additions and 3 deletions

View File

@ -42,6 +42,9 @@ And then in any new shell just use the installed version:
nvm use 0.10
To download latest stable release of node, do this:
nvm install stable
You can create an `.nmvrc` file containing version number in the project root folder; run the following command to switch versions:
nvm use

15
nvm.sh
View File

@ -54,7 +54,11 @@ nvm_version() {
nvm_remote_version() {
local PATTERN=$1
if [[ $PATTERN == "stable" ]]; then
VERSION=`nvm_last_stable_version`
else
VERSION=`nvm_ls_remote $PATTERN | tail -n1`
fi
echo "$VERSION"
if [ "$VERSION" = 'N/A' ]; then
@ -111,6 +115,17 @@ nvm_ls_remote() {
return
}
nvm_last_stable_version(){
local VERSION
VERSION=`curl http://nodejs.org/dist/latest/ | grep -o 'node-v.*\"' -m 1 | grep -o 'v[0-9]*\.[0-9]*\.[0-9]*'`
if [ ! "$VERSION" ]; then
echo "N/A"
else
echo "$VERSION"
fi
return
}
nvm_checksum() {
if [ "$1" = "$2" ]; then
return