Compare commits
30 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6dde4aac38 | ||
|
|
96635cd2bd | ||
|
|
5342b6a04c | ||
|
|
2d0c025c49 | ||
|
|
6ed93f4c01 | ||
|
|
3c2719a85e | ||
|
|
c47f03f996 | ||
|
|
300022642a | ||
|
|
bce3abaa4b | ||
|
|
9f6280265a | ||
|
|
7211c9ee29 | ||
|
|
246caa8581 | ||
|
|
1fac49f887 | ||
|
|
d2422a623a | ||
|
|
fcc00b22b7 | ||
|
|
0787a55999 | ||
|
|
7c45d62b37 | ||
|
|
ec7909dcd3 | ||
|
|
cf5f195d75 | ||
|
|
9f0520cdd0 | ||
|
|
d950c1a0ea | ||
|
|
6123fbcd31 | ||
|
|
def7ec5364 | ||
|
|
52a384a0cc | ||
|
|
ba1e2f1cdf | ||
|
|
625e54880f | ||
|
|
cebda7d35a | ||
|
|
4a9a15c404 | ||
|
|
a34c080d77 | ||
|
|
0b97ee1d2a |
@@ -1,5 +1,7 @@
|
|||||||
language: bash
|
language: bash
|
||||||
|
install:
|
||||||
|
- sudo apt-get install ksh zsh -y
|
||||||
before_script:
|
before_script:
|
||||||
- curl -o /tmp/urchin https://raw.github.com/scraperwiki/urchin/master/urchin && chmod +x /tmp/urchin
|
- curl -o /tmp/urchin https://raw.github.com/scraperwiki/urchin/master/urchin && chmod +x /tmp/urchin
|
||||||
script:
|
script:
|
||||||
- NVM_DIR=$TRAVIS_BUILD_DIR /tmp/urchin test
|
- NVM_DIR=$TRAVIS_BUILD_DIR make URCHIN=/tmp/urchin test
|
||||||
|
|||||||
16
Makefile
Normal file
16
Makefile
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
URCHIN=`which urchin`
|
||||||
|
SHELLS=sh bash dash ksh zsh
|
||||||
|
|
||||||
|
.PHONY: $(SHELLS) test
|
||||||
|
|
||||||
|
fast: $(SHELLS)
|
||||||
|
|
||||||
|
$(SHELLS):
|
||||||
|
@printf '\n\033[0;34m%s\033[0m\n' "Running tests in $@"
|
||||||
|
@$@ $(URCHIN) -f test/fast
|
||||||
|
|
||||||
|
test: fast
|
||||||
|
@$(URCHIN) -f test/slow
|
||||||
|
|
||||||
|
default: test
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
# Node Version Manager
|
# Node Version Manager [](https://travis-ci.org/creationix/nvm)
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
@@ -6,7 +6,7 @@ First you'll need to make sure your system has a c++ compiler. For OSX, XCode w
|
|||||||
|
|
||||||
### Install script
|
### Install script
|
||||||
|
|
||||||
To install you could use the [install script](https://github.com/creationix/nvm/blob/v0.3.0/install.sh) (requires Git) using cURL:
|
To install you could use the [install script](https://github.com/creationix/nvm/blob/v0.3.0/install.sh) using cURL:
|
||||||
|
|
||||||
curl https://raw.github.com/creationix/nvm/v0.3.0/install.sh | sh
|
curl https://raw.github.com/creationix/nvm/v0.3.0/install.sh | sh
|
||||||
|
|
||||||
@@ -14,8 +14,11 @@ or Wget:
|
|||||||
|
|
||||||
wget -qO- https://raw.github.com/creationix/nvm/v0.3.0/install.sh | sh
|
wget -qO- https://raw.github.com/creationix/nvm/v0.3.0/install.sh | sh
|
||||||
|
|
||||||
<sub>The script clones the nvm repository to `~/.nvm` and adds the source line to your profile (`~/.bash_profile` or `~/.profile`).</sub>
|
<sub>The script clones the nvm repository to `~/.nvm` and adds the source line to your profile (`~/.bash_profile`, `~/.zshrc` or `~/.profile`).</sub>
|
||||||
|
|
||||||
|
You can customize the install source, directory and profile using the `NVM_SOURCE`, `NVM_DIR` and `NVM_PROFILE` variables. Eg: `curl ... | NVM_DIR=/usr/local/nvm sh` for a global install.
|
||||||
|
|
||||||
|
<sub>*NB. The installer can use Git, cURL or Wget to download NVM, whatever is available.*</sub>
|
||||||
|
|
||||||
### Manual install
|
### Manual install
|
||||||
|
|
||||||
|
|||||||
@@ -1,69 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
fatalExit (){
|
|
||||||
echo "$@" && exit 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
# an alternative URL that could be used: https://github.com/creationix/nvm/tarball/master
|
|
||||||
if [ "$NVM_SOURCE" = "" ]; then
|
|
||||||
NVM_SOURCE="https://raw.github.com/creationix/nvm/master/nvm.sh"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$NVM_DIR" = "" ]; then
|
|
||||||
NVM_DIR="$HOME/.nvm"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Downloading to $NVM_DIR
|
|
||||||
mkdir -p "$NVM_DIR"
|
|
||||||
pushd "$NVM_DIR" > /dev/null
|
|
||||||
echo -ne "=> Downloading... "
|
|
||||||
|
|
||||||
# Detect if curl or wget is installed to download NVM_SOURCE
|
|
||||||
if type curl > /dev/null 2>&1; then
|
|
||||||
curl --silent "$NVM_SOURCE" -o nvm.sh || fatalExit "Failed";
|
|
||||||
elif type wget > /dev/null 2>&1; then
|
|
||||||
wget --quiet "$NVM_SOURCE" -O nvm.sh || fatalExit "Failed";
|
|
||||||
else
|
|
||||||
fatalExit "Must have curl or wget to install nvm";
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Downloaded"
|
|
||||||
popd > /dev/null
|
|
||||||
|
|
||||||
# Detect profile file, .bash_profile has precedence over .profile
|
|
||||||
if [ ! -z "$1" ]; then
|
|
||||||
PROFILE="$1"
|
|
||||||
else
|
|
||||||
if [ -f "$HOME/.bash_profile" ]; then
|
|
||||||
PROFILE="$HOME/.bash_profile"
|
|
||||||
elif [ -f "$HOME/.profile" ]; then
|
|
||||||
PROFILE="$HOME/.profile"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
SOURCE_STR="[[ -s "$NVM_DIR/nvm.sh" ]] && . "$NVM_DIR/nvm.sh" # This loads NVM"
|
|
||||||
|
|
||||||
if [ -z "$PROFILE" ] || [ ! -f "$PROFILE" ] ; then
|
|
||||||
if [ -z $PROFILE ]; then
|
|
||||||
echo "=> Profile not found"
|
|
||||||
else
|
|
||||||
echo "=> Profile $PROFILE not found"
|
|
||||||
fi
|
|
||||||
echo "=> Append the following line to the correct file yourself"
|
|
||||||
echo
|
|
||||||
echo "\t$SOURCE_STR"
|
|
||||||
echo
|
|
||||||
echo "=> Close and reopen your terminal to start using NVM"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! grep -qc 'nvm.sh' $PROFILE; then
|
|
||||||
echo "=> Appending source string to $PROFILE"
|
|
||||||
echo "" >> "$PROFILE"
|
|
||||||
echo $SOURCE_STR >> "$PROFILE"
|
|
||||||
else
|
|
||||||
echo "=> Source string already in $PROFILE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "=> Close and reopen your terminal to start using NVM"
|
|
||||||
|
|
||||||
122
install.sh
122
install.sh
@@ -1,28 +1,97 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
NVM_DIR="$HOME/.nvm"
|
set -e
|
||||||
|
|
||||||
if ! hash git 2>/dev/null; then
|
has() {
|
||||||
echo >&2 "You need to install git - visit http://git-scm.com/downloads"
|
type "$1" > /dev/null 2>&1
|
||||||
echo >&2 "or, use install-gitless.sh instead."
|
return $?
|
||||||
exit 1
|
}
|
||||||
|
|
||||||
|
if [ -z "$NVM_DIR" ]; then
|
||||||
|
NVM_DIR="$HOME/.nvm"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d "$NVM_DIR" ]; then
|
if ! has "curl"; then
|
||||||
echo "=> NVM is already installed in $NVM_DIR, trying to update"
|
if has "wget"; then
|
||||||
echo -ne "\r=> "
|
# Emulate curl with wget
|
||||||
cd $NVM_DIR && git pull
|
curl() {
|
||||||
|
ARGS="$* "
|
||||||
|
ARGS=${ARGS/-s /-q }
|
||||||
|
ARGS=${ARGS/-o /-O }
|
||||||
|
wget $ARGS
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
install_from_git() {
|
||||||
|
if [ -z "$NVM_SOURCE" ]; then
|
||||||
|
NVM_SOURCE="https://github.com/creationix/nvm.git"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -d "$NVM_DIR/.git" ]; then
|
||||||
|
echo "=> nvm is already installed in $NVM_DIR, trying to update"
|
||||||
|
echo -e "\r=> \c"
|
||||||
|
cd "$NVM_DIR" && git pull 2> /dev/null || {
|
||||||
|
echo >&2 "Failed to update nvm, run 'git pull' in $NVM_DIR yourself.."
|
||||||
|
}
|
||||||
else
|
else
|
||||||
# Cloning to $NVM_DIR
|
# Cloning to $NVM_DIR
|
||||||
git clone https://github.com/creationix/nvm.git $NVM_DIR
|
echo "=> Downloading nvm from git to '$NVM_DIR'"
|
||||||
|
echo -e "\r=> \c"
|
||||||
|
mkdir -p "$NVM_DIR"
|
||||||
|
git clone "$NVM_SOURCE" "$NVM_DIR"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
install_as_script() {
|
||||||
|
if [ -z "$NVM_SOURCE" ]; then
|
||||||
|
NVM_SOURCE="https://raw.github.com/creationix/nvm/master/nvm.sh"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Downloading to $NVM_DIR
|
||||||
|
mkdir -p "$NVM_DIR"
|
||||||
|
if [ -d "$NVM_DIR/nvm.sh" ]; then
|
||||||
|
echo "=> nvm is already installed in $NVM_DIR, trying to update"
|
||||||
|
else
|
||||||
|
echo "=> Downloading nvm as script to '$NVM_DIR'"
|
||||||
|
fi
|
||||||
|
curl -s "$NVM_SOURCE" -o "$NVM_DIR/nvm.sh" || {
|
||||||
|
echo >&2 "Failed to download '$NVM_SOURCE'.."
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -z "$METHOD" ]; then
|
||||||
|
# Autodetect install method
|
||||||
|
if has "git"; then
|
||||||
|
install_from_git
|
||||||
|
elif has "curl"; then
|
||||||
|
install_as_script
|
||||||
|
else
|
||||||
|
echo >&2 "You need git, curl or wget to install nvm"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [ "$METHOD" = "git" ]; then
|
||||||
|
if ! has "git"; then
|
||||||
|
echo >&2 "You need git to install nvm"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
install_from_git
|
||||||
|
fi
|
||||||
|
if [ "$METHOD" = "script" ]; then
|
||||||
|
if ! has "curl"; then
|
||||||
|
echo >&2 "You need curl or wget to install nvm"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
install_as_script
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
|
|
||||||
# Detect profile file, .bash_profile has precedence over .profile
|
# Detect profile file if not specified as environment variable (eg: PROFILE=~/.myprofile).
|
||||||
if [ ! -z "$1" ]; then
|
if [ -z "$PROFILE" ]; then
|
||||||
PROFILE="$1"
|
|
||||||
else
|
|
||||||
if [ -f "$HOME/.bash_profile" ]; then
|
if [ -f "$HOME/.bash_profile" ]; then
|
||||||
PROFILE="$HOME/.bash_profile"
|
PROFILE="$HOME/.bash_profile"
|
||||||
elif [ -f "$HOME/.zshrc" ]; then
|
elif [ -f "$HOME/.zshrc" ]; then
|
||||||
@@ -32,28 +101,22 @@ else
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
SOURCE_STR="[[ -s \$HOME/.nvm/nvm.sh ]] && . \$HOME/.nvm/nvm.sh # This loads NVM"
|
SOURCE_STR="[ -s \"$NVM_DIR/nvm.sh\" ] && . \"$NVM_DIR/nvm.sh\" # This loads nvm"
|
||||||
|
|
||||||
if [ -z "$PROFILE" ] || [ ! -f "$PROFILE" ] ; then
|
if [ -z "$PROFILE" ] || [ ! -f "$PROFILE" ] ; then
|
||||||
if [ -z $PROFILE ]; then
|
if [ -z $PROFILE ]; then
|
||||||
echo "=> Profile not found. Tried $HOME/.bash_profile and $HOME/.profile"
|
echo "=> Profile not found. Tried ~/.bash_profile ~/.zshrc and ~/.profile."
|
||||||
|
echo "=> Create one of them and run this script again"
|
||||||
else
|
else
|
||||||
echo "=> Profile $PROFILE not found"
|
echo "=> Profile $PROFILE not found"
|
||||||
|
echo "=> Create it (touch $PROFILE) and run this script again"
|
||||||
fi
|
fi
|
||||||
echo "=> Run this script again after running the following:"
|
echo " OR"
|
||||||
|
echo "=> Append the following line to the correct file yourself:"
|
||||||
echo
|
echo
|
||||||
echo "\ttouch $HOME/.profile"
|
echo " $SOURCE_STR"
|
||||||
echo
|
echo
|
||||||
echo "-- OR --"
|
else
|
||||||
echo
|
|
||||||
echo "=> Append the following line to the correct file yourself"
|
|
||||||
echo
|
|
||||||
echo "\t$SOURCE_STR"
|
|
||||||
echo
|
|
||||||
echo "=> Close and reopen your terminal afterwards to start using NVM"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! grep -qc 'nvm.sh' $PROFILE; then
|
if ! grep -qc 'nvm.sh' $PROFILE; then
|
||||||
echo "=> Appending source string to $PROFILE"
|
echo "=> Appending source string to $PROFILE"
|
||||||
echo "" >> "$PROFILE"
|
echo "" >> "$PROFILE"
|
||||||
@@ -61,6 +124,7 @@ if ! grep -qc 'nvm.sh' $PROFILE; then
|
|||||||
else
|
else
|
||||||
echo "=> Source string already in $PROFILE"
|
echo "=> Source string already in $PROFILE"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
echo "=> Close and reopen your terminal to start using NVM"
|
echo "=> Close and reopen your terminal to start using nvm"
|
||||||
|
|
||||||
|
|||||||
65
nvm.sh
65
nvm.sh
@@ -5,6 +5,8 @@
|
|||||||
# Implemented by Tim Caswell <tim@creationix.com>
|
# Implemented by Tim Caswell <tim@creationix.com>
|
||||||
# with much bash help from Matthew Ranney
|
# with much bash help from Matthew Ranney
|
||||||
|
|
||||||
|
NVM_SCRIPT_SOURCE="$_"
|
||||||
|
|
||||||
nvm_has() {
|
nvm_has() {
|
||||||
type "$1" > /dev/null 2>&1
|
type "$1" > /dev/null 2>&1
|
||||||
return $?
|
return $?
|
||||||
@@ -17,14 +19,15 @@ if nvm_has "unsetopt"; then
|
|||||||
NVM_CD_FLAGS="-q"
|
NVM_CD_FLAGS="-q"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Auto detect the NVM_DIR
|
# Auto detect the NVM_DIR when not set
|
||||||
if [ ! -d "$NVM_DIR" ]; then
|
if [ -z "$NVM_DIR" ]; then
|
||||||
if [ -n "$BASH_SOURCE" ]; then
|
if [ -n "$BASH_SOURCE" ]; then
|
||||||
export NVM_DIR=$(cd $NVM_CD_FLAGS $(dirname ${BASH_SOURCE[0]:-$0}) > /dev/null && pwd)
|
NVM_SCRIPT_SOURCE="${BASH_SOURCE[0]}"
|
||||||
else
|
|
||||||
export NVM_DIR=$HOME/.nvm
|
|
||||||
fi
|
fi
|
||||||
|
export NVM_DIR=$(cd $NVM_CD_FLAGS $(dirname "${NVM_SCRIPT_SOURCE:-$0}") > /dev/null && pwd)
|
||||||
fi
|
fi
|
||||||
|
unset NVM_SCRIPT_SOURCE 2> /dev/null
|
||||||
|
|
||||||
|
|
||||||
# Setup mirror location if not already set
|
# Setup mirror location if not already set
|
||||||
if [ -z "$NVM_NODEJS_ORG_MIRROR" ]; then
|
if [ -z "$NVM_NODEJS_ORG_MIRROR" ]; then
|
||||||
@@ -34,8 +37,8 @@ fi
|
|||||||
# Obtain nvm version from rc file
|
# Obtain nvm version from rc file
|
||||||
nvm_rc_version() {
|
nvm_rc_version() {
|
||||||
if [ -e .nvmrc ]; then
|
if [ -e .nvmrc ]; then
|
||||||
RC_VERSION=`cat .nvmrc | head -n 1`
|
NVM_RC_VERSION=`cat .nvmrc | head -n 1`
|
||||||
echo "Found .nvmrc files with version <$RC_VERSION>"
|
echo "Found .nvmrc files with version <$NVM_RC_VERSION>"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,6 +70,21 @@ nvm_remote_version() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nvm_normalize_version() {
|
||||||
|
echo "$1" | sed -e 's/^v//' | awk -F. '{ printf("%d%03d%03d\n", $1,$2,$3); }'
|
||||||
|
}
|
||||||
|
|
||||||
|
nvm_format_version() {
|
||||||
|
echo "$1" | sed -e 's/^\([0-9]\)/v\1/g'
|
||||||
|
}
|
||||||
|
|
||||||
|
nvm_binary_available() {
|
||||||
|
# binaries started with node 0.8.6
|
||||||
|
local MINIMAL="0.8.6"
|
||||||
|
local VERSION=$1
|
||||||
|
[ $(nvm_normalize_version $VERSION) -ge $(nvm_normalize_version $MINIMAL) ]
|
||||||
|
}
|
||||||
|
|
||||||
nvm_ls() {
|
nvm_ls() {
|
||||||
local PATTERN=$1
|
local PATTERN=$1
|
||||||
local VERSIONS=''
|
local VERSIONS=''
|
||||||
@@ -83,7 +101,7 @@ nvm_ls() {
|
|||||||
if [ `expr "$PATTERN" : "v[[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*$"` != 0 ]; then
|
if [ `expr "$PATTERN" : "v[[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*$"` != 0 ]; then
|
||||||
VERSIONS="$PATTERN"
|
VERSIONS="$PATTERN"
|
||||||
else
|
else
|
||||||
VERSIONS=`find "$NVM_DIR/" -maxdepth 1 -type d -name "v$PATTERN*" -exec basename '{}' ';' \
|
VERSIONS=`find "$NVM_DIR/" -maxdepth 1 -type d -name "$(nvm_format_version $PATTERN)*" -exec basename '{}' ';' \
|
||||||
| sort -t. -u -k 1.2,1n -k 2,2n -k 3,3n`
|
| sort -t. -u -k 1.2,1n -k 2,2n -k 3,3n`
|
||||||
fi
|
fi
|
||||||
if [ -z "$VERSIONS" ]; then
|
if [ -z "$VERSIONS" ]; then
|
||||||
@@ -99,9 +117,7 @@ nvm_ls_remote() {
|
|||||||
local VERSIONS
|
local VERSIONS
|
||||||
local GREP_OPTIONS=''
|
local GREP_OPTIONS=''
|
||||||
if [ -n "$PATTERN" ]; then
|
if [ -n "$PATTERN" ]; then
|
||||||
if echo "${PATTERN}" | \grep -v '^v' ; then
|
PATTERN=`nvm_format_version "$PATTERN"`
|
||||||
PATTERN=v$PATTERN
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
PATTERN=".*"
|
PATTERN=".*"
|
||||||
fi
|
fi
|
||||||
@@ -142,7 +158,7 @@ nvm_print_versions() {
|
|||||||
local FORMAT
|
local FORMAT
|
||||||
local CURRENT=`nvm_version current`
|
local CURRENT=`nvm_version current`
|
||||||
echo "$1" | while read VERSION; do
|
echo "$1" | while read VERSION; do
|
||||||
if [ "$VERSION" == "$CURRENT" ]; then
|
if [ "$VERSION" = "$CURRENT" ]; then
|
||||||
FORMAT='\033[0;32m-> %9s\033[0m'
|
FORMAT='\033[0;32m-> %9s\033[0m'
|
||||||
elif [ -d "$NVM_DIR/$VERSION" ]; then
|
elif [ -d "$NVM_DIR/$VERSION" ]; then
|
||||||
FORMAT='\033[0;34m%12s\033[0m'
|
FORMAT='\033[0;34m%12s\033[0m'
|
||||||
@@ -225,6 +241,7 @@ nvm() {
|
|||||||
|
|
||||||
if ! nvm_has "curl"; then
|
if ! nvm_has "curl"; then
|
||||||
echo 'NVM Needs curl to proceed.' >&2;
|
echo 'NVM Needs curl to proceed.' >&2;
|
||||||
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $# -lt 2 ]; then
|
if [ $# -lt 2 ]; then
|
||||||
@@ -263,14 +280,7 @@ nvm() {
|
|||||||
if [ $nobinary -ne 1 ]; then
|
if [ $nobinary -ne 1 ]; then
|
||||||
# shortcut - try the binary if possible.
|
# shortcut - try the binary if possible.
|
||||||
if [ -n "$os" ]; then
|
if [ -n "$os" ]; then
|
||||||
binavail=
|
if nvm_binary_available "$VERSION"; then
|
||||||
# binaries started with node 0.8.6
|
|
||||||
case "$VERSION" in
|
|
||||||
v0.8.[012345]) binavail=0 ;;
|
|
||||||
v0.[1234567].*) binavail=0 ;;
|
|
||||||
*) binavail=1 ;;
|
|
||||||
esac
|
|
||||||
if [ $binavail -eq 1 ]; then
|
|
||||||
t="$VERSION-$os-$arch"
|
t="$VERSION-$os-$arch"
|
||||||
url="$NVM_NODEJS_ORG_MIRROR/$VERSION/node-${t}.tar.gz"
|
url="$NVM_NODEJS_ORG_MIRROR/$VERSION/node-${t}.tar.gz"
|
||||||
sum=`curl -s $NVM_NODEJS_ORG_MIRROR/$VERSION/SHASUMS.txt | \grep node-${t}.tar.gz | awk '{print $1}'`
|
sum=`curl -s $NVM_NODEJS_ORG_MIRROR/$VERSION/SHASUMS.txt | \grep node-${t}.tar.gz | awk '{print $1}'`
|
||||||
@@ -347,12 +357,13 @@ nvm() {
|
|||||||
;;
|
;;
|
||||||
"uninstall" )
|
"uninstall" )
|
||||||
[ $# -ne 2 ] && nvm help && return
|
[ $# -ne 2 ] && nvm help && return
|
||||||
if [ "$2" = `nvm_version` ]; then
|
PATTERN=`nvm_format_version $2`
|
||||||
echo "nvm: Cannot uninstall currently-active node version, $2."
|
if [ "$PATTERN" = `nvm_version` ]; then
|
||||||
|
echo "nvm: Cannot uninstall currently-active node version, $PATTERN."
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
VERSION=`nvm_version $2`
|
VERSION=`nvm_version $PATTERN`
|
||||||
if [ ! -d "$NVM_DIR/$VERSION" ]; then
|
if [ ! -d $NVM_DIR/$VERSION ]; then
|
||||||
echo "$VERSION version is not installed..."
|
echo "$VERSION version is not installed..."
|
||||||
return;
|
return;
|
||||||
fi
|
fi
|
||||||
@@ -402,8 +413,8 @@ nvm() {
|
|||||||
fi
|
fi
|
||||||
if [ $# -eq 1 ]; then
|
if [ $# -eq 1 ]; then
|
||||||
nvm_rc_version
|
nvm_rc_version
|
||||||
if [ -n "$RC_VERSION" ]; then
|
if [ -n "$NVM_RC_VERSION" ]; then
|
||||||
VERSION=`nvm_version $RC_VERSION`
|
VERSION=`nvm_version $NVM_RC_VERSION`
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
VERSION=`nvm_version $2`
|
VERSION=`nvm_version $2`
|
||||||
@@ -543,7 +554,7 @@ nvm() {
|
|||||||
nvm_version $2
|
nvm_version $2
|
||||||
;;
|
;;
|
||||||
"--version" )
|
"--version" )
|
||||||
echo "nvm v0.3.0"
|
echo "nvm v0.4.0"
|
||||||
;;
|
;;
|
||||||
* )
|
* )
|
||||||
nvm help
|
nvm help
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "nvm",
|
"name": "nvm",
|
||||||
"version": "0.2.0",
|
"version": "0.4.0",
|
||||||
"description": "Node Version Manager - Simple bash script to manage multiple active node.js versions",
|
"description": "Node Version Manager - Simple bash script to manage multiple active node.js versions",
|
||||||
"directories": {
|
"directories": {
|
||||||
"test": "test"
|
"test": "test"
|
||||||
|
|||||||
@@ -7,4 +7,6 @@ mkdir ../../../v0.2.3
|
|||||||
|
|
||||||
# The result should contain only the appropriate version numbers.
|
# The result should contain only the appropriate version numbers.
|
||||||
nvm ls 0.2 | grep v0.2.3 &&
|
nvm ls 0.2 | grep v0.2.3 &&
|
||||||
nvm ls 0.1 | grep -v v0.2.3
|
nvm ls 0.1 | grep -v v0.2.3 &&
|
||||||
|
nvm ls 0.1 | grep v0.1.3 &&
|
||||||
|
nvm ls v0.2 | grep v0.2.3
|
||||||
|
|||||||
@@ -3,4 +3,4 @@
|
|||||||
die () { echo $@ ; exit 1; }
|
die () { echo $@ ; exit 1; }
|
||||||
|
|
||||||
. ../../nvm.sh
|
. ../../nvm.sh
|
||||||
[ "$(nvm current)" = `node -v` ] || die "Failed to find current version"
|
[ "$(nvm current)" = "$(node -v)" ] || die "Failed to find current version"
|
||||||
|
|||||||
Reference in New Issue
Block a user