parent
5904d41b25
commit
689c52c90d
14
install.sh
14
install.sh
|
@ -28,6 +28,8 @@ nvm_source() {
|
||||||
fi
|
fi
|
||||||
if [ "_$NVM_METHOD" = "_script" ]; then
|
if [ "_$NVM_METHOD" = "_script" ]; then
|
||||||
NVM_SOURCE="https://raw.githubusercontent.com/creationix/nvm/v0.18.0/nvm.sh"
|
NVM_SOURCE="https://raw.githubusercontent.com/creationix/nvm/v0.18.0/nvm.sh"
|
||||||
|
elif [ "_$NVM_METHOD" = "_script-nvm-exec" ]; then
|
||||||
|
NVM_SOURCE="https://raw.githubusercontent.com/creationix/nvm/v0.18.0/nvm-exec"
|
||||||
elif [ "_$NVM_METHOD" = "_git" ] || [ -z "$NVM_METHOD" ]; then
|
elif [ "_$NVM_METHOD" = "_git" ] || [ -z "$NVM_METHOD" ]; then
|
||||||
NVM_SOURCE="https://github.com/creationix/nvm.git"
|
NVM_SOURCE="https://github.com/creationix/nvm.git"
|
||||||
else
|
else
|
||||||
|
@ -74,6 +76,8 @@ 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
|
||||||
|
NVM_EXEC_SOURCE=$(nvm_source "script-nvm-exec")
|
||||||
|
|
||||||
# Downloading to $NVM_DIR
|
# Downloading to $NVM_DIR
|
||||||
mkdir -p "$NVM_DIR"
|
mkdir -p "$NVM_DIR"
|
||||||
|
@ -83,9 +87,17 @@ install_nvm_as_script() {
|
||||||
echo "=> Downloading nvm as script to '$NVM_DIR'"
|
echo "=> Downloading nvm as script to '$NVM_DIR'"
|
||||||
fi
|
fi
|
||||||
nvm_download -s "$NVM_SOURCE" -o "$NVM_DIR/nvm.sh" || {
|
nvm_download -s "$NVM_SOURCE" -o "$NVM_DIR/nvm.sh" || {
|
||||||
echo >&2 "Failed to download '$NVM_SOURCE'.."
|
echo >&2 "Failed to download '$NVM_SOURCE'"
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
nvm_download -s "$NVM_EXEC_SOURCE" -o "$NVM_DIR/nvm-exec" || {
|
||||||
|
echo >&2 "Failed to download '$NVM_EXEC_SOURCE'"
|
||||||
|
return 2
|
||||||
|
}
|
||||||
|
chmod a+x "$NVM_DIR/nvm-exec" || {
|
||||||
|
echo >&2 "Failed to mark '$NVM_DIR/nvm-exec' as executable"
|
||||||
|
return 3
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
|
@ -17,6 +17,9 @@ echo $(nvm_source "git") | grep "nvm.git$" > /dev/null || die "nvm_source withou
|
||||||
# nvm_source with script parameter returns the location of nvm.sh
|
# nvm_source with script parameter returns the location of nvm.sh
|
||||||
echo $(nvm_source "script") | grep "nvm.sh$" > /dev/null || die "nvm_source \"script\" should return the location of nvm.sh"
|
echo $(nvm_source "script") | grep "nvm.sh$" > /dev/null || die "nvm_source \"script\" should return the location of nvm.sh"
|
||||||
|
|
||||||
|
# nvm_source with script-nvm-exec parameter returns the location of nvm-exec
|
||||||
|
echo $(nvm_source "script-nvm-exec") | grep "nvm-exec$" > /dev/null || die "nvm_source \"script-nvm-exec\" should return the location of nvm.sh"
|
||||||
|
|
||||||
# nvm_source with any other parameter errors out and exits
|
# nvm_source with any other parameter errors out and exits
|
||||||
nvm_source "anything" 2> /dev/null && die "nvm_source with invalid parameter should exit"
|
nvm_source "anything" 2> /dev/null && die "nvm_source with invalid parameter should exit"
|
||||||
out=$(nvm_source "anything" 2>&1 >/dev/null) || : #Saving the process here
|
out=$(nvm_source "anything" 2>&1 >/dev/null) || : #Saving the process here
|
||||||
|
|
Loading…
Reference in New Issue