Add `nvm_get_mirror`
parent
9c65197b22
commit
d3d768adcd
13
nvm.sh
13
nvm.sh
|
@ -1365,6 +1365,17 @@ nvm_is_merged_node_version() {
|
|||
nvm_version_greater_than_or_equal_to "$1" v4.0.0
|
||||
}
|
||||
|
||||
nvm_get_mirror() {
|
||||
case "${1}-${2}" in
|
||||
node-std) nvm_echo "${NVM_NODEJS_ORG_MIRROR}" ;;
|
||||
iojs-std) nvm_echo "${NVM_IOJS_ORG_MIRROR}" ;;
|
||||
*)
|
||||
nvm_err 'unknown type of node.js or io.js release'
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
nvm_install_merged_node_binary() {
|
||||
local NVM_NODE_TYPE
|
||||
NVM_NODE_TYPE="${1}"
|
||||
|
@ -2875,7 +2886,7 @@ $NVM_LS_REMOTE_POST_MERGED_OUTPUT" | nvm_grep -v "N/A" | command sed '/^$/d')"
|
|||
nvm_ls_remote nvm_ls_remote_iojs nvm_ls_remote_index_tab \
|
||||
nvm_ls nvm_remote_version nvm_remote_versions \
|
||||
nvm_install_iojs_binary nvm_install_node_binary \
|
||||
nvm_install_merged_node_binary \
|
||||
nvm_install_merged_node_binary nvm_get_mirror \
|
||||
nvm_install_node_source nvm_check_file_permissions \
|
||||
nvm_get_checksum_alg \
|
||||
nvm_version nvm_rc_version nvm_match_version \
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -ex
|
||||
|
||||
die () { echo $@ ; exit 1; }
|
||||
|
||||
. ../../../nvm.sh
|
||||
|
||||
! nvm_get_mirror || die 'unknown release type did not error'
|
||||
! nvm_get_mirror node || die 'unknown release type did not error'
|
||||
! nvm_get_mirror iojs || die 'unknown release type did not error'
|
||||
! nvm_get_mirror node foo || die 'unknown release type did not error'
|
||||
! nvm_get_mirror iojs foo || die 'unknown release type did not error'
|
||||
|
||||
[ "$(nvm_get_mirror node std)" = "${NVM_NODEJS_ORG_MIRROR}" ] || die 'node std did not yield NVM_NODEJS_ORG_MIRROR'
|
||||
[ "$(nvm_get_mirror iojs std)" = "${NVM_IOJS_ORG_MIRROR}" ] || die 'node std did not yield NVM_NODEJS_ORG_MIRROR'
|
Loading…
Reference in New Issue