From 29251e3f9bd1acaebc4071008ff26ccfebbb91e9 Mon Sep 17 00:00:00 2001 From: Daniel Bretoi Date: Mon, 23 Jun 2014 22:22:29 -0700 Subject: [PATCH 1/3] add current symlink to NVM_DIR --- nvm.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/nvm.sh b/nvm.sh index b54ce38..c02d6a3 100644 --- a/nvm.sh +++ b/nvm.sh @@ -526,6 +526,7 @@ nvm() { export NODE_PATH export NVM_PATH="$NVM_DIR/$VERSION/lib/node" export NVM_BIN="$NVM_DIR/$VERSION/bin" + rm -rf "$NVM_DIR/current" && ln -sf "$NVM_DIR/$VERSION" "$NVM_DIR/current" echo "Now using node $VERSION" ;; "run" ) From 71f0dbff03477c2bbf2fbacc67b43d0e7cbe1f27 Mon Sep 17 00:00:00 2001 From: Daniel Bretoi Date: Fri, 27 Jun 2014 09:20:30 -0700 Subject: [PATCH 2/3] remove unnecessary -r and -f for ln --- nvm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvm.sh b/nvm.sh index c02d6a3..6dc4172 100644 --- a/nvm.sh +++ b/nvm.sh @@ -526,7 +526,7 @@ nvm() { export NODE_PATH export NVM_PATH="$NVM_DIR/$VERSION/lib/node" export NVM_BIN="$NVM_DIR/$VERSION/bin" - rm -rf "$NVM_DIR/current" && ln -sf "$NVM_DIR/$VERSION" "$NVM_DIR/current" + rm -f "$NVM_DIR/current" && ln -s "$NVM_DIR/$VERSION" "$NVM_DIR/current" echo "Now using node $VERSION" ;; "run" ) From 530f79bd2a3185756746d4a9f0c69d5d68e5e8f2 Mon Sep 17 00:00:00 2001 From: Daniel Bretoi Date: Sat, 5 Jul 2014 16:07:07 -0700 Subject: [PATCH 3/3] add test for linking current path --- "test/fast/Running \"nvm use\" should link current path." | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100755 "test/fast/Running \"nvm use\" should link current path." diff --git "a/test/fast/Running \"nvm use\" should link current path." "b/test/fast/Running \"nvm use\" should link current path." new file mode 100755 index 0000000..e311916 --- /dev/null +++ "b/test/fast/Running \"nvm use\" should link current path." @@ -0,0 +1,7 @@ +#!/bin/bash + +cd ../.. +. ./nvm.sh +mkdir v0.10.10 +nvm use 0.10 +[ "$(ls -ld current | cut -d ' ' -f 13,15 && rm -rf current v0.10.10)" = "current $NVM_DIR/v0.10.10" ]