Default $NVM_SYMLINK_CURRENT to off (create a "current" symlink on `use`).
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Fixes #499.
authored by Jordan Harband · committed by Jordan Harband · parent 7b6e06e · Browse files · 4 files·+11 added−9 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
4 files+11 added−9 removed
- tests:+9 added−7 removed
- other:+2 added−2 removed
Provenance
- Commit
ca89cce- Tree
8fcbe7e- Author
Jordan Harband <ljharb@gmail.com>- Committer
Jordan Harband <ljharb@gmail.com>- Parent
7b6e06e
4 files changed+11 added−9 removed
modified:test/fast/Running "nvm use x" should create and change the "current" symlink+1 added
1 #!/bin/bash2 3+export NVM_SYMLINK_CURRENT=true4 . ../../nvm.sh5 6 rm -rf ../../v0.10.297 mkdir ../../v0.10.2926 unmodified linesmodified:test/fast/Running "nvm use x" should not create the "current" symlink if $NVM_SYMLINK_CURRENT is false+8 added-7 removed
43 unmodified lines44 45 NVM_SYMLINK_CURRENT=false46 cleanup47 runNvmUse48-isCurrentSymlinkPresent && echo "Expected 'current' symlink not to be created when NVM_SYMLINK_CURRENT=false!"48+isCurrentSymlinkPresent && echo >&2 "Expected 'current' symlink not to be created when NVM_SYMLINK_CURRENT=false!"49 registerExpectedNoSymlink $?50 51 NVM_SYMLINK_CURRENT=true52 cleanup53 runNvmUse54-isCurrentSymlinkPresent || echo "Expected 'current' symlink to be created when NVM_SYMLINK_CURRENT=true!"54+isCurrentSymlinkPresent || echo >&2 "Expected 'current' symlink to be created when NVM_SYMLINK_CURRENT=true!"55 registerExpectedSymlink $?56 57 NVM_SYMLINK_CURRENT=garbagevalue58 cleanup59 runNvmUse60-isCurrentSymlinkPresent && echo "Expected 'current' symlink not to be created when NVM_SYMLINK_CURRENT contains a string!"60+isCurrentSymlinkPresent && echo >&2 "Expected 'current' symlink not to be created when NVM_SYMLINK_CURRENT contains a string!"61 registerExpectedNoSymlink $?62 63 NVM_SYMLINK_CURRENT=064 cleanup65 runNvmUse66-isCurrentSymlinkPresent && echo "Expected 'current' symlink not to be created when NVM_SYMLINK_CURRENT=0!"66+isCurrentSymlinkPresent && echo >&2 "Expected 'current' symlink not to be created when NVM_SYMLINK_CURRENT=0!"67 registerExpectedNoSymlink $?68 69 NVM_SYMLINK_CURRENT=170 cleanup71 runNvmUse72-isCurrentSymlinkPresent && echo "Expected 'current' symlink not to be created when NVM_SYMLINK_CURRENT=1!"72+isCurrentSymlinkPresent && echo >&2 "Expected 'current' symlink not to be created when NVM_SYMLINK_CURRENT=1!"73 registerExpectedNoSymlink $?74 75 unset NVM_SYMLINK_CURRENT76 cleanup77 runNvmUse78-isCurrentSymlinkPresent || echo "Expected 'current' symlink to be created when NVM_SYMLINK_CURRENT has been unset (default behaviour)!"79-registerExpectedSymlink $?78+isCurrentSymlinkPresent && echo >&2 "Expected 'current' symlink not to be created when NVM_SYMLINK_CURRENT has been unset (default behaviour)!"79+registerExpectedNoSymlink $?80 81 cleanup82 83 [ ${TEST_FAILED} -ne 0 ] && echo "${TEST_COUNT} tested, ${TEST_PASSED} passed, ${TEST_FAILED} failed" && exit 1 || true84+modified:nvm.sh+1 added-1 removed
800 unmodified lines801 export MANPATH802 export NODE_PATH803 export NVM_PATH="$NVM_VERSION_DIR/lib/node"804 export NVM_BIN="$NVM_VERSION_DIR/bin"805- if [ "$NVM_SYMLINK_CURRENT" = true ] || [ -z "$NVM_SYMLINK_CURRENT" ]; then805+ if [ "$NVM_SYMLINK_CURRENT" = true ]; then806 rm -f "$NVM_DIR/current" && ln -s "$NVM_VERSION_DIR" "$NVM_DIR/current"807 fi808 echo "Now using node $VERSION"809 ;;198 unmodified linesmodified:README.markdown+1 added-1 removed
93 unmodified lines9495969798989910010110289 unmodified lines93 unmodified lines nvm install 0.10
NVM_NODEJS_ORG_MIRROR=http://nodejs.org/dist nvm install 0.10
`nvm use` will, by defaut, create a "current" symlink. Set `$NVM_SYMLINK_CURRENT` to any value other than "true" to disable this behavior.`nvm use` will not, by default, create a "current" symlink. Set `$NVM_SYMLINK_CURRENT` to "true" to enable this behavior, which is sometimes useful for IDEs.
## License
nvm is released under the MIT license.89 unmodified lines