Skip to content
Myr

Properly outputting the version when nvm_version_path outputs the new "versions" subdirectory.

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 9e17b50 · Browse files · 4 files+20 added−13 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+20 added−13 removed

  • tests:+19 added−12 removed
  • other:+1 added−1 removed

4 files+20 added−13 removed

modified:test/fast/Listing paths/Running "nvm which 0.0.2" should display only version 0.0.2.+17 added-11 removed
1#!/bin/sh23mkdir ../../../v0.0.24mkdir ../../../v0.0.203mkdir -p ../../../v0.0.24mkdir -p ../../../v0.0.205mkdir -p ../../../versions/v0.12.067. ../../../nvm.sh89die () { echo $@ ; exit 1; }1011# The result should contain only the appropriate version numbers.1212nvm which 0.0.213nvm which 0.0.2 | grep "$NVM_DIR/v0.0.2/bin/node" > /dev/null14if [ $? -ne 0 ]; then15 die '"nvm which 0.0.2" did not contain the correct path'16fi13nvm which 0.0.2 || die "v0.0.2 not found"14NVM_BIN="$(nvm which 0.0.2)"15[ "_$NVM_BIN" = "_$(nvm_version_path v0.0.2)/bin/node" ] \16 || die "'nvm which 0.0.2' did not contain the correct path: got '$NVM_BIN'"1718nvm which 0.0.20 | grep "$NVM_DIR/v0.0.20/bin/node" > /dev/null19if [ $? -ne 0 ]; then20 die '"nvm which 0.0.2" did not contain the correct path'21fi18nvm which 0.0.20 || die "v0.0.20 not found"19NVM_BIN="$(nvm which 0.0.20)"20[ "_$NVM_BIN" = "_$(nvm_version_path v0.0.20)/bin/node" ] \21 || die "'nvm which 0.20.0' did not contain the correct path: got '$NVM_BIN'"2223nvm which 0.12.0 || die "v0.0.20 not found"24NVM_BIN="$(nvm which 0.12.0)"25[ "_$NVM_BIN" = "_$(nvm_version_path v0.12.0)/bin/node" ] \26 || die "'nvm which 0.12.0' did not contain the correct path: got '$NVM_BIN'"27
modified:test/fast/Listing paths/Running "nvm which foo" should return a nonzero exit code when not found+1 added-1 removed
1 unmodified line
23. ../../../nvm.sh45nvm which nonexistent_version6[ "$?" = "1" ]6[ "_$?" = "_1" ]
modified:test/fast/Listing paths/teardown+1 added
1rmdir ../../../v0.0.2 >/dev/null 2>&12rmdir ../../../v0.0.20 >/dev/null 2>&13rmdir ../../../v0.12.0 >/dev/null 2>&1
modified:nvm.sh+1 added-1 removed
986 unmodified lines
987 if [ ! -d "$NVM_VERSION_DIR" ]; then988 echo "$VERSION version is not installed yet" >&2989 return 1990 fi991 echo $NVM_DIR/$VERSION/bin/node991 echo "$NVM_VERSION_DIR/bin/node"992 ;;993 "alias" )994 mkdir -p "$NVM_DIR/alias"995 if [ $# -le 2 ]; then
106 unmodified lines