Merge pull request #512 from kevinwang/shasum-lowest-priority
Make shasum the lowest priority checksum command.
diff --git a/README.markdown b/README.markdown
index 7ba3e3b..a239d6d 100644
--- a/README.markdown
+++ b/README.markdown
@@ -8,11 +8,11 @@
To install you could use the [install script][2] using cURL:
- curl https://raw.githubusercontent.com/creationix/nvm/v0.13.1/install.sh | bash
+ curl https://raw.githubusercontent.com/creationix/nvm/v0.14.0/install.sh | bash
or Wget:
- wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.13.1/install.sh | bash
+ wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.14.0/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>
@@ -167,7 +167,7 @@
nvm install -s 0.8.6
[1]: https://github.com/creationix/nvm.git
-[2]: https://github.com/creationix/nvm/blob/v0.13.1/install.sh
+[2]: https://github.com/creationix/nvm/blob/v0.14.0/install.sh
[3]: https://travis-ci.org/creationix/nvm
[Urchin]: https://github.com/scraperwiki/urchin
diff --git a/install.sh b/install.sh
index 53459f7..e1dbcde 100755
--- a/install.sh
+++ b/install.sh
@@ -44,12 +44,12 @@
mkdir -p "$NVM_DIR"
git clone "$NVM_SOURCE" "$NVM_DIR"
fi
- cd $NVM_DIR && git checkout v0.13.1 && git branch -D master || true
+ cd $NVM_DIR && git checkout v0.14.0 && git branch -D master || true
}
install_nvm_as_script() {
if [ -z "$NVM_SOURCE" ]; then
- NVM_SOURCE="https://raw.githubusercontent.com/creationix/nvm/v0.13.1/nvm.sh"
+ NVM_SOURCE="https://raw.githubusercontent.com/creationix/nvm/v0.14.0/nvm.sh"
fi
# Downloading to $NVM_DIR
diff --git a/nvm.sh b/nvm.sh
index 71cbd9b..7f734fe 100644
--- a/nvm.sh
+++ b/nvm.sh
@@ -205,7 +205,13 @@
if [ $? -ne 0 ]; then
echo 'none'
elif nvm_tree_contains_path "$NVM_DIR" "$NODE_PATH"; then
- echo `node -v 2>/dev/null`
+ local VERSION
+ VERSION=`node -v 2>/dev/null`
+ if [ "$VERSION" = "v0.6.21-pre" ]; then
+ echo "v0.6.21"
+ else
+ echo "$VERSION"
+ fi
else
echo 'system'
fi
@@ -641,7 +647,9 @@
export NODE_PATH
export NVM_PATH="$NVM_VERSION_DIR/lib/node"
export NVM_BIN="$NVM_VERSION_DIR/bin"
- rm -f "$NVM_DIR/current" && ln -s "$NVM_VERSION_DIR" "$NVM_DIR/current"
+ if [ "$NVM_SYMLINK_CURRENT" = true ] || [ -z "$NVM_SYMLINK_CURRENT" ]; then
+ rm -f "$NVM_DIR/current" && ln -s "$NVM_VERSION_DIR" "$NVM_DIR/current"
+ fi
echo "Now using node $VERSION"
;;
"run" )
@@ -795,7 +803,7 @@
nvm_version $2
;;
"--version" )
- echo "0.13.1"
+ echo "0.14.0"
;;
"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
diff --git a/package.json b/package.json
index 505d62b..5194b65 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "nvm",
- "version": "0.13.1",
+ "version": "0.14.0",
"description": "Node Version Manager - Simple bash script to manage multiple active node.js versions",
"directories": {
"test": "test"
diff --git "a/test/fast/Running \"nvm use x\" should not create the \"current\" symlink if $NVM_SYMLINK_CURRENT is false" "b/test/fast/Running \"nvm use x\" should not create the \"current\" symlink if $NVM_SYMLINK_CURRENT is false"
new file mode 100755
index 0000000..8ae7b29
--- /dev/null
+++ "b/test/fast/Running \"nvm use x\" should not create the \"current\" symlink if $NVM_SYMLINK_CURRENT is false"
@@ -0,0 +1,83 @@
+#!/bin/bash
+
+. ../../nvm.sh
+
+TEST_NODE_VERSION="v0.10.29"
+
+TEST_COUNT=0
+TEST_PASSED=0
+TEST_FAILED=0
+
+function registerExpectedSymlink() {
+ registerResult ${1}
+}
+
+function registerExpectedNoSymlink() {
+ [ ${1} -ne 0 ]
+ registerResult $?
+}
+
+function registerResult() {
+ result=${1}
+
+ TEST_COUNT=$(($TEST_COUNT + 1))
+
+ [ ${result} -eq 0 ] \
+ && TEST_PASSED=$(($TEST_PASSED + 1)) \
+ || TEST_FAILED=$(($TEST_FAILED + 1))
+}
+
+function cleanup() {
+ rm -rf ../../${TEST_NODE_VERSION}
+ rm -f ../../current
+}
+
+function runNvmUse() {
+ mkdir ../../${TEST_NODE_VERSION}
+ nvm use ${TEST_NODE_VERSION} &> /dev/null
+ rmdir ../../${TEST_NODE_VERSION}
+}
+
+function isCurrentSymlinkPresent() {
+ [ -L ../../current ]
+}
+
+NVM_SYMLINK_CURRENT=false
+cleanup
+runNvmUse
+isCurrentSymlinkPresent && echo "Expected 'current' symlink not to be created when NVM_SYMLINK_CURRENT=false!"
+registerExpectedNoSymlink $?
+
+NVM_SYMLINK_CURRENT=true
+cleanup
+runNvmUse
+isCurrentSymlinkPresent || echo "Expected 'current' symlink to be created when NVM_SYMLINK_CURRENT=true!"
+registerExpectedSymlink $?
+
+NVM_SYMLINK_CURRENT=garbagevalue
+cleanup
+runNvmUse
+isCurrentSymlinkPresent && echo "Expected 'current' symlink not to be created when NVM_SYMLINK_CURRENT contains a string!"
+registerExpectedNoSymlink $?
+
+NVM_SYMLINK_CURRENT=0
+cleanup
+runNvmUse
+isCurrentSymlinkPresent && echo "Expected 'current' symlink not to be created when NVM_SYMLINK_CURRENT=0!"
+registerExpectedNoSymlink $?
+
+NVM_SYMLINK_CURRENT=1
+cleanup
+runNvmUse
+isCurrentSymlinkPresent && echo "Expected 'current' symlink not to be created when NVM_SYMLINK_CURRENT=1!"
+registerExpectedNoSymlink $?
+
+unset NVM_SYMLINK_CURRENT
+cleanup
+runNvmUse
+isCurrentSymlinkPresent || echo "Expected 'current' symlink to be created when NVM_SYMLINK_CURRENT has been unset (default behaviour)!"
+registerExpectedSymlink $?
+
+cleanup
+
+[ ${TEST_FAILED} -ne 0 ] && echo "${TEST_COUNT} tested, ${TEST_PASSED} passed, ${TEST_FAILED} failed" && exit 1 || true
diff --git "a/test/slow/Running \"nvm current\" should display current nvm environment." "b/test/slow/Running \"nvm current\" should display current nvm environment."
index de82ceb..bf43802 100755
--- "a/test/slow/Running \"nvm current\" should display current nvm environment."
+++ "b/test/slow/Running \"nvm current\" should display current nvm environment."
@@ -8,3 +8,7 @@
[ "$(nvm current)" = "$(node -v)" ] || die "Failed to find current version: got \"$(nvm current)\", expected \"$(node -v)\""
+nvm install 0.6.21
+[ "$(node -v)" = "v0.6.21-pre" ] || die "v0.6.21-pre not installed with v0.6.21"
+[ "$(nvm current)" = "v0.6.21" ] || die "v0.6.21-pre not reported as v0.6.21"
+