Added command nvm install stable

nvm auto-detects last stable relase and fetch it.
This commit is contained in:
Michał Koźmiński 2013-08-28 11:35:14 +02:00
parent e6d1d0c4de
commit b8ca75d15c
1 changed files with 18 additions and 3 deletions

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"
return
fi
echo "$VERSION"
return
}
nvm_checksum() {
if [ "$1" = "$2" ]; then
return