Refactor `nvm_source` a bit.
parent
4708cc73ef
commit
fd2fb24b03
11
install.sh
11
install.sh
|
@ -22,10 +22,6 @@ nvm_source() {
|
||||||
NVM_METHOD="$1"
|
NVM_METHOD="$1"
|
||||||
if [ -z "$NVM_SOURCE" ]; then
|
if [ -z "$NVM_SOURCE" ]; then
|
||||||
local NVM_SOURCE
|
local NVM_SOURCE
|
||||||
else
|
|
||||||
echo "$NVM_SOURCE"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
if [ "_$NVM_METHOD" = "_script" ]; then
|
if [ "_$NVM_METHOD" = "_script" ]; then
|
||||||
NVM_SOURCE="https://raw.githubusercontent.com/creationix/nvm/v0.22.0/nvm.sh"
|
NVM_SOURCE="https://raw.githubusercontent.com/creationix/nvm/v0.22.0/nvm.sh"
|
||||||
elif [ "_$NVM_METHOD" = "_script-nvm-exec" ]; then
|
elif [ "_$NVM_METHOD" = "_script-nvm-exec" ]; then
|
||||||
|
@ -36,6 +32,7 @@ nvm_source() {
|
||||||
echo >&2 "Unexpected value \"$NVM_METHOD\" for \$NVM_METHOD"
|
echo >&2 "Unexpected value \"$NVM_METHOD\" for \$NVM_METHOD"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
echo "$NVM_SOURCE"
|
echo "$NVM_SOURCE"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
@ -67,7 +64,7 @@ install_nvm_from_git() {
|
||||||
echo "=> Downloading nvm from git to '$NVM_DIR'"
|
echo "=> Downloading nvm from git to '$NVM_DIR'"
|
||||||
printf "\r=> "
|
printf "\r=> "
|
||||||
mkdir -p "$NVM_DIR"
|
mkdir -p "$NVM_DIR"
|
||||||
git clone "$(nvm_source "git")" "$NVM_DIR"
|
git clone "$(nvm_source git)" "$NVM_DIR"
|
||||||
fi
|
fi
|
||||||
cd "$NVM_DIR" && git checkout --quiet v0.22.0 && git branch --quiet -D master >/dev/null 2>&1
|
cd "$NVM_DIR" && git checkout --quiet v0.22.0 && git branch --quiet -D master >/dev/null 2>&1
|
||||||
return
|
return
|
||||||
|
@ -75,9 +72,9 @@ install_nvm_from_git() {
|
||||||
|
|
||||||
install_nvm_as_script() {
|
install_nvm_as_script() {
|
||||||
local NVM_SOURCE
|
local NVM_SOURCE
|
||||||
NVM_SOURCE=$(nvm_source "script")
|
NVM_SOURCE=$(nvm_source script)
|
||||||
local NVM_EXEC_SOURCE
|
local NVM_EXEC_SOURCE
|
||||||
NVM_EXEC_SOURCE=$(nvm_source "script-nvm-exec")
|
NVM_EXEC_SOURCE=$(nvm_source script-nvm-exec)
|
||||||
|
|
||||||
# Downloading to $NVM_DIR
|
# Downloading to $NVM_DIR
|
||||||
mkdir -p "$NVM_DIR"
|
mkdir -p "$NVM_DIR"
|
||||||
|
|
Loading…
Reference in New Issue