Skip to content
Myr

Make sure `nvm install` works without a version argument when .nvmrc specifies a version.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Jordan Harband · committed by Jordan Harband · parent eb6031c · Browse files · 3 files+69 added−8 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+69 added−8 removed

  • tests:+40 added−0 removed
  • other:+29 added−8 removed

3 files+69 added−8 removed

added:test/slow/nvm install/install version specified in .nvmrc from binary+20 added
1#!/bin/sh23set -e4. ../../../nvm.sh56NVM_TEST_VERSION=v0.10.778# Remove the stuff we're clobbering.9[ -e ../../../$NVM_TEST_VERSION ] && rm -R ../../../$NVM_TEST_VERSION1011# Install from binary12cat "$NVM_TEST_VERSION" > .nvmrc1314nvm install1516# Check17[ -d ../../../$NVM_TEST_VERSION ]18nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION1920
added:test/slow/nvm install/install version specified in .nvmrc from source+20 added
1#!/bin/sh23set -e4. ../../../nvm.sh56NVM_TEST_VERSION=v0.10.778# Remove the stuff we're clobbering.9[ -e ../../../$NVM_TEST_VERSION ] && rm -R ../../../$NVM_TEST_VERSION1011# Install from binary12cat "$NVM_TEST_VERSION" > .nvmrc1314nvm install -s1516# Check17[ -d ../../../$NVM_TEST_VERSION ]18nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION1920
modified:nvm.sh+29 added-8 removed
203 unmodified lines
204 echo205 echo "Usage:"206 echo " nvm help Show this message"207 echo " nvm --version Print out the latest released version of nvm"208 echo " nvm install [-s] <version> Download and install a <version>, [-s] from source"208 echo " nvm install [-s] <version> Download and install a <version>, [-s] from source. Uses .nvmrc if available"209 echo " nvm uninstall <version> Uninstall a version"210 echo " nvm use <version> Modify PATH to use <version>. Uses .nvmrc if available"211 echo " nvm run <version> [<args>] Run <version> with <args> as arguments"212 echo " nvm current Display currently activated version"
24 unmodified lines
237 local url238 local sum239 local tarball240 local nobinary241 local version_not_provided=0242 local provided_version243244 if ! nvm_has "curl"; then245 echo 'NVM Needs curl to proceed.' >&2;246 return 1247 fi248249 if [ $# -lt 2 ]; then250 version_not_provided=1251 nvm_rc_version252 if [ -z "$NVM_RC_VERSION" ]; then248 nvm help249 return253 nvm help254 return255 fi256 fi257258 shift259
6 unmodified lines
266 if [ "$os" = "freebsd" ]; then267 nobinary=1268 fi269264 [ -d "$NVM_DIR/$1" ] && echo "$1 is already installed." && return270 provided_version=$1271 if [ -z "$provided_version" ]; then272 if [ $version_not_provided -ne 1 ]; then273 nvm_rc_version274 fi275 provided_version="$NVM_RC_VERSION"276 fi277 [ -d "$NVM_DIR/$provided_version" ] && echo "$provided_version is already installed." && return278266 VERSION=`nvm_remote_version $1`279 VERSION=`nvm_remote_version $provided_version`280 ADDITIONAL_PARAMETERS=''281282 shift283
188 unmodified lines
472 ;;473 "run" )474 # run given version of node475 if [ $# -lt 2 ]; then476 nvm_rc_version477 if [ -z "$NVM_RC_VERSION" ]; then463 nvm help464 return478 nvm help479 return480 fi481 fi466 VERSION=`nvm_version $2`482 NVM_PROVIDED_VERSION=`nvm_version $2`483 if [ -z "$NVM_PROVIDED_VERSION" ]; then484 nvm_rc_version485 NVM_PROVIDED_VERSION="$NVM_RC_VERSION"486 fi487 VERSION="$NVM_PROVIDED_VERSION"488 if [ ! -d "$NVM_DIR/$VERSION" ]; then489 echo "$VERSION version is not installed yet"490 return;491 fi
96 unmodified lines