From ed22d3de2dd6670cd7c030e24bfbfb0327fa841e Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Fri, 16 Jan 2015 11:10:37 -0600 Subject: [PATCH] Add support for `nvm install node` and `nvm install iojs` --- nvm.sh | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/nvm.sh b/nvm.sh index a64ae36..202ce27 100644 --- a/nvm.sh +++ b/nvm.sh @@ -913,7 +913,18 @@ nvm() { shift fi - VERSION="$(nvm_remote_version "$provided_version")" + case "_$provided_version" in + "_$(nvm_iojs_prefix)" | "_io.js") + VERSION="$(nvm_add_iojs_prefix $(nvm_ls_remote_iojs | tail -n1))" + ;; + "_$(nvm_node_prefix)") + VERSION="$(nvm_ls_remote stable)" + ;; + *) + VERSION="$(nvm_remote_version "$provided_version")" + ;; + esac + ADDITIONAL_PARAMETERS='' local PROVIDED_REINSTALL_PACKAGES_FROM local REINSTALL_PACKAGES_FROM @@ -940,6 +951,11 @@ nvm() { return 5 fi + local NVM_IOJS + if nvm_is_iojs_version "$VERSION"; then + NVM_IOJS=true + fi + local VERSION_PATH VERSION_PATH="$(nvm_version_path "$VERSION")" if [ -d "$VERSION_PATH" ]; then @@ -955,11 +971,6 @@ nvm() { return 3 fi - local NVM_IOJS - if nvm_is_iojs_version "$VERSION" || [ "_$VERSION" = "_$(nvm_iojs_prefix)" ]; then - NVM_IOJS=true - fi - if [ "_$NVM_OS" = "_freebsd" ]; then # node.js and io.js do not have a FreeBSD binary nobinary=1