mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-08-19 20:13:44 +00:00
Compare commits
4 Commits
d04a122e86
...
d35cb9610d
Author | SHA1 | Date | |
---|---|---|---|
![]() |
d35cb9610d | ||
![]() |
0ce8f5a52f | ||
![]() |
863bd63cfa | ||
![]() |
6375e4ed79 |
19
nvm.sh
19
nvm.sh
@ -128,7 +128,12 @@ nvm_download() {
|
||||
if nvm_curl_use_compression; then
|
||||
CURL_COMPRESSED_FLAG="--compressed"
|
||||
fi
|
||||
eval "curl -q --fail ${CURL_COMPRESSED_FLAG:-} ${CURL_HEADER_FLAG:-} $*"
|
||||
local NVM_DOWNLOAD_ARGS
|
||||
NVM_DOWNLOAD_ARGS=''
|
||||
for arg in "$@"; do
|
||||
NVM_DOWNLOAD_ARGS="${NVM_DOWNLOAD_ARGS} \"$arg\""
|
||||
done
|
||||
eval "curl -q --fail ${CURL_COMPRESSED_FLAG:-} ${CURL_HEADER_FLAG:-} ${NVM_DOWNLOAD_ARGS}"
|
||||
elif nvm_has "wget"; then
|
||||
# Emulate curl with wget
|
||||
ARGS=$(nvm_echo "$@" | command sed -e 's/--progress-bar /--progress=bar /' \
|
||||
@ -434,6 +439,7 @@ else
|
||||
fi
|
||||
unset NVM_SCRIPT_SOURCE 2>/dev/null
|
||||
|
||||
|
||||
nvm_tree_contains_path() {
|
||||
local tree
|
||||
tree="${1-}"
|
||||
@ -449,14 +455,21 @@ nvm_tree_contains_path() {
|
||||
previous_pathdir="${node_path}"
|
||||
local pathdir
|
||||
pathdir=$(dirname "${previous_pathdir}")
|
||||
|
||||
# Convert tree path to canonical form for case-insensitive comparison
|
||||
local tree_canonical
|
||||
tree_canonical=$(cd "${tree}" && pwd -P)
|
||||
|
||||
while [ "${pathdir}" != '' ] && [ "${pathdir}" != '.' ] && [ "${pathdir}" != '/' ] &&
|
||||
[ "${pathdir}" != "${tree}" ] && [ "${pathdir}" != "${previous_pathdir}" ]; do
|
||||
[ "${pathdir}" != "${tree_canonical}" ] && [ "${pathdir}" != "${previous_pathdir}" ]; do
|
||||
previous_pathdir="${pathdir}"
|
||||
pathdir=$(dirname "${previous_pathdir}")
|
||||
done
|
||||
[ "${pathdir}" = "${tree}" ]
|
||||
|
||||
[ "${pathdir}" = "${tree_canonical}" ]
|
||||
}
|
||||
|
||||
|
||||
nvm_find_project_dir() {
|
||||
local path_
|
||||
path_="${PWD}"
|
||||
|
0
test/fast/Unit tests/Running 'nvm install --save' works as expected'
Normal file → Executable file
0
test/fast/Unit tests/Running 'nvm install --save' works as expected'
Normal file → Executable file
0
test/fast/Unit tests/Running 'nvm use --save' works with a .nvmrc in the parent dir
Normal file → Executable file
0
test/fast/Unit tests/Running 'nvm use --save' works with a .nvmrc in the parent dir
Normal file → Executable file
0
test/fast/Unit tests/Running 'nvm use --silent --save' doesn't output anything
Normal file → Executable file
0
test/fast/Unit tests/Running 'nvm use --silent --save' doesn't output anything
Normal file → Executable file
0
test/fast/Unit tests/Running 'nvm use -w' works as expected'
Normal file → Executable file
0
test/fast/Unit tests/Running 'nvm use -w' works as expected'
Normal file → Executable file
3
test/fast/Unit tests/nvm_download
Normal file → Executable file
3
test/fast/Unit tests/nvm_download
Normal file → Executable file
@ -25,4 +25,7 @@ NVM_AUTH_HEADER="Bearer test-token" nvm_download "http://127.0.0.1/bearer" > /de
|
||||
nvm_download "http://127.0.0.1/bearer" > /dev/null && die 'nvm_download with no auth header should not send the header and should fail'
|
||||
docker stop httpbin && docker rm httpbin
|
||||
|
||||
# ensure quoted extra args remain quoted
|
||||
nvm_download "https://raw.githubusercontent.com/nvm-sh/nvm/HEAD/install.sh" -o "; die quoted-command-not-quoted" || die 'command failed'
|
||||
|
||||
cleanup
|
||||
|
0
test/fast/Unit tests/nvm_install_binary_extract
Normal file → Executable file
0
test/fast/Unit tests/nvm_install_binary_extract
Normal file → Executable file
0
test/fast/Unit tests/nvm_install_no_progress_bar
Normal file → Executable file
0
test/fast/Unit tests/nvm_install_no_progress_bar
Normal file → Executable file
0
test/fast/Unit tests/nvm_is_version_installed
Normal file → Executable file
0
test/fast/Unit tests/nvm_is_version_installed
Normal file → Executable file
0
test/fast/Unit tests/nvm_write_nvmrc
Normal file → Executable file
0
test/fast/Unit tests/nvm_write_nvmrc
Normal file → Executable file
0
test/fast/nvm should remove the last trailing slash in $NVM_DIR
Normal file → Executable file
0
test/fast/nvm should remove the last trailing slash in $NVM_DIR
Normal file → Executable file
2
test/install_script/nvm_download
Normal file → Executable file
2
test/install_script/nvm_download
Normal file → Executable file
@ -12,7 +12,7 @@ nvm_download "https://raw.githubusercontent.com/nvm-sh/nvm/HEAD/install.sh" >/de
|
||||
|
||||
# nvm_download should fail to download wrong_install.sh
|
||||
if nvm_download "https://raw.githubusercontent.com/nvm-sh/nvm/HEAD/wrong_install.sh" &>/dev/null; then
|
||||
die "nvm_download should fail to download no existing file"
|
||||
die "nvm_download should fail to download nonexistent file"
|
||||
fi
|
||||
|
||||
cleanup
|
||||
|
0
test/installation_iojs/install from source
Normal file → Executable file
0
test/installation_iojs/install from source
Normal file → Executable file
0
test/installation_iojs/install version specified in .nvmrc from source
Normal file → Executable file
0
test/installation_iojs/install version specified in .nvmrc from source
Normal file → Executable file
0
test/installation_node/install from binary with binary flag set
Normal file → Executable file
0
test/installation_node/install from binary with binary flag set
Normal file → Executable file
0
test/slow/nvm exec/Running 'nvm exec' with help should not parse
Normal file → Executable file
0
test/slow/nvm exec/Running 'nvm exec' with help should not parse
Normal file → Executable file
0
test/slow/nvm reinstall-packages/test-npmlink/package.json
Normal file → Executable file
0
test/slow/nvm reinstall-packages/test-npmlink/package.json
Normal file → Executable file
0
test/slow/nvm use/Running 'nvm use' with nvmrc containing not installed version
Normal file → Executable file
0
test/slow/nvm use/Running 'nvm use' with nvmrc containing not installed version
Normal file → Executable file
Loading…
x
Reference in New Issue
Block a user