parent
7b6e06e556
commit
ca89cceb99
|
@ -95,7 +95,7 @@ To use a mirror of the node binaries, set `$NVM_NODEJS_ORG_MIRROR`:
|
||||||
|
|
||||||
NVM_NODEJS_ORG_MIRROR=http://nodejs.org/dist 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
|
## License
|
||||||
|
|
||||||
|
|
2
nvm.sh
2
nvm.sh
|
@ -802,7 +802,7 @@ nvm() {
|
||||||
export NODE_PATH
|
export NODE_PATH
|
||||||
export NVM_PATH="$NVM_VERSION_DIR/lib/node"
|
export NVM_PATH="$NVM_VERSION_DIR/lib/node"
|
||||||
export NVM_BIN="$NVM_VERSION_DIR/bin"
|
export NVM_BIN="$NVM_VERSION_DIR/bin"
|
||||||
if [ "$NVM_SYMLINK_CURRENT" = true ] || [ -z "$NVM_SYMLINK_CURRENT" ]; then
|
if [ "$NVM_SYMLINK_CURRENT" = true ]; then
|
||||||
rm -f "$NVM_DIR/current" && ln -s "$NVM_VERSION_DIR" "$NVM_DIR/current"
|
rm -f "$NVM_DIR/current" && ln -s "$NVM_VERSION_DIR" "$NVM_DIR/current"
|
||||||
fi
|
fi
|
||||||
echo "Now using node $VERSION"
|
echo "Now using node $VERSION"
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
export NVM_SYMLINK_CURRENT=true
|
||||||
. ../../nvm.sh
|
. ../../nvm.sh
|
||||||
|
|
||||||
rm -rf ../../v0.10.29
|
rm -rf ../../v0.10.29
|
||||||
|
|
|
@ -45,39 +45,40 @@ function isCurrentSymlinkPresent() {
|
||||||
NVM_SYMLINK_CURRENT=false
|
NVM_SYMLINK_CURRENT=false
|
||||||
cleanup
|
cleanup
|
||||||
runNvmUse
|
runNvmUse
|
||||||
isCurrentSymlinkPresent && echo "Expected 'current' symlink not to be created when NVM_SYMLINK_CURRENT=false!"
|
isCurrentSymlinkPresent && echo >&2 "Expected 'current' symlink not to be created when NVM_SYMLINK_CURRENT=false!"
|
||||||
registerExpectedNoSymlink $?
|
registerExpectedNoSymlink $?
|
||||||
|
|
||||||
NVM_SYMLINK_CURRENT=true
|
NVM_SYMLINK_CURRENT=true
|
||||||
cleanup
|
cleanup
|
||||||
runNvmUse
|
runNvmUse
|
||||||
isCurrentSymlinkPresent || echo "Expected 'current' symlink to be created when NVM_SYMLINK_CURRENT=true!"
|
isCurrentSymlinkPresent || echo >&2 "Expected 'current' symlink to be created when NVM_SYMLINK_CURRENT=true!"
|
||||||
registerExpectedSymlink $?
|
registerExpectedSymlink $?
|
||||||
|
|
||||||
NVM_SYMLINK_CURRENT=garbagevalue
|
NVM_SYMLINK_CURRENT=garbagevalue
|
||||||
cleanup
|
cleanup
|
||||||
runNvmUse
|
runNvmUse
|
||||||
isCurrentSymlinkPresent && echo "Expected 'current' symlink not to be created when NVM_SYMLINK_CURRENT contains a string!"
|
isCurrentSymlinkPresent && echo >&2 "Expected 'current' symlink not to be created when NVM_SYMLINK_CURRENT contains a string!"
|
||||||
registerExpectedNoSymlink $?
|
registerExpectedNoSymlink $?
|
||||||
|
|
||||||
NVM_SYMLINK_CURRENT=0
|
NVM_SYMLINK_CURRENT=0
|
||||||
cleanup
|
cleanup
|
||||||
runNvmUse
|
runNvmUse
|
||||||
isCurrentSymlinkPresent && echo "Expected 'current' symlink not to be created when NVM_SYMLINK_CURRENT=0!"
|
isCurrentSymlinkPresent && echo >&2 "Expected 'current' symlink not to be created when NVM_SYMLINK_CURRENT=0!"
|
||||||
registerExpectedNoSymlink $?
|
registerExpectedNoSymlink $?
|
||||||
|
|
||||||
NVM_SYMLINK_CURRENT=1
|
NVM_SYMLINK_CURRENT=1
|
||||||
cleanup
|
cleanup
|
||||||
runNvmUse
|
runNvmUse
|
||||||
isCurrentSymlinkPresent && echo "Expected 'current' symlink not to be created when NVM_SYMLINK_CURRENT=1!"
|
isCurrentSymlinkPresent && echo >&2 "Expected 'current' symlink not to be created when NVM_SYMLINK_CURRENT=1!"
|
||||||
registerExpectedNoSymlink $?
|
registerExpectedNoSymlink $?
|
||||||
|
|
||||||
unset NVM_SYMLINK_CURRENT
|
unset NVM_SYMLINK_CURRENT
|
||||||
cleanup
|
cleanup
|
||||||
runNvmUse
|
runNvmUse
|
||||||
isCurrentSymlinkPresent || echo "Expected 'current' symlink to be created when NVM_SYMLINK_CURRENT has been unset (default behaviour)!"
|
isCurrentSymlinkPresent && echo >&2 "Expected 'current' symlink not to be created when NVM_SYMLINK_CURRENT has been unset (default behaviour)!"
|
||||||
registerExpectedSymlink $?
|
registerExpectedNoSymlink $?
|
||||||
|
|
||||||
cleanup
|
cleanup
|
||||||
|
|
||||||
[ ${TEST_FAILED} -ne 0 ] && echo "${TEST_COUNT} tested, ${TEST_PASSED} passed, ${TEST_FAILED} failed" && exit 1 || true
|
[ ${TEST_FAILED} -ne 0 ] && echo "${TEST_COUNT} tested, ${TEST_PASSED} passed, ${TEST_FAILED} failed" && exit 1 || true
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue