Consolidate `reinstall-packages-from` logic to one place `nvm install`
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Jordan Harband · committed by Jordan Harband · parent d68f667 · Browse files · 1 file·+12 added−19 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+12 added−19 removed
- other:+12 added−19 removed
Provenance
- Commit
a26ef4f- Tree
94ce5c9- Author
Jordan Harband <ljharb@gmail.com>- Committer
Jordan Harband <ljharb@gmail.com>- Parent
d68f667
1 file changed+12 added−19 removed
modified:nvm.sh+12 added-19 removed
978 unmodified lines979 980 nvm_install_node_source() {981 local VERSION982 VERSION="$1"983- local REINSTALL_PACKAGES_FROM984- REINSTALL_PACKAGES_FROM="$2"983 local ADDITIONAL_PARAMETERS986- ADDITIONAL_PARAMETERS="$3"984+ ADDITIONAL_PARAMETERS="$2"985 986 if [ -n "$ADDITIONAL_PARAMETERS" ]; then987 echo "Additional options while compiling: $ADDITIONAL_PARAMETERS"988 fi37 unmodified lines1026 command rm -f "$VERSION_PATH" 2>/dev/null && \1027 $make $MAKE_CXX install1028 )1029 then1032- if nvm use "$VERSION" && [ ! -z "$REINSTALL_PACKAGES_FROM" ] && [ "_$REINSTALL_PACKAGES_FROM" != "_N/A" ]; then1033- nvm reinstall-packages "$REINSTALL_PACKAGES_FROM"1034- fi1030 if ! nvm_has "npm" ; then1031 echo "Installing npm..."1032 if nvm_version_greater 0.2.0 "$VERSION"; then1033 echo "npm requires node v0.2.3 or higher" >&2164 unmodified lines1198 elif [ "_$NVM_OS" = "_sunos" ] && [ "$NVM_IOJS" = true ]; then1199 # io.js does not have a SunOS binary1200 nobinary=11201 fi1202+ local NVM_INSTALL_SUCCESS1203 # skip binary install if "nobinary" option specified.1204 if [ $nobinary -ne 1 ] && nvm_binary_available "$VERSION"; then1209- local NVM_INSTALL_SUCCESS1205 if [ "$NVM_IOJS" = true ] && nvm_install_iojs_binary "$VERSION" "$REINSTALL_PACKAGES_FROM"; then1206 NVM_INSTALL_SUCCESS=true1207 elif [ "$NVM_IOJS" != true ] && nvm_install_node_binary "$VERSION" "$REINSTALL_PACKAGES_FROM"; then1208 NVM_INSTALL_SUCCESS=true1209 fi1210+ elif [ "$NVM_IOJS" = true ]; then1211+ # nvm_install_iojs_source "$VERSION" "$ADDITIONAL_PARAMETERS"1212+ echo "Installing iojs from source is not currently supported" >&21213+ return 1051214+ elif nvm_install_node_source "$VERSION" "$ADDITIONAL_PARAMETERS"; then1215+ NVM_INSTALL_SUCCESS=true1216+ fi1217 1216- if [ "$NVM_INSTALL_SUCCESS" = true ] \1217- && nvm use "$VERSION" \1218- && [ ! -z "$REINSTALL_PACKAGES_FROM" ] \1218+ if [ "$NVM_INSTALL_SUCCESS" = true ] && nvm use "$VERSION"; then1219+ if [ ! -z "$REINSTALL_PACKAGES_FROM" ] \1220 && [ "_$REINSTALL_PACKAGES_FROM" != "_N/A" ]; then1221 nvm reinstall-packages "$REINSTALL_PACKAGES_FROM"1222 fi1222- return $?1223 fi1224-1225- if [ "$NVM_IOJS" = true ]; then1226- # nvm_install_iojs_source "$VERSION" "$REINSTALL_PACKAGES_FROM" "$ADDITIONAL_PARAMETERS"1227- echo "Installing iojs from source is not currently supported" >&21228- return 1051224+ return $?1229- else1230- nvm_install_node_source "$VERSION" "$REINSTALL_PACKAGES_FROM" "$ADDITIONAL_PARAMETERS"1231- fi1225 ;;1226 "uninstall" )1227 if [ $# -ne 2 ]; then1228 >&2 nvm help513 unmodified lines