Compare commits

...

15 Commits

Author SHA1 Message Date
Jordan Harband
64de890d07 v0.16.1 2014-09-14 22:24:18 -07:00
Jordan Harband
a4da8a48ef Merge pull request #524 from creationix/run_installation_tests_separately
Run installation tests separately
2014-09-14 22:21:02 -07:00
Jordan Harband
354be52672 Correct installation test paths 2014-09-14 18:01:55 -07:00
Jordan Harband
ad604cc068 Only run the "installation" tests both with and without curl. 2014-09-14 17:25:17 -07:00
Jordan Harband
ba08fa31d8 Moving actual installation tests to their own suite. 2014-09-14 17:24:30 -07:00
Jordan Harband
13aadbcf31 Run slow tests in ksh too 2014-09-14 16:42:23 -07:00
Jordan Harband
7bb6e9c915 Merge pull request #523 from creationix/run_slow_nvmrc_tests_too
Actually run all tests; fix some bugs
2014-09-14 16:38:12 -07:00
Jordan Harband
3d3145f2e0 install: don't output "additional options" when there are none. 2014-09-14 16:04:51 -07:00
Jordan Harband
4c948cf422 install: Ensure that if a version is not provided, we don't try to shift a nonexistent argument. 2014-09-14 16:04:37 -07:00
Jordan Harband
f8054d5cae copy-packages: ensure that nvm_version is also applied to compare the provided version to the current one. 2014-09-14 16:04:25 -07:00
Jordan Harband
ad2713b13a &> is a bash-specific extension for redirecting both stdout and stderr. 2014-09-14 16:04:13 -07:00
Jordan Harband
243fc04164 Fixing these test files that have never been run 2014-09-14 16:04:04 -07:00
Jordan Harband
a80f958a1e All 4 of these test files should be executable. 2014-09-14 16:03:55 -07:00
Jordan Harband
f6fef75f36 Use git in manual install instructions to determine the latest release tag, rather than hardcoding it.
Per 199ba53340
2014-09-13 11:37:19 -07:00
Jordan Harband
199ba53340 Fixing manual install instructions to use the version tag. Relates to #520 2014-09-13 00:59:09 -07:00
16 changed files with 62 additions and 52 deletions

View File

@@ -10,20 +10,22 @@ script:
- NVM_DIR=$TRAVIS_BUILD_DIR make TEST_SUITE=$TEST_SUITE URCHIN=/tmp/urchin $SHELL
env:
- SHELL=sh TEST_SUITE=fast
- SHELL=sh TEST_SUITE=fast WITHOUT_CURL=1
- SHELL=dash TEST_SUITE=fast
- SHELL=dash TEST_SUITE=fast WITHOUT_CURL=1
- SHELL=bash TEST_SUITE=fast
- SHELL=bash TEST_SUITE=fast WITHOUT_CURL=1
- SHELL=zsh TEST_SUITE=fast
- SHELL=zsh TEST_SUITE=fast WITHOUT_CURL=1
- SHELL=ksh TEST_SUITE=fast
- SHELL=ksh TEST_SUITE=fast WITHOUT_CURL=1
- SHELL=sh TEST_SUITE=slow
- SHELL=sh TEST_SUITE=slow WITHOUT_CURL=1
- SHELL=dash TEST_SUITE=slow
- SHELL=dash TEST_SUITE=slow WITHOUT_CURL=1
- SHELL=bash TEST_SUITE=slow
- SHELL=bash TEST_SUITE=slow WITHOUT_CURL=1
- SHELL=zsh TEST_SUITE=slow
- SHELL=zsh TEST_SUITE=slow WITHOUT_CURL=1
- SHELL=ksh TEST_SUITE=slow
- SHELL=sh TEST_SUITE=installation
- SHELL=sh TEST_SUITE=installation WITHOUT_CURL=1
- SHELL=dash TEST_SUITE=installation
- SHELL=dash TEST_SUITE=installation WITHOUT_CURL=1
- SHELL=bash TEST_SUITE=installation
- SHELL=bash TEST_SUITE=installation WITHOUT_CURL=1
- SHELL=zsh TEST_SUITE=installation
- SHELL=zsh TEST_SUITE=installation WITHOUT_CURL=1
- SHELL=ksh TEST_SUITE=installation
- SHELL=ksh TEST_SUITE=installation WITHOUT_CURL=1

View File

@@ -8,11 +8,11 @@ First you'll need to make sure your system has a c++ compiler. For OSX, XCode w
To install you could use the [install script][2] using cURL:
curl https://raw.githubusercontent.com/creationix/nvm/v0.16.0/install.sh | bash
curl https://raw.githubusercontent.com/creationix/nvm/v0.16.1/install.sh | bash
or Wget:
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.16.0/install.sh | bash
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.16.1/install.sh | bash
<sub>The script clones the nvm repository to `~/.nvm` and adds the source line to your profile (`~/.bash_profile`, `~/.zshrc` or `~/.profile`).</sub>
@@ -24,9 +24,9 @@ You can customize the install source, directory and profile using the `NVM_SOURC
For manual install create a folder somewhere in your filesystem with the `nvm.sh` file inside it. I put mine in a folder called `nvm`.
Or if you have `git` installed, then just clone it:
Or if you have `git` installed, then just clone it, and check out the latest version:
git clone https://github.com/creationix/nvm.git ~/.nvm
git clone https://github.com/creationix/nvm.git ~/.nvm && cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`
To activate nvm, you need to source it from your shell:
@@ -169,7 +169,7 @@ After the v0.8.6 release of node, nvm tries to install from binary packages. But
nvm install -s 0.8.6
[1]: https://github.com/creationix/nvm.git
[2]: https://github.com/creationix/nvm/blob/v0.16.0/install.sh
[2]: https://github.com/creationix/nvm/blob/v0.16.1/install.sh
[3]: https://travis-ci.org/creationix/nvm
[Urchin]: https://github.com/scraperwiki/urchin

View File

@@ -44,12 +44,12 @@ install_nvm_from_git() {
mkdir -p "$NVM_DIR"
git clone "$NVM_SOURCE" "$NVM_DIR"
fi
cd $NVM_DIR && git checkout v0.16.0 && git branch -D master || true
cd $NVM_DIR && git checkout v0.16.1 && git branch -D master || true
}
install_nvm_as_script() {
if [ -z "$NVM_SOURCE" ]; then
NVM_SOURCE="https://raw.githubusercontent.com/creationix/nvm/v0.16.0/nvm.sh"
NVM_SOURCE="https://raw.githubusercontent.com/creationix/nvm/v0.16.1/nvm.sh"
fi
# Downloading to $NVM_DIR

13
nvm.sh
View File

@@ -433,19 +433,20 @@ nvm() {
fi
provided_version=$1
if [ -z "$provided_version" ]; then
if [ $version_not_provided -ne 1 ]; then
nvm_rc_version
fi
provided_version="$NVM_RC_VERSION"
else
shift
fi
[ -d "$(nvm_version_path "$provided_version")" ] && echo "$provided_version is already installed." >&2 && return
VERSION=`nvm_remote_version $provided_version`
ADDITIONAL_PARAMETERS=''
shift
while [ $# -ne 0 ]
do
ADDITIONAL_PARAMETERS="$ADDITIONAL_PARAMETERS $1"
@@ -494,7 +495,9 @@ nvm() {
fi
fi
echo "Additional options while compiling: $ADDITIONAL_PARAMETERS"
if [ -n "$ADDITIONAL_PARAMETERS" ]; then
echo "Additional options while compiling: $ADDITIONAL_PARAMETERS"
fi
tarball=''
sum=''
@@ -796,7 +799,7 @@ nvm() {
local PROVIDED_VERSION
PROVIDED_VERSION="$2"
if [ "$PROVIDED_VERSION" = "$(nvm_ls_current)" ]; then
if [ "$PROVIDED_VERSION" = "$(nvm_ls_current)" ] || [ "$(nvm_version $PROVIDED_VERSION)" = "$(nvm_ls_current)" ]; then
echo 'Can not copy packages from the current version of node.' >&2
return 2
fi
@@ -824,7 +827,7 @@ nvm() {
nvm_version $2
;;
"--version" )
echo "0.16.0"
echo "0.16.1"
;;
"unload" )
unset -f nvm nvm_print_versions nvm_checksum nvm_ls_remote nvm_ls nvm_remote_version nvm_version nvm_rc_version nvm_version_greater > /dev/null 2>&1

View File

@@ -1,6 +1,6 @@
{
"name": "nvm",
"version": "0.16.0",
"version": "0.16.1",
"description": "Node Version Manager - Simple bash script to manage multiple active node.js versions",
"directories": {
"test": "test"
@@ -8,7 +8,8 @@
"scripts": {
"test": "urchin test",
"test/fast": "urchin -f test/fast",
"test/slow": "urchin -f test/slow"
"test/slow": "urchin -f test/slow",
"test/installation": "urchin -f test/installation"
},
"repository": {
"type": "git",

0
test/fast/Listing versions/teardown Normal file → Executable file
View File

View File

@@ -34,7 +34,7 @@ function cleanup() {
function runNvmUse() {
mkdir ../../${TEST_NODE_VERSION}
nvm use ${TEST_NODE_VERSION} &> /dev/null
nvm use ${TEST_NODE_VERSION} > /dev/null 2>&1
rmdir ../../${TEST_NODE_VERSION}
}

View File

@@ -2,13 +2,13 @@
die () { echo $@ ; exit 1; }
. ../../../nvm.sh
. ../../nvm.sh
[ "$(nvm install invalid.invalid 2>&1)" = "Version 'invalid.invalid' not found - try \`nvm ls-remote\` to browse available versions." ] || die "nvm installing an invalid version did not print a nice error message"
# Remove the stuff we're clobbering.
[ -e ../../../v0.9.7 ] && rm -R ../../../v0.9.7
[ -e ../../../v0.9.12 ] && rm -R ../../../v0.9.12
[ -e ../../v0.9.7 ] && rm -R ../../v0.9.7
[ -e ../../v0.9.12 ] && rm -R ../../v0.9.12
# Install from binary
nvm install 0.9.7

View File

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

View File

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

View File

@@ -1,19 +1,19 @@
#!/bin/sh
set -e
. ../../../nvm.sh
. ../../nvm.sh
# Remove the stuff we're clobbering.
[ -e ../../../v0.9.7 ] && rm -R ../../../v0.9.7
[ -e ../../../v0.9.12 ] && rm -R ../../../v0.9.12
[ -e ../../v0.9.7 ] && rm -R ../../v0.9.7
[ -e ../../v0.9.12 ] && rm -R ../../v0.9.12
# Install from binary
nvm install 0.9.7
nvm i 0.9.12
# Check
[ -d ../../../v0.9.7 ]
[ -d ../../../v0.9.12 ]
[ -d ../../v0.9.7 ]
[ -d ../../v0.9.12 ]
# Use the first one
nvm use 0.9.7

View File

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

View File

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

View File

@@ -1,6 +1,6 @@
#!/bin/sh
. ../../../nvm.sh
. ../../nvm.sh
nvm uninstall v0.10.7
if [ -f ".nvmrc" ]; then

View File

@@ -2,11 +2,15 @@
die () { echo $@ ; exit 1; }
. ../../nvm.sh
. ../../../nvm.sh
local EXPECTED_MSG="Can not copy packages from the current version of node."
[ "$(nvm use 0.10.28 && nvm copy-packages 0.10.28 2&>1)" = "$EXPECTED_MSG" ] || die '"nvm use 0.10.28 && nvm copy-packages 0.10.28" did not fail with the right message'
nvm use 0.10.28 > /dev/null
$(nvm use 0.10.28 && nvm copy-packages 0.10.28)
[ $? = 2 ] || die '"nvm use 0.10.28 && nvm copy-packages 0.10.28" did not fail with the right error code'
EXPECTED_MSG="Can not copy packages from the current version of node."
ACTUAL_MSG="$(nvm copy-packages 0.10.28 2>&1 > /dev/null)"
[ "~$ACTUAL_MSG" = "~$EXPECTED_MSG" ] || die "'nvm use 0.10.28 && nvm copy-packages 0.10.28' did not fail with the right message: '$ACTUAL_MESSAGE'"
EXPECTED_ERROR_CODE="2"
ACTUAL_ERROR_CODE="$(nvm copy-packages 0.10.28 > /dev/null 2>&1 ; echo $?)"
[ "~$ACTUAL_ERROR_CODE" = "~$EXPECTED_ERROR_CODE" ] || die "'nvm use 0.10.28 && nvm copy-packages 0.10.28' did not fail with the right error code: expected '$EXPECTED_ERROR_CODE', got '$ACTUAL_ERROR_CODE'"