Compare commits

..

10 Commits

Author SHA1 Message Date
Jordan Harband
47bbf93f50 Travis CI defaults to ruby; c will be faster 2014-04-19 22:59:30 -07:00
Jordan Harband
7976a1343f Merge pull request #398 from creationix/install_use_nvmrc
`nvm install` and `nvm run` use .nvmrc when version not provided
2014-04-19 22:36:33 -07:00
Jordan Harband
bf8abf1052 Make sure nvm install works without a version argument when .nvmrc specifies a version. 2014-04-19 17:07:00 -07:00
Jordan Harband
eb6031cb58 Clean up after existing nvm install tests. 2014-04-19 17:00:06 -07:00
Jordan Harband
55a6f1f06e Organizing nvm install tests better. 2014-04-19 16:48:43 -07:00
Jordan Harband
c188c1b11a Correcting help text for nvm use 2014-04-19 16:46:22 -07:00
Jordan Harband
b15ea07067 Don't clobber the latest version of 0.10 for tests. 2014-04-19 16:46:17 -07:00
Jordan Harband
752c0e4ef1 Removing trailing whitespace. 2014-04-19 14:34:47 -07:00
Jordan Harband
49364532b3 Merge pull request #391 from koenpunt/patch-1
Link to latest version of install script (0.4.0)
2014-03-27 10:19:44 -07:00
Koen Punt
9157cb4cfe Link to latest version of install script (0.4.0) 2014-03-27 10:19:00 +01:00
13 changed files with 153 additions and 69 deletions

View File

@@ -1,7 +1,8 @@
language: bash
language: c # defaults to ruby
install:
- sudo apt-get install ksh zsh -y
before_script:
- curl -o /tmp/urchin https://raw.github.com/scraperwiki/urchin/master/urchin && chmod +x /tmp/urchin
script:
- NVM_DIR=$TRAVIS_BUILD_DIR make URCHIN=/tmp/urchin test

View File

@@ -6,13 +6,13 @@ First you'll need to make sure your system has a c++ compiler. For OSX, XCode w
### Install script
To install you could use the [install script](https://github.com/creationix/nvm/blob/v0.3.0/install.sh) using cURL:
To install you could use the [install script](https://github.com/creationix/nvm/blob/v0.4.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.4.0/install.sh | sh
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.4.0/install.sh | sh
<sub>The script clones the nvm repository to `~/.nvm` and adds the source line to your profile (`~/.bash_profile`, `~/.zshrc` or `~/.profile`).</sub>

41
nvm.sh
View File

@@ -77,7 +77,7 @@ nvm_normalize_version() {
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"
@@ -205,9 +205,9 @@ nvm() {
echo "Usage:"
echo " nvm help Show this message"
echo " nvm --version Print out the latest released version of nvm"
echo " nvm install [-s] <version> Download and install a <version>, [-s] from source"
echo " nvm install [-s] <version> Download and install a <version>, [-s] from source. Uses .nvmrc if available"
echo " nvm uninstall <version> Uninstall a version"
echo " nvm use <version> Modify PATH to use <version>"
echo " nvm use <version> Modify PATH to use <version>. Uses .nvmrc if available"
echo " nvm run <version> [<args>] Run <version> with <args> as arguments"
echo " nvm current Display currently activated version"
echo " nvm ls List installed versions"
@@ -238,6 +238,8 @@ nvm() {
local sum
local tarball
local nobinary
local version_not_provided=0
local provided_version
if ! nvm_has "curl"; then
echo 'NVM Needs curl to proceed.' >&2;
@@ -245,8 +247,12 @@ nvm() {
fi
if [ $# -lt 2 ]; then
nvm help
return
version_not_provided=1
nvm_rc_version
if [ -z "$NVM_RC_VERSION" ]; then
nvm help
return
fi
fi
shift
@@ -261,9 +267,16 @@ nvm() {
nobinary=1
fi
[ -d "$NVM_DIR/$1" ] && echo "$1 is already installed." && return
provided_version=$1
if [ -z "$provided_version" ]; then
if [ $version_not_provided -ne 1 ]; then
nvm_rc_version
fi
provided_version="$NVM_RC_VERSION"
fi
[ -d "$NVM_DIR/$provided_version" ] && echo "$provided_version is already installed." && return
VERSION=`nvm_remote_version $1`
VERSION=`nvm_remote_version $provided_version`
ADDITIONAL_PARAMETERS=''
shift
@@ -460,10 +473,18 @@ nvm() {
"run" )
# run given version of node
if [ $# -lt 2 ]; then
nvm help
return
nvm_rc_version
if [ -z "$NVM_RC_VERSION" ]; then
nvm help
return
fi
fi
VERSION=`nvm_version $2`
NVM_PROVIDED_VERSION=`nvm_version $2`
if [ -z "$NVM_PROVIDED_VERSION" ]; then
nvm_rc_version
NVM_PROVIDED_VERSION="$NVM_RC_VERSION"
fi
VERSION="$NVM_PROVIDED_VERSION"
if [ ! -d "$NVM_DIR/$VERSION" ]; then
echo "$VERSION version is not installed yet"
return;

View File

@@ -1,16 +0,0 @@
#!/bin/sh
set -e
. ../../nvm.sh
VERSION=v0.10.26
# Remove the stuff we're clobbering.
[ -e ../../$VERSION ] && rm -R ../../$VERSION
# Install from binary
nvm install $VERSION
# Check
[ -d ../../$VERSION ]
nvm run $VERSION --version | grep $VERSION

View File

@@ -1,16 +0,0 @@
#!/bin/sh
set -e
. ../../nvm.sh
VERSION=v0.10.26
# Remove the stuff we're clobbering.
[ -e ../../$VERSION ] && rm -R ../../$VERSION
# Install from source
nvm install -s $VERSION
# Check
[ -d ../../$VERSION ]
nvm run $VERSION --version | grep $VERSION

View File

@@ -1,23 +0,0 @@
#!/bin/sh
set -e
. ../../nvm.sh
# Remove the stuff we're clobbering.
[ -e ../../v0.10.25 ] && rm -R ../../v0.10.25
[ -e ../../v0.10.26 ] && rm -R ../../v0.10.26
# Install from binary
nvm install 0.10.25
nvm install 0.10.26
# Check
[ -d ../../v0.10.25 ]
[ -d ../../v0.10.26 ]
# Use the first one
nvm use 0.10.25
# Use the latest one
nvm use 0.10
node --version | grep v0.10.26

View File

@@ -0,0 +1,17 @@
#!/bin/sh
set -e
. ../../../nvm.sh
NVM_TEST_VERSION=v0.10.7
# Remove the stuff we're clobbering.
[ -e ../../../$NVM_TEST_VERSION ] && rm -R ../../../$NVM_TEST_VERSION
# Install from binary
nvm install $NVM_TEST_VERSION
# Check
[ -d ../../../$NVM_TEST_VERSION ]
nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION

View File

@@ -0,0 +1,17 @@
#!/bin/sh
set -e
. ../../../nvm.sh
NVM_TEST_VERSION=v0.10.7
# Remove the stuff we're clobbering.
[ -e ../../../$NVM_TEST_VERSION ] && rm -R ../../../$NVM_TEST_VERSION
# Install from source
nvm install -s $NVM_TEST_VERSION
# Check
[ -d ../../../$NVM_TEST_VERSION ]
nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION

View File

@@ -0,0 +1,24 @@
#!/bin/sh
set -e
. ../../../nvm.sh
# Remove the stuff we're clobbering.
[ -e ../../../v0.10.7 ] && rm -R ../../../v0.10.7
[ -e ../../../v0.10.8 ] && rm -R ../../../v0.10.8
# Install from binary
nvm install 0.10.7
nvm install 0.10.8
# Check
[ -d ../../../v0.10.7 ]
[ -d ../../../v0.10.8 ]
# Use the first one
nvm use 0.10.7
# Use the latest one
nvm use 0.10
node --version | grep v0.10.8

View File

@@ -0,0 +1,20 @@
#!/bin/sh
set -e
. ../../../nvm.sh
NVM_TEST_VERSION=v0.10.7
# Remove the stuff we're clobbering.
[ -e ../../../$NVM_TEST_VERSION ] && rm -R ../../../$NVM_TEST_VERSION
# Install from binary
cat "$NVM_TEST_VERSION" > .nvmrc
nvm install
# Check
[ -d ../../../$NVM_TEST_VERSION ]
nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION

View File

@@ -0,0 +1,20 @@
#!/bin/sh
set -e
. ../../../nvm.sh
NVM_TEST_VERSION=v0.10.7
# Remove the stuff we're clobbering.
[ -e ../../../$NVM_TEST_VERSION ] && rm -R ../../../$NVM_TEST_VERSION
# Install from binary
cat "$NVM_TEST_VERSION" > .nvmrc
nvm install -s
# Check
[ -d ../../../$NVM_TEST_VERSION ]
nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION

View File

@@ -0,0 +1,6 @@
#!/bin/sh
if [ -f ".nvmrc" ]; then
mv .nvmrc .nvmrc.bak
fi

View File

@@ -0,0 +1,13 @@
#!/bin/sh
. ../../../nvm.sh
nvm uninstall v0.10.7
if [ -f ".nvmrc" ]; then
rm .nvmrc
fi
if [ -f ".nvmrc.bak" ]; then
mv .nvmrc.bak .nvmrc
fi