File tree Expand file tree Collapse file tree 4 files changed +62
-1
lines changed Expand file tree Collapse file tree 4 files changed +62
-1
lines changed Original file line number Diff line number Diff line change @@ -855,8 +855,25 @@ nvm_alias() {
855
855
return 1
856
856
fi
857
857
858
+ local NVM_ALIAS_DIR
859
+ NVM_ALIAS_DIR=" $( nvm_alias_path) "
860
+
861
+ if [ " $( expr " ${ALIAS} " : ' ^lts/-[1-9][0-9]*$' ) " -gt 0 ]; then
862
+ local N
863
+ N=" $( echo " ${ALIAS} " | cut -d ' -' -f 2) "
864
+ local RESULT
865
+ RESULT=" $( command ls " ${NVM_ALIAS_DIR} /lts" | command tail -n " ${N} " | command head -n 1) "
866
+ if [ " ${RESULT} " != ' *' ]; then
867
+ nvm_alias " lts/${RESULT} "
868
+ return $?
869
+ else
870
+ nvm_err ' That many LTS releases do not exist yet.'
871
+ return 2
872
+ fi
873
+ fi
874
+
858
875
local NVM_ALIAS_PATH
859
- NVM_ALIAS_PATH=" $( nvm_alias_path ) /${ALIAS} "
876
+ NVM_ALIAS_PATH=" ${NVM_ALIAS_DIR} /${ALIAS} "
860
877
if [ ! -f " ${NVM_ALIAS_PATH} " ]; then
861
878
nvm_err ' Alias does not exist.'
862
879
return 2
Original file line number Diff line number Diff line change
1
+ erbium
2
+ dubnium
3
+ carbon
4
+ boron
5
+ argon
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ die () { echo " $@ " ; cleanup ; exit 1; }
4
+
5
+
6
+ cleanup () {
7
+ unset -f nvm_download
8
+ }
9
+
10
+ \. ../../../nvm.sh
11
+
12
+ set -ex
13
+
14
+ MOCKS_DIR=" ${PWD} /mocks"
15
+
16
+ # sample output at the time the test was written
17
+ TAB_PATH=" ${MOCKS_DIR} /nodejs.org-dist-index.tab"
18
+ nvm_download () {
19
+ cat " ${TAB_PATH} "
20
+ }
21
+
22
+ nvm_ls_remote > /dev/null || die " nvm_ls_remote_failed?!"
23
+
24
+ LTS_NAMES_PATH=" ${MOCKS_DIR} /LTS_names.txt"
25
+
26
+ N=0
27
+ while IFS= read -r LTS; do
28
+ N=$(( $N + 1 ))
29
+ EXPECTED=" $( nvm_alias " lts/${LTS} " ) "
30
+ ACTUAL=" $( nvm_alias " lts/-${N} " ) "
31
+ [ " ${EXPECTED} " = " ${ACTUAL} " ] || die " \` nvm_alias lts/-${N} \` was \` ${ACTUAL} \` ; expected \` ${EXPECTED} \` "
32
+ done < " ${LTS_NAMES_PATH} "
33
+
34
+ cleanup
Original file line number Diff line number Diff line change @@ -44,9 +44,14 @@ set -e
44
44
45
45
ALIAS_PATH=" $MOCKS_DIR /nvm_make_alias LTS alias calls.txt"
46
46
: > " $ALIAS_PATH "
47
+ LTS_NAMES_PATH=" $MOCKS_DIR /LTS_names.txt"
48
+ : > " $LTS_NAMES_PATH "
47
49
nvm_make_alias () {
48
50
# prevent local alias creation, and store arguments
49
51
echo " ${1} |${2} " >> " $ALIAS_PATH "
52
+ if [ " ${1} " != ' lts/*' ]; then
53
+ echo " ${1# lts/ } " >> " $LTS_NAMES_PATH "
54
+ fi
50
55
}
51
56
nvm ls-remote --lts > /dev/null
52
57
You can’t perform that action at this time.
0 commit comments