Compare commits

..

84 Commits

Author SHA1 Message Date
Jordan Harband
0a95e77000 v0.33.2 2017-04-26 00:50:33 -07:00
Piper Chester
964c7b3115 [Docs] README.markdown → README.md 2017-04-08 09:19:15 -07:00
Peter Dave Hello
bee7b9970e [Docs] Remove archlinux python tips in "Problems"
This is not working at all.
2017-04-23 23:33:42 +08:00
Peter Dave Hello
f38d21c529 [Docs] Improve "Problems" README section readability 2017-04-13 17:56:46 +08:00
Peter Dave Hello
7aa3448259 [Tests] Add curl back when WITHOUT_CURL test done since cache needs it 2017-04-09 13:13:25 +08:00
Peter Dave Hello
a66a9caa1c [Tests] Use node v0.10.7 for thread para test as other install from src tests 2017-04-09 13:08:04 +08:00
Jordan Harband
ec2b02e187 npm run doctoc 2017-04-12 16:11:01 -07:00
rouzbeh84
0f25994c8e [Docs] git install update
- added git as the last method before full manual install.
- added the directory on `git clone` command
- added the `git checkout v0.33.1` as the -v gets updated automatically
2017-04-06 16:23:50 -07:00
Peter Dave Hello
229c7e6f0c [Tests] Test "make release" in Travis CI 2017-04-09 15:16:13 +08:00
Peter Dave Hello
d80686c7cd [Makefile] Introduce _ensure-current-version to ensure version tags 2017-04-09 15:09:31 +08:00
Piper Chester
65aedc105a [Docs] capitalize C++ 2017-04-08 09:16:54 -07:00
Peter Dave Hello
153f8e7b31 [Fix] To confirm curl exists before detecting curl libz feature 2017-04-09 13:44:07 +08:00
Peter Dave Hello
e87f395b7a [Refactor] minor "if" and "return" improvement 2017-04-06 03:55:42 +08:00
Peter Dave Hello
2ec2d31012 [Tests] Re-enable WITHOUT_CURL tests 2017-04-06 14:52:26 +08:00
Peter Dave Hello
daa9c3604d [Fix] To confirm curl exists before detecting curl libz feature 2017-04-06 05:20:55 +08:00
Peter Dave Hello
ec3ba1973a [New] install.sh: Parallel script download jobs 2017-04-05 04:54:38 +08:00
Peter Dave Hello
c6866eeb37 [Test] "nvm alias" lts test bug fix 2017-04-02 14:34:04 +08:00
Peter Dave Hello
7bd7a35cb2 [Docs] Improve nvm usage examples
Correct two double [tab] and try to improve its readability
2017-04-06 00:36:13 +08:00
Peter Dave Hello
e84bcaabdc [Refactor] Improve profile detection in install script 2017-04-03 23:06:04 +08:00
Yanick Champoux
d4e3f0943b [Docs] add 'fnm' as part of the fish alternatives 2017-04-04 15:01:39 -04:00
Peter Dave Hello
3f5fd57881 [Refactor] Reduce a sed command with pipe 2017-04-05 04:58:34 +08:00
Peter Dave Hello
f524bcb973 [Fix] Correct indent in install.sh 2017-04-05 05:01:54 +08:00
Peter Dave Hello
a0534b720a [Tests] Reduce apt package dependencies calculation complexity 2017-04-02 16:48:28 +08:00
Peter Dave Hello
424056c839 [Tests] Remove ShellCheck manual dependency install under Ubuntu 14.04 2017-04-02 15:49:01 +08:00
Peter Dave Hello
18df8e3d2e [Tests] Remove ppa source since we migrated to Ubuntu Trusty 2017-04-02 07:24:56 +08:00
Jordan Harband
4249b1c2bb [Fix] nvm_ensure_version_installed: add system support.
Relates to #1238
2017-03-31 00:52:56 -07:00
Peter Dave Hello
5776cc952a [copyright] update to 2017 2017-03-29 17:54:15 +08:00
Peter Dave Hello
6c24346af5 [New] Add missing commands in bash_completion 2017-03-30 19:49:30 +08:00
Peter Dave Hello
450088e51a [Refactor] Improve if conditoion logic in "use" 2017-03-30 00:41:31 +08:00
Peter Dave Hello
9a6e657e53 [Docs] Remove curl --compressed notes since we added its detection 2017-03-29 17:51:23 +08:00
Peter Dave Hello
8fc7e854de [Tests] Comment out ksh dependency installation, cc #574
- Mistakenly uncommented in 70370a857f
 - per afba4e08fd / #574
2017-03-29 18:05:15 +08:00
Peter Dave Hello
93c1036758 [Tests] Move to Ubuntu 14.04 on Travis CI
Since Ubuntu 12.04 is pretty old now, it's also going to EOL next month,
maybe we can just move on Ubuntu 14.04 first.
2017-03-26 05:19:57 +08:00
Ægir Örn Símonarson
4411abf82e [Docs] Add Mac OS "troubleshooting" to README
It has a section on nvm node version not being found in vim.
2017-03-29 19:04:31 -07:00
Peter Dave Hello
a36af70571 [Docs] Update issue #900 title in README.markdown 2017-03-28 22:47:34 +08:00
Peter Dave Hello
059ab0e1ac [Refactor] Make the code a little bit cleaner 2017-03-28 15:27:49 +08:00
Jordan Harband
b9f9977cdd [Fix] nvm install -s: npm detection
- add `nvm_use_if_needed`
 - add `nvm_install_npm_if_needed`
2017-03-27 15:00:50 -07:00
Peter Dave Hello
676fff0219 [completions] Remove nospace in bash_completion 2017-03-26 06:10:53 +08:00
Peter Dave Hello
7b253c8c0a [New] Supercharge nvm debug output
Try to get shell version, OS and its version, curl/wget/git version.
2017-03-23 14:48:00 +08:00
Peter Dave Hello
f344d0694b [Tests] Move cabel, nvm & npm install into TravisCI "install" section 2017-03-26 05:22:48 +08:00
Peter Dave Hello
d9704471ff [Tests] Cache "node_modules" in CI 2017-03-26 04:06:32 +08:00
Peter Dave Hello
82aaa0a20d [Tests] Do not install nodejs, npm deps for SHELLCHECK 2017-03-25 16:57:42 +08:00
Peter Dave Hello
e41197ea94 [Tests] Improve npm dependencies installaion in travis ci 2017-03-24 13:46:50 +08:00
Peter Dave Hello
6ef2be8db4 [Docs] Get https://nodejs.org/dist header instead of its body, fix #1451 2017-03-23 14:12:31 +08:00
Peter Dave Hello
d465493832 [Docs] Use https protocol for nodejs.org in issue template 2017-03-23 14:07:07 +08:00
Peter Dave Hello
0e5fba2dfb [Docs] Also add --compressed for curl in issue template, cc #1437 2017-03-23 14:01:46 +08:00
Peter Dave Hello
973dfc6d4a [New] Dynamically detect if curl supports --compressed 2017-03-23 16:51:20 +08:00
Peter Dave Hello
6a3b1dd2c3 [New] Enable curl auto compression/decompression
Enable `--compressed` parameter on curl to automatically enable
compression on request content by sending coressponding header, if the
server side supports compression format like deflate or gzip, curl will
also decompress the content automatically, so there is no additional
works need to done manually on client side, but just enjoy the benifits
of bandwidth and time saving!

Take https://nodejs.org/dist/index.tab as an example which is last
modified on Tue, 14 Mar 2017 22:41:05 GMT, the compressed transmission
only take 4829 bytes howevet the not compressed on taks 48000 bytes,
which is about 10 times larger!

This feature can be traced back to Sep 3 2002, in curl commit:
 - 64bbe9dfaf

So should be supported on various versions widely.
2017-03-23 16:51:20 +08:00
Peter Dave Hello
4c97828f79 Update .gitattributes 2017-03-23 04:52:46 +08:00
Peter Dave Hello
ccd9697ef2 Delete .npmignore 2017-03-23 08:47:53 +08:00
Peter Dave Hello
20a40dd8c2 [Docs] Update CONTRIBUTING.md 2017-03-23 04:46:49 +08:00
Peter Dave Hello
237c3a78e2 [Tests] Add retry on urchin setup which has no built in retry feature
Unlike other built in functions like git fetch or apt-get dependencies,
manual installations won't have retry by default, enabling retry could
help reduce the impact of network issues and furthur prevent getting
build error like Job #1956.21:
- https://travis-ci.org/creationix/nvm/jobs/212640007

Ref:
- https://docs.travis-ci.com/user/common-build-problems/
2017-03-22 20:42:33 +08:00
Peter Dave Hello
fa3631fee3 [Refactor] Add nvm_has_non_aliased 2017-03-20 16:57:26 +08:00
Peter Dave Hello
316c9f34c6 [Performance] Use awk's comparison to save a pipe to grep 2017-03-20 04:50:32 +08:00
Peter Dave Hello
6cb12b0f99 [Performance] Improve awk usage 2017-03-21 04:23:53 +08:00
Peter Dave Hello
6ed73b0696 [Refactor] Improve sed usage for performance 2017-03-20 17:53:44 -07:00
Shirsh Zibbu
dcd008ff61 [Refactor] remove unnecessary quotes 2017-03-07 05:46:45 +05:30
Peter Dave Hello
039afb9470 [Docs] Update Installation section
1. If we are not going to install nodejs or io.js from source, we may
not need to have c++ compiler or libssl-dev package
2. the `build-essential` and `libssl-dev` packages should work on all
the Debian and Ubuntu based GNU/Linux distros
3. Remove useless blank lines
2017-03-16 04:22:29 +08:00
Peter Dave Hello
b879628394 [Fix] declare MANPATH if and only if it's not set
By manpath's man page in Ubuntu 16.04:

> If $MANPATH is set, manpath will simply display its contents and issue
> a warning.

By fa22d712ff for #1413, `nvm` now will
declare the "MANPATH" variable, no matter if it's set or not, so in the
situation that $MANPATH is set, you'll get the warning:

> manpath: warning: $MANPATH set, ignoring /etc/manpath.config
2017-03-19 02:19:14 +08:00
Jordan Harband
9b2629384f [Fix] nvm install -s: ensure additional params lack a trailing space.
Note: I believe this does not fix the underlying issue in zsh, which is
that it does not split up `$ADDITIONAL_PARAMETERS` and instead passes
the contents as one single argument.
2017-03-17 23:20:17 -07:00
Peter Dave Hello
50ae1e5199 [Fix] Install failed should return correct exit status, fix #1347 2016-12-10 00:20:04 +08:00
Matthew McEachen
1e6b5ce039 [Fix] stop setting mirror env vars unnecessarily
Fixes #1429
2017-03-16 23:54:55 -07:00
Peter Dave Hello
952d0067b3 [Fix] bash_completion should make sure nvm loaded 2017-03-15 14:34:28 +08:00
Peter Dave Hello
911ff87601 [Fix] bash_completion source prompt, remove && 2017-03-15 14:34:28 +08:00
Peter Dave Hello
9593616b8c [Fix] NVM_PROFILE bash/zsh detection in installation 2017-03-15 14:34:28 +08:00
Peter Dave Hello
d8538dad84 [Refactor] nvm.sh minor refactor 2017-03-14 17:45:54 +08:00
Alex Ryan
257f16fb13 [Docs] fi README typo 2017-03-13 03:16:08 -07:00
Peter Dave Hello
182a18d911 [Fix] Github should be GitHub 2017-03-09 23:02:08 +08:00
Peter Dave Hello
8e6201b5b1 [Tests] Update test mocks 2017-03-10 18:02:47 +08:00
Dominyk Tiller
b676bf7d0e [Fix] checksums: remove libressl command support
This was an "oops" on my part when I was testing changes for my work
that was later adapted & merged in f1bca106a8.
LibreSSL is never installed as a `libressl` as it is intended to be a
replacement for `openssl` as much as possible, and consequently the
executable is called `openssl`.
2017-03-08 12:54:37 +00:00
Jordan Harband
fa22d712ff [Fix] ensure this variable is not unbound.
Fixes #1413.
2017-03-06 09:35:58 -08:00
Jordan Harband
286090b607 Merge pull request #1408 from PeterDaveHello/doctoc
[Docs] [Tests] Introduce doctoc for "Table of Contents" autogeneration
2017-03-01 00:57:05 -08:00
Peter Dave Hello
1689b174b3 [Test] Add doctoc up-to-date test in TravisCI 2017-02-28 08:45:48 +08:00
Peter Dave Hello
f8aaa32d17 README minor adjustment, generate "Table of Content" via doctoc 2017-02-27 18:33:41 +08:00
Peter Dave Hello
3dc5777b66 Add doctoc devDependency and npm script
Will use it to generate "Table of Contents"
2017-02-27 01:35:36 +08:00
Jordan Harband
6669e91bd8 v0.33.1 2017-02-20 17:59:20 -08:00
John-David Dalton
7c271729ef Enable working without tput. 2017-02-19 23:01:47 -08:00
Jordan Harband
b54e147442 [Fix] nvm unload: run nvm deactivate before unsetting everything.
Fixes #1399.
2017-02-18 00:50:33 -08:00
Jordan Harband
e7e4a9b3d6 [Fix] unset NVM_RC_VERSION env var immediately after it’s no longer needed.
Relates to #1399.
2017-02-18 00:48:41 -08:00
Jordan Harband
49e446dac1 [debug] include mirrors in nvm debug output. 2017-02-14 09:06:23 -08:00
Robin Schneider
1b8b7b31ed Add CII best practices badge
Thanks to @ljharb for applying for it!

Related to: #1395
2017-02-12 11:00:10 +01:00
Jordan Harband
6fc0241c21 [Fix] install.sh: only un-interpolate $HOME for the profile source string.
Fixes #1384.
2017-02-12 00:32:49 -08:00
Jordan Harband
affcc5087c [Fix] set -e: nvm install lts/something: call nvm_ensure_default_set with the proper value.
Fixes #1394.
2017-02-11 23:19:29 -08:00
Ryan Wheale
1b2305232f [install script] Use $HOME variable in NVM_DIR 2017-01-12 10:55:56 -07:00
butlerx
f1a5f2a15f [Docs] [Fix] zsh autochange: only nvm install if we can’t nvm use 2016-12-19 12:00:47 +00:00
35 changed files with 755 additions and 306 deletions

3
.gitattributes vendored
View File

@@ -1 +1,2 @@
*.sh eol=lf * eol=lf

View File

@@ -32,7 +32,7 @@
- Is there anything in any of your profile files (`.bashrc`, `.bash_profile`, `.zshrc`, etc) that modifies the `PATH`? - Is there anything in any of your profile files (`.bashrc`, `.bash_profile`, `.zshrc`, etc) that modifies the `PATH`?
<!-- if this does not apply, please delete this section --> <!-- if this does not apply, please delete this section -->
- If you are having installation issues, or getting "N/A", what does `curl -v nodejs.org/dist/` print out? - If you are having installation issues, or getting "N/A", what does `curl -I --compressed -v https://nodejs.org/dist/` print out?
<details> <details>
<!-- do not delete the following blank line --> <!-- do not delete the following blank line -->

View File

@@ -1,4 +0,0 @@
src
v*
alias

View File

@@ -1,34 +1,39 @@
language: generic language: generic
dist: trusty
sudo: required sudo: required
addons: addons:
apt: apt:
sources:
- ubuntu-toolchain-r-test
packages: packages:
- gcc-4.8
- g++-4.8
- cabal-install - cabal-install
- ghc - ghc
- zsh - zsh
- ksh # - ksh
# - gcc-4.8
# - g++-4.8
cache: cache:
directories: directories:
- $HOME/.npm
- $HOME/.ghc - $HOME/.ghc
- $HOME/.cabal - $HOME/.cabal
- $TRAVIS_BUILD_DIR/.cache - $TRAVIS_BUILD_DIR/.cache
- $TRAVIS_BUILD_DIR/node_modules
before_install: before_install:
- $SHELL --version 2> /dev/null || dpkg -s $SHELL 2> /dev/null || which $SHELL - $SHELL --version 2> /dev/null || dpkg -s $SHELL 2> /dev/null || which $SHELL
- curl --version - curl --version
- wget --version - wget --version
- if [ -n "${SHELLCHECK-}" ]; then cabal update && cabal install transformers-0.4.3.0 ShellCheck && shellcheck --version ; fi
install: install:
- (mkdir /tmp/urchin && cd /tmp/urchin && curl -s "$(curl -s https://registry.npmjs.com/urchin | grep -Eo '"tarball":\s*"[^"]+"' | tail -n 1 | awk -F\" '{ print $4 }')" -O && tar -x -f urchin*) - if [ -n "${SHELLCHECK-}" ]; then cabal update && cabal install ShellCheck && shellcheck --version ; fi
- chmod +x /tmp/urchin/package/urchin - if [ -z "${SHELLCHECK-}" ]; then nvm install node && npm install && npm prune && npm ls urchin doctoc; fi
- '[ -z "$WITHOUT_CURL" ] || sudo apt-get remove curl -y' - '[ -z "$WITHOUT_CURL" ] || sudo apt-get remove curl -y'
script: script:
- if [ -n "${MAKE_RELEASE-}" ]; then export GIT_EDITOR="sed -i '1 s/^/99.99.99 make release test/'" && git fetch --unshallow --tags && echo proceed | make TAG=99.99.99 release ; fi
- if [ -n "${DOCTOCCHECK-}" ]; then cp README.md README.md.orig && npm run doctoc && diff -q README.md README.md.orig ; fi
- if [ -n "${SHELLCHECK-}" ]; then shellcheck -s bash nvm.sh && shellcheck -s sh nvm.sh && shellcheck -s dash nvm.sh && shellcheck -s ksh nvm.sh ; fi - if [ -n "${SHELLCHECK-}" ]; then shellcheck -s bash nvm.sh && shellcheck -s sh nvm.sh && shellcheck -s dash nvm.sh && shellcheck -s ksh nvm.sh ; fi
- if [ -n "${SHELLCHECK-}" ]; then shellcheck -s bash install.sh bash_completion nvm-exec ; fi - if [ -n "${SHELLCHECK-}" ]; then shellcheck -s bash install.sh bash_completion nvm-exec ; fi
- if [ -z "${SHELLCHECK-}" ]; then make TEST_SUITE=$TEST_SUITE URCHIN=/tmp/urchin/package/urchin test-$SHELL ; fi - if [ -n "${SHELL-}" ] && [ -n "${TEST_SUITE}" ]; then make TEST_SUITE=$TEST_SUITE URCHIN="$(npm bin)/urchin" test-$SHELL ; fi
after_success:
- if [ -n "$WITHOUT_CURL" ]; then sudo apt-get install curl -y ; fi
env: env:
global: global:
- CXX=g++-4.8 - CXX=g++-4.8
@@ -36,6 +41,8 @@ env:
- PATH="~/.cabal/bin/:$(echo $PATH | sed 's/::/:/')" - PATH="~/.cabal/bin/:$(echo $PATH | sed 's/::/:/')"
- NVM_DIR="${TRAVIS_BUILD_DIR}" - NVM_DIR="${TRAVIS_BUILD_DIR}"
matrix: matrix:
- MAKE_RELEASE=true
- DOCTOCCHECK=true
- SHELLCHECK=true - SHELLCHECK=true
- SHELL=bash TEST_SUITE=install_script - SHELL=bash TEST_SUITE=install_script
- SHELL=sh TEST_SUITE=fast - SHELL=sh TEST_SUITE=fast
@@ -54,22 +61,22 @@ env:
- SHELL=zsh TEST_SUITE=slow - SHELL=zsh TEST_SUITE=slow
# - SHELL=ksh TEST_SUITE=slow # - SHELL=ksh TEST_SUITE=slow
- SHELL=sh TEST_SUITE=installation_node - SHELL=sh TEST_SUITE=installation_node
# - SHELL=sh TEST_SUITE=installation_node WITHOUT_CURL=1 - SHELL=sh TEST_SUITE=installation_node WITHOUT_CURL=1
- SHELL=dash TEST_SUITE=installation_node - SHELL=dash TEST_SUITE=installation_node
# - SHELL=dash TEST_SUITE=installation_node WITHOUT_CURL=1 - SHELL=dash TEST_SUITE=installation_node WITHOUT_CURL=1
- SHELL=bash TEST_SUITE=installation_node - SHELL=bash TEST_SUITE=installation_node
# - SHELL=bash TEST_SUITE=installation_node WITHOUT_CURL=1 - SHELL=bash TEST_SUITE=installation_node WITHOUT_CURL=1
- SHELL=zsh TEST_SUITE=installation_node - SHELL=zsh TEST_SUITE=installation_node
# - SHELL=zsh TEST_SUITE=installation_node WITHOUT_CURL=1 - SHELL=zsh TEST_SUITE=installation_node WITHOUT_CURL=1
# - SHELL=ksh TEST_SUITE=installation_node # - SHELL=ksh TEST_SUITE=installation_node
# - SHELL=ksh TEST_SUITE=installation_node WITHOUT_CURL=1 # - SHELL=ksh TEST_SUITE=installation_node WITHOUT_CURL=1
- SHELL=sh TEST_SUITE=installation_iojs - SHELL=sh TEST_SUITE=installation_iojs
# - SHELL=sh TEST_SUITE=installation_iojs WITHOUT_CURL=1 - SHELL=sh TEST_SUITE=installation_iojs WITHOUT_CURL=1
- SHELL=dash TEST_SUITE=installation_iojs - SHELL=dash TEST_SUITE=installation_iojs
# - SHELL=dash TEST_SUITE=installation_iojs WITHOUT_CURL=1 - SHELL=dash TEST_SUITE=installation_iojs WITHOUT_CURL=1
- SHELL=bash TEST_SUITE=installation_iojs - SHELL=bash TEST_SUITE=installation_iojs
# - SHELL=bash TEST_SUITE=installation_iojs WITHOUT_CURL=1 - SHELL=bash TEST_SUITE=installation_iojs WITHOUT_CURL=1
- SHELL=zsh TEST_SUITE=installation_iojs - SHELL=zsh TEST_SUITE=installation_iojs
# - SHELL=zsh TEST_SUITE=installation_iojs WITHOUT_CURL=1 - SHELL=zsh TEST_SUITE=installation_iojs WITHOUT_CURL=1
# - SHELL=ksh TEST_SUITE=installation_iojs # - SHELL=ksh TEST_SUITE=installation_iojs
# - SHELL=ksh TEST_SUITE=installation_iojs WITHOUT_CURL=1 # - SHELL=ksh TEST_SUITE=installation_iojs WITHOUT_CURL=1

View File

@@ -1,15 +1,20 @@
Thanks for contributing to `nvm`! Thanks for contributing to `nvm`!
We love pull requests, they're our favorite. We love pull requests and issues, they're our favorite.
However, before submitting, please review the following: However, before submitting, please review the following:
For bug reports:
- Please make sure the bug is reproducible, and give us the steps to reproduce it, so that we can dig into the problem.
- Please give us as much detail as possible about your environment, so we can more easily confirm the problem.
For pull requests:
- Please include tests. Changes with tests will be merged very quickly. - Please include tests. Changes with tests will be merged very quickly.
- Please manually confirm that your changes work in `bash`, `sh`/`dash`, `ksh`, and `zsh`. Fast tests do run in these shells, but it's nice to manually verify also. - Please manually confirm that your changes work in `bash`, `sh`/`dash`, `ksh`, and `zsh`. Fast tests do run in these shells, but it's nice to manually verify also.
- Please maintain consistent whitespace - 2-space indentation, trailing newlines in all files, etc. - Please maintain consistent whitespace - 2-space indentation, trailing newlines in all files, etc.
- Any time you make a change to your PR, please rebase freshly on top of master. Nobody likes merge commits. - Any time you make a change to your PR, please rebase freshly on top of master. Nobody likes merge commits.
Even if you don't have all of these items covered, please still feel free to submit a PR! Someone else may be inspired and volunteer to complete it for you. Even if you don't have all of these items covered, please still feel free to submit a PR/issue! Someone else may be inspired and volunteer to complete it for you.
Thanks again! Thanks again!

View File

@@ -1,6 +1,6 @@
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2010-2016 Tim Caswell Copyright (c) 2010-2017 Tim Caswell
Permission is hereby granted, free of charge, to any person obtaining a copy of Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in this software and associated documentation files (the "Software"), to deal in

View File

@@ -15,7 +15,7 @@ ifeq ($(findstring /,$(URCHIN)),) # urchin path was NOT passed in.
UTIL_CHECK := $(or $(shell PATH="$(PATH)" which $(UTILS) >/dev/null && echo 'ok'),$(error Did you forget to run `npm install` after cloning the repo? At least one of the required supporting utilities not found: $(UTILS))) UTIL_CHECK := $(or $(shell PATH="$(PATH)" which $(UTILS) >/dev/null && echo 'ok'),$(error Did you forget to run `npm install` after cloning the repo? At least one of the required supporting utilities not found: $(UTILS)))
endif endif
# The files that need updating when incrementing the version number. # The files that need updating when incrementing the version number.
VERSIONED_FILES := nvm.sh install.sh README.markdown package.json VERSIONED_FILES := nvm.sh install.sh README.md package.json
# Define all shells to test with. Can be overridden with `make SHELLS=... <target>`. # Define all shells to test with. Can be overridden with `make SHELLS=... <target>`.
SHELLS := sh bash dash zsh # ksh (#574) SHELLS := sh bash dash zsh # ksh (#574)
# Generate 'test-<shell>' target names from specified shells. # Generate 'test-<shell>' target names from specified shells.
@@ -55,6 +55,14 @@ ifndef TAG
$(error Please invoke with `make TAG=<new-version> release`, where <new-version> is either an increment specifier (patch, minor, major, prepatch, preminor, premajor, prerelease), or an explicit major.minor.patch version number) $(error Please invoke with `make TAG=<new-version> release`, where <new-version> is either an increment specifier (patch, minor, major, prepatch, preminor, premajor, prerelease), or an explicit major.minor.patch version number)
endif endif
# Ensures there are version tags in repository
.PHONY: _ensure-current-version
_ensure-current-version:
ifeq ($(shell git tag),$(printf ''))
@git fetch --tags
endif
# Ensures that the git workspace is clean. # Ensures that the git workspace is clean.
.PHONY: _ensure-clean .PHONY: _ensure-clean
_ensure-clean: _ensure-clean:
@@ -62,7 +70,7 @@ _ensure-clean:
# Makes a release; invoke with `make TAG=<versionOrIncrementSpec> release`. # Makes a release; invoke with `make TAG=<versionOrIncrementSpec> release`.
.PHONY: release .PHONY: release
release: _ensure-tag _ensure-clean release: _ensure-tag _ensure-clean _ensure-current-version
@old_ver=`git describe --abbrev=0 --tags --match 'v[0-9]*.[0-9]*.[0-9]*'` || { echo "Failed to determine current version." >&2; exit 1; }; old_ver=$${old_ver#v}; \ @old_ver=`git describe --abbrev=0 --tags --match 'v[0-9]*.[0-9]*.[0-9]*'` || { echo "Failed to determine current version." >&2; exit 1; }; old_ver=$${old_ver#v}; \
new_ver=`echo "$(TAG)" | sed 's/^v//'`; new_ver=$${new_ver:-patch}; \ new_ver=`echo "$(TAG)" | sed 's/^v//'`; new_ver=$${new_ver:-patch}; \
if printf "$$new_ver" | grep -q '^[0-9]'; then \ if printf "$$new_ver" | grep -q '^[0-9]'; then \

View File

@@ -1,31 +1,39 @@
# Node Version Manager [![Build Status](https://travis-ci.org/creationix/nvm.svg?branch=master)][3] [![nvm version](https://img.shields.io/badge/version-v0.33.0-yellow.svg)][4] # Node Version Manager [![Build Status](https://travis-ci.org/creationix/nvm.svg?branch=master)][3] [![nvm version](https://img.shields.io/badge/version-v0.33.2-yellow.svg)][4] [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/684/badge)](https://bestpractices.coreinfrastructure.org/projects/684)
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
## Table of Contents ## Table of Contents
- [Installation](#installation) - [Installation](#installation)
- [Install script](#install-script) - [Install script](#install-script)
- [Verify installation](#verify-installation) - [Verify installation](#verify-installation)
- [Manual install](#manual-install) - [Git install](#git-install)
- [Manual upgrade](#manual-upgrade) - [Manual Install](#manual-install)
- [Usage](#usage) - [Manual upgrade](#manual-upgrade)
- [Long-term support](#long-term-support) - [Usage](#usage)
- [Migrating global packages while installing](#migrating-global-packages-while-installing) - [Long-term support](#long-term-support)
- [io.js](#iojs) - [Migrating global packages while installing](#migrating-global-packages-while-installing)
- [System version of node](#system-version-of-node) - [io.js](#iojs)
- [Listing versions](#listing-versions) - [System version of node](#system-version-of-node)
- [.nvmrc](#nvmrc) - [Listing versions](#listing-versions)
- [Deeper Shell Integration](#deeper-shell-integration) - [.nvmrc](#nvmrc)
- [License](#license) - [Deeper Shell Integration](#deeper-shell-integration)
- [Running tests](#running-tests) - [zsh](#zsh)
- [Bash completion](#bash-completion) - [Calling `nvm use` automatically in a directory with a `.nvmrc` file](#calling-nvm-use-automatically-in-a-directory-with-a-nvmrc-file)
- [Usage](#usage-1) - [License](#license)
- [Compatibility Issues](#compatibility-issues) - [Running tests](#running-tests)
- [Installing nvm on Alpine Linux](#installing-nvm-on-alpine-linux) - [Bash completion](#bash-completion)
- [Problems](#problems) - [Usage](#usage-1)
- [Compatibility Issues](#compatibility-issues)
- [Installing nvm on Alpine Linux](#installing-nvm-on-alpine-linux)
- [Problems](#problems)
- [Mac OS "troubleshooting"](#mac-os-troubleshooting)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
## Installation ## Installation
First you'll need to make sure your system has a c++ compiler. For OS X, Xcode will work, for Ubuntu, the `build-essential` and `libssl-dev` packages work. If you're running a system without prepackaged binary available, which means you're going to install nodejs or io.js from its source code, you need to make sure your system has a C++ compiler. For OS X, Xcode will work, for Debian/Ubuntu based GNU/Linux, the `build-essential` and `libssl-dev` packages work.
**Note:** `nvm` does not support Windows (see [#284](https://github.com/creationix/nvm/issues/284)). Two alternatives exist, which are neither supported nor developed by us: **Note:** `nvm` does not support Windows (see [#284](https://github.com/creationix/nvm/issues/284)). Two alternatives exist, which are neither supported nor developed by us:
- [nvm-windows](https://github.com/coreybutler/nvm-windows) - [nvm-windows](https://github.com/coreybutler/nvm-windows)
@@ -35,11 +43,10 @@ First you'll need to make sure your system has a c++ compiler. For OS X, Xcode w
- [bass](https://github.com/edc/bass) allows you to use utilities written for Bash in fish shell - [bass](https://github.com/edc/bass) allows you to use utilities written for Bash in fish shell
- [fast-nvm-fish](https://github.com/brigand/fast-nvm-fish) only works with version numbers (not aliases) but doesn't significantly slow your shell startup - [fast-nvm-fish](https://github.com/brigand/fast-nvm-fish) only works with version numbers (not aliases) but doesn't significantly slow your shell startup
- [plugin-nvm](https://github.com/derekstavis/plugin-nvm) plugin for [Oh My Fish](https://github.com/oh-my-fish/oh-my-fish), which makes nvm and its completions available in fish shell - [plugin-nvm](https://github.com/derekstavis/plugin-nvm) plugin for [Oh My Fish](https://github.com/oh-my-fish/oh-my-fish), which makes nvm and its completions available in fish shell
- [fnm](https://github.com/fisherman/fnm) - [fisherman](https://github.com/fisherman/fisherman)-based version manager for fish
**Note:** We still have some problems with FreeBSD, because there is no official pre-built binary for FreeBSD, and building from source may need [patches](https://www.freshports.org/www/node/files/patch-deps_v8_src_base_platform_platform-posix.cc); see the issue ticket: **Note:** We still have some problems with FreeBSD, because there is no official pre-built binary for FreeBSD, and building from source may need [patches](https://www.freshports.org/www/node/files/patch-deps_v8_src_base_platform_platform-posix.cc); see the issue ticket:
- [[#900] [Bug] nodejs on FreeBSD need to be patched ](https://github.com/creationix/nvm/issues/900) - [[#900] [Bug] nodejs on FreeBSD may need to be patched ](https://github.com/creationix/nvm/issues/900)
- [nodejs/node#3716](https://github.com/nodejs/node/issues/3716) - [nodejs/node#3716](https://github.com/nodejs/node/issues/3716)
**Note:** On OS X, if you do not have Xcode installed and you do not wish to download the ~4.3GB file, you can install the `Command Line Tools`. You can check out this blog post on how to just that: **Note:** On OS X, if you do not have Xcode installed and you do not wish to download the ~4.3GB file, you can install the `Command Line Tools`. You can check out this blog post on how to just that:
@@ -54,20 +61,20 @@ Homebrew installation is not supported. If you have issues with homebrew-install
**Note:** If you're using `zsh` you can easily install `nvm` as a zsh plugin. Install [`zsh-nvm`](https://github.com/lukechilds/zsh-nvm) and run `nvm upgrade` to upgrade. **Note:** If you're using `zsh` you can easily install `nvm` as a zsh plugin. Install [`zsh-nvm`](https://github.com/lukechilds/zsh-nvm) and run `nvm upgrade` to upgrade.
**Note:** Git versions before v1.7 may face a problem of cloning nvm source from GitHub via https protocol, and there is also different behavior of git before v1.6, so the minimum required git version is v1.7.0 and we recommend v1.7.9.5 as it's the default version of the wildly used Ubuntu 12.04 LTS. If you are interested in the problem we mentioned here, please refer to GitHub's [HTTPS cloning errors](https://help.github.com/articles/https-cloning-errors/) article. **Note:** Git versions before v1.7 may face a problem of cloning nvm source from GitHub via https protocol, and there is also different behavior of git before v1.6, so the minimum required git version is v1.7.0 and we recommend v1.7.9.5 as it's the default version of the widely used Ubuntu 12.04 LTS. If you are interested in the problem we mentioned here, please refer to GitHub's [HTTPS cloning errors](https://help.github.com/articles/https-cloning-errors/) article.
### Install script ### Install script
To install or update nvm, you can use the [install script][2] using cURL: To install or update nvm, you can use the [install script][2] using cURL:
```sh ```sh
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
``` ```
or Wget: or Wget:
```sh ```sh
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
``` ```
<sub>The script clones the nvm repository to `~/.nvm` and adds the source line to your profile (`~/.bash_profile`, `~/.zshrc`, `~/.profile`, or `~/.bashrc`).</sub> <sub>The script clones the nvm repository to `~/.nvm` and adds the source line to your profile (`~/.bash_profile`, `~/.zshrc`, `~/.profile`, or `~/.bashrc`).</sub>
@@ -101,16 +108,27 @@ command -v nvm
which should output 'nvm' if the installation was successful. Please note that `which nvm` will not work, since `nvm` is a sourced shell function, not an executable binary. which should output 'nvm' if the installation was successful. Please note that `which nvm` will not work, since `nvm` is a sourced shell function, not an executable binary.
### Manual install ### Git install
For manual install create a folder somewhere in your filesystem with the `nvm.sh` file inside it. I put mine in `~/.nvm`. If you have `git` installed (requires git v1.7+):
Or if you have `git` installed (requires git v1.7+): 1. clone this repo in the root of your user profile
- `cd ~/` from anywhere then `git clone https://github.com/creationix/nvm.git .nvm`
1. clone this repo 1. check out the latest version with `git checkout v0.33.2`
1. check out the latest version
1. activate nvm by sourcing it from your shell 1. activate nvm by sourcing it from your shell
Now add these lines to your `~/.bashrc`, `~/.profile`, or `~/.zshrc` file to have it automatically sourced upon login:
(you may have to add to more than one of the above files)
```sh
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
```
### Manual Install
For a fully manual install, create a folder somewhere in your filesystem with the `nvm.sh` file inside it. I put mine in `~/.nvm` and added the following to the `nvm.sh` file.
```sh ```sh
export NVM_DIR="$HOME/.nvm" && ( export NVM_DIR="$HOME/.nvm" && (
git clone https://github.com/creationix/nvm.git "$NVM_DIR" git clone https://github.com/creationix/nvm.git "$NVM_DIR"
@@ -119,7 +137,7 @@ export NVM_DIR="$HOME/.nvm" && (
) && . "$NVM_DIR/nvm.sh" ) && . "$NVM_DIR/nvm.sh"
``` ```
Add these lines to your `~/.bashrc`, `~/.profile`, or `~/.zshrc` file to have it automatically sourced upon login: Now add these lines to your `~/.bashrc`, `~/.profile`, or `~/.zshrc` file to have it automatically sourced upon login:
(you may have to add to more than one of the above files) (you may have to add to more than one of the above files)
```sh ```sh
@@ -305,7 +323,7 @@ You can use [`avn`](https://github.com/wbyoung/avn) to deeply integrate into you
If you prefer a lighter-weight solution, the recipes below have been contributed by `nvm` users. They are **not** supported by the `nvm` development team. We are, however, accepting pull requests for more examples. If you prefer a lighter-weight solution, the recipes below have been contributed by `nvm` users. They are **not** supported by the `nvm` development team. We are, however, accepting pull requests for more examples.
#### Zsh #### zsh
##### Calling `nvm use` automatically in a directory with a `.nvmrc` file ##### Calling `nvm use` automatically in a directory with a `.nvmrc` file
@@ -322,8 +340,10 @@ load-nvmrc() {
if [ -n "$nvmrc_path" ]; then if [ -n "$nvmrc_path" ]; then
local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")") local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")
if [ "$nvmrc_node_version" != "N/A" ] && [ "$nvmrc_node_version" != "$node_version" ]; then if [ "$nvmrc_node_version" = "N/A" ]; then
nvm install nvm install
elif [ "$nvmrc_node_version" != "$node_version" ]; then
nvm use
fi fi
elif [ "$node_version" != "$(nvm version default)" ]; then elif [ "$node_version" != "$(nvm version default)" ]; then
echo "Reverting to nvm default version" echo "Reverting to nvm default version"
@@ -339,7 +359,7 @@ load-nvmrc
nvm is released under the MIT license. nvm is released under the MIT license.
Copyright (C) 2010-2016 Tim Caswell and Jordan Harband Copyright (C) 2010-2017 Tim Caswell and Jordan Harband
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
@@ -382,29 +402,35 @@ Put the above sourcing line just below the sourcing line for nvm in your profile
### Usage ### Usage
nvm: nvm:
> $ nvm <kbd>Tab</kbd>
$ nvm [tab][tab] ```
alias deactivate install ls run unload alias deactivate install ls run unload
clear-cache exec list ls-remote unalias use clear-cache exec list ls-remote unalias use
current help list-remote reinstall-packages uninstall version current help list-remote reinstall-packages uninstall version
```
nvm alias: nvm alias:
> $ nvm alias <kbd>Tab</kbd>
```
default
```
$ nvm alias [tab][tab] > $ nvm alias my_alias <kbd>Tab</kbd>
default ```
v0.6.21 v0.8.26 v0.10.28
$ nvm alias my_alias [tab][tab] ```
v0.6.21 v0.8.26 v0.10.28
nvm use: nvm use:
> $ nvm use <kbd>Tab</kbd>
$ nvm use [tab][tab] ```
my_alias default v0.6.21 v0.8.26 v0.10.28 my_alias default v0.6.21 v0.8.26 v0.10.28
```
nvm uninstall: nvm uninstall:
> $ nvm uninstall <kbd>Tab</kbd>
$ nvm uninstall [tab][tab] ```
my_alias default v0.6.21 v0.8.26 v0.10.28 my_alias default v0.6.21 v0.8.26 v0.10.28
```
## Compatibility Issues ## Compatibility Issues
`nvm` will encounter some issues if you have some non-default settings set. (see [#606](/../../issues/606)) `nvm` will encounter some issues if you have some non-default settings set. (see [#606](/../../issues/606))
@@ -435,7 +461,7 @@ If installing nvm on Alpine Linux *is* still what you want or need to do, you sh
```sh ```sh
apk add -U curl bash ca-certificates openssl ncurses coreutils python2 make gcc g++ libgcc linux-headers apk add -U curl bash ca-certificates openssl ncurses coreutils python2 make gcc g++ libgcc linux-headers
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
``` ```
The Node project has some desire but no concrete plans (due to the overheads of building, testing and support) to offer Alpine-compatible binaries. The Node project has some desire but no concrete plans (due to the overheads of building, testing and support) to offer Alpine-compatible binaries.
@@ -445,29 +471,35 @@ As a potential alternative, @mhart (a Node contributor) has some [Docker images
## Problems ## Problems
If you try to install a node version and the installation fails, be sure to delete the node downloads from src (~/.nvm/src/) or you might get an error when trying to reinstall them again or you might get an error like the following: - If you try to install a node version and the installation fails, be sure to delete the node downloads from src (~/.nvm/src/) or you might get an error when trying to reinstall them again or you might get an error like the following:
curl: (33) HTTP server doesn't seem to support byte ranges. Cannot resume. curl: (33) HTTP server doesn't seem to support byte ranges. Cannot resume.
Where's my 'sudo node'? Check out this link: - Where's my `sudo node`? Check out [#43](https://github.com/creationix/nvm/issues/43)
https://github.com/creationix/nvm/issues/43 - After the v0.8.6 release of node, nvm tries to install from binary packages. But in some systems, the official binary packages don't work due to incompatibility of shared libs. In such cases, use `-s` option to force install from source:
On Arch Linux and other systems using python3 by default, before running *install* you need to:
```sh ```sh
export PYTHON=python2 nvm install -s 0.8.6
``` ```
After the v0.8.6 release of node, nvm tries to install from binary packages. But in some systems, the official binary packages don't work due to incompatibility of shared libs. In such cases, use `-s` option to force install from source: - If setting the `default` alias does not establish the node version in new shells (i.e. `nvm current` yields `system`), ensure that the system's node PATH is set before the `nvm.sh` source line in your shell profile (see [#658](https://github.com/creationix/nvm/issues/658))
nvm install -s 0.8.6 ## Mac OS "troubleshooting"
If setting the `default` alias does not establish the node version in new shells (i.e. `nvm current` yields `system`), ensure that the system's node PATH is set before the `nvm.sh` source line in your shell profile (see [#658](https://github.com/creationix/nvm/issues/658)) **nvm node version not found in vim shell**
If you set node version to a version other than your system node version `nvm use 6.2.1` and open vim and run `:!node -v` you should see `v6.2.1` if you see your system version `v0.12.7`. You need to run:
```shell
sudo chmod ugo-x /usr/libexec/path_helper
```
More on this issue in [dotphiles/dotzsh](https://github.com/dotphiles/dotzsh#mac-os-x).
[1]: https://github.com/creationix/nvm.git [1]: https://github.com/creationix/nvm.git
[2]: https://github.com/creationix/nvm/blob/v0.33.0/install.sh [2]: https://github.com/creationix/nvm/blob/v0.33.2/install.sh
[3]: https://travis-ci.org/creationix/nvm [3]: https://travis-ci.org/creationix/nvm
[4]: https://github.com/creationix/nvm/releases/tag/v0.33.0 [4]: https://github.com/creationix/nvm/releases/tag/v0.33.2
[Urchin]: https://github.com/scraperwiki/urchin [Urchin]: https://github.com/scraperwiki/urchin
[Fish]: http://fishshell.com [Fish]: http://fishshell.com

View File

@@ -2,6 +2,10 @@
# bash completion for Node Version Manager (NVM) # bash completion for Node Version Manager (NVM)
if ! nvm &> /dev/null; then
return
fi
__nvm_generate_completion() __nvm_generate_completion()
{ {
declare current_word declare current_word
@@ -21,8 +25,8 @@ __nvm_commands ()
help install uninstall use run exec help install uninstall use run exec
alias unalias reinstall-packages alias unalias reinstall-packages
current list ls list-remote ls-remote current list ls list-remote ls-remote
clear-cache deactivate unload cache clear-cache deactivate unload
version which' version version-remote which'
if [ ${#COMP_WORDS[@]} == 4 ]; then if [ ${#COMP_WORDS[@]} == 4 ]; then
@@ -88,5 +92,5 @@ if [[ -n ${ZSH_VERSION-} ]]; then
autoload -U +X bashcompinit && bashcompinit autoload -U +X bashcompinit && bashcompinit
fi fi
complete -o default -o nospace -F __nvm nvm complete -o default -F __nvm nvm

View File

@@ -7,11 +7,24 @@ nvm_has() {
} }
nvm_install_dir() { nvm_install_dir() {
echo "${NVM_DIR:-"$HOME/.nvm"}" printf %s "${NVM_DIR:-"$HOME/.nvm"}"
} }
nvm_latest_version() { nvm_latest_version() {
echo "v0.33.0" echo "v0.33.2"
}
nvm_profile_is_bash_or_zsh() {
local TEST_PROFILE
TEST_PROFILE="${1-}"
case "${TEST_PROFILE-}" in
*"/.bashrc" | *"/.bash_profile" | *"/.zshrc")
return
;;
*)
return 1
;;
esac
} }
# #
@@ -49,11 +62,12 @@ nvm_node_version() {
nvm_download() { nvm_download() {
if nvm_has "curl"; then if nvm_has "curl"; then
curl -q "$@" curl --compressed -q "$@"
elif nvm_has "wget"; then elif nvm_has "wget"; then
# Emulate curl with wget # Emulate curl with wget
ARGS=$(echo "$*" | command sed -e 's/--progress-bar /--progress=bar /' \ ARGS=$(echo "$*" | command sed -e 's/--progress-bar /--progress=bar /' \
-e 's/-L //' \ -e 's/-L //' \
-e 's/--compressed //' \
-e 's/-I /--server-response /' \ -e 's/-I /--server-response /' \
-e 's/-s /-q /' \ -e 's/-s /-q /' \
-e 's/-o /-O /' \ -e 's/-o /-O /' \
@@ -112,7 +126,7 @@ install_nvm_from_git() {
echo "=> Compressing and cleaning up git repository" echo "=> Compressing and cleaning up git repository"
if ! command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" gc --aggressive --prune=now ; then if ! command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" gc --aggressive --prune=now ; then
echo >&2 "Your version of git is out of date. Please update it!" echo >&2 "Your version of git is out of date. Please update it!"
fi fi
return return
} }
@@ -158,17 +172,28 @@ install_nvm_as_script() {
nvm_download -s "$NVM_SOURCE_LOCAL" -o "$INSTALL_DIR/nvm.sh" || { nvm_download -s "$NVM_SOURCE_LOCAL" -o "$INSTALL_DIR/nvm.sh" || {
echo >&2 "Failed to download '$NVM_SOURCE_LOCAL'" echo >&2 "Failed to download '$NVM_SOURCE_LOCAL'"
return 1 return 1
} } &
nvm_download -s "$NVM_EXEC_SOURCE" -o "$INSTALL_DIR/nvm-exec" || { nvm_download -s "$NVM_EXEC_SOURCE" -o "$INSTALL_DIR/nvm-exec" || {
echo >&2 "Failed to download '$NVM_EXEC_SOURCE'" echo >&2 "Failed to download '$NVM_EXEC_SOURCE'"
return 2 return 2
} } &
for job in $(jobs -p | sort)
do
wait "$job" || return $?
done
chmod a+x "$INSTALL_DIR/nvm-exec" || { chmod a+x "$INSTALL_DIR/nvm-exec" || {
echo >&2 "Failed to mark '$INSTALL_DIR/nvm-exec' as executable" echo >&2 "Failed to mark '$INSTALL_DIR/nvm-exec' as executable"
return 3 return 3
} }
} }
nvm_try_profile() {
if [ -z "${1-}" ] || [ ! -f "${1}" ]; then
return 1
fi
echo "${1}"
}
# #
# Detect profile file if not specified as environment variable # Detect profile file if not specified as environment variable
# (eg: PROFILE=~/.myprofile) # (eg: PROFILE=~/.myprofile)
@@ -197,15 +222,12 @@ nvm_detect_profile() {
fi fi
if [ -z "$DETECTED_PROFILE" ]; then if [ -z "$DETECTED_PROFILE" ]; then
if [ -f "$HOME/.profile" ]; then for EACH_PROFILE in ".profile" ".bashrc" ".bash_profile" ".zshrc"
DETECTED_PROFILE="$HOME/.profile" do
elif [ -f "$HOME/.bashrc" ]; then if DETECTED_PROFILE="$(nvm_try_profile "${HOME}/${EACH_PROFILE}")"; then
DETECTED_PROFILE="$HOME/.bashrc" break
elif [ -f "$HOME/.bash_profile" ]; then fi
DETECTED_PROFILE="$HOME/.bash_profile" done
elif [ -f "$HOME/.zshrc" ]; then
DETECTED_PROFILE="$HOME/.zshrc"
fi
fi fi
if [ ! -z "$DETECTED_PROFILE" ]; then if [ ! -z "$DETECTED_PROFILE" ]; then
@@ -228,8 +250,7 @@ nvm_check_global_modules() {
local NPM_GLOBAL_MODULES local NPM_GLOBAL_MODULES
NPM_GLOBAL_MODULES="$( NPM_GLOBAL_MODULES="$(
npm list -g --depth=0 | npm list -g --depth=0 |
command sed '/ npm@/d' | command sed -e '/ npm@/d' -e '/ (empty)$/d'
command sed '/ (empty)$/d'
)" )"
local MODULE_COUNT local MODULE_COUNT
@@ -290,10 +311,10 @@ nvm_do_install() {
local NVM_PROFILE local NVM_PROFILE
NVM_PROFILE="$(nvm_detect_profile)" NVM_PROFILE="$(nvm_detect_profile)"
local INSTALL_DIR local PROFILE_INSTALL_DIR
INSTALL_DIR="$(nvm_install_dir)" PROFILE_INSTALL_DIR="$(nvm_install_dir| sed "s:^$HOME:\$HOME:")"
SOURCE_STR="\nexport NVM_DIR=\"$INSTALL_DIR\"\n[ -s \"\$NVM_DIR/nvm.sh\" ] && \\. \"\$NVM_DIR/nvm.sh\" # This loads nvm\n" SOURCE_STR="\nexport NVM_DIR=\"${PROFILE_INSTALL_DIR}\"\n[ -s \"\$NVM_DIR/nvm.sh\" ] && \\. \"\$NVM_DIR/nvm.sh\" # This loads nvm\n"
COMPLETION_STR="[ -s \"\$NVM_DIR/bash_completion\" ] && \\. \"\$NVM_DIR/bash_completion\" # This loads nvm bash_completion\n" COMPLETION_STR="[ -s \"\$NVM_DIR/bash_completion\" ] && \\. \"\$NVM_DIR/bash_completion\" # This loads nvm bash_completion\n"
BASH_OR_ZSH=false BASH_OR_ZSH=false
@@ -305,11 +326,9 @@ nvm_do_install() {
echo "=> Append the following lines to the correct file yourself:" echo "=> Append the following lines to the correct file yourself:"
command printf "${SOURCE_STR}" command printf "${SOURCE_STR}"
else else
case "${NVM_PROFILE-}" in if nvm_profile_is_bash_or_zsh "${NVM_PROFILE-}"; then
".bashrc" | ".bash_profile" | ".zshrc") BASH_OR_ZSH=true
BASH_OR_ZSH=true fi
;;
esac
if ! command grep -qc '/nvm.sh' "$NVM_PROFILE"; then if ! command grep -qc '/nvm.sh' "$NVM_PROFILE"; then
echo "=> Appending nvm source string to $NVM_PROFILE" echo "=> Appending nvm source string to $NVM_PROFILE"
command printf "${SOURCE_STR}" >> "$NVM_PROFILE" command printf "${SOURCE_STR}" >> "$NVM_PROFILE"
@@ -331,7 +350,7 @@ nvm_do_install() {
# Source nvm # Source nvm
# shellcheck source=/dev/null # shellcheck source=/dev/null
\. "${INSTALL_DIR}/nvm.sh" \. "$(nvm_install_dir)/nvm.sh"
nvm_check_global_modules nvm_check_global_modules
@@ -342,7 +361,7 @@ nvm_do_install() {
echo "=> Close and reopen your terminal to start using nvm or run the following to use it now:" echo "=> Close and reopen your terminal to start using nvm or run the following to use it now:"
command printf "${SOURCE_STR}" command printf "${SOURCE_STR}"
if ${BASH_OR_ZSH} ; then if ${BASH_OR_ZSH} ; then
command printf " && ${COMPLETION_STR}" command printf "${COMPLETION_STR}"
fi fi
} }
@@ -351,10 +370,10 @@ nvm_do_install() {
# during the execution of the install script # during the execution of the install script
# #
nvm_reset() { nvm_reset() {
unset -f nvm_reset nvm_has nvm_latest_version \ unset -f nvm_has nvm_install_dir nvm_latest_version nvm_profile_is_bash_or_zsh \
nvm_source nvm_download install_nvm_as_script install_nvm_from_git \ nvm_source nvm_node_version nvm_download install_nvm_from_git nvm_install_node \
nvm_detect_profile nvm_check_global_modules nvm_do_install \ install_nvm_as_script nvm_try_profile nvm_detect_profile nvm_check_global_modules \
nvm_install_dir nvm_node_version nvm_install_node nvm_do_install nvm_reset
} }
[ "_$NVM_ENV" = "_testing" ] || nvm_do_install [ "_$NVM_ENV" = "_testing" ] || nvm_do_install

372
nvm.sh Executable file → Normal file
View File

@@ -39,22 +39,54 @@ nvm_has() {
type "${1-}" > /dev/null 2>&1 type "${1-}" > /dev/null 2>&1
} }
nvm_has_non_aliased() {
nvm_has "${1-}" && ! nvm_is_alias "${1-}"
}
nvm_is_alias() { nvm_is_alias() {
# this is intentionally not "command alias" so it works in zsh. # this is intentionally not "command alias" so it works in zsh.
# shellcheck disable=SC1001 # shellcheck disable=SC1001
\alias "${1-}" > /dev/null 2>&1 \alias "${1-}" > /dev/null 2>&1
} }
nvm_command_info() {
local COMMAND
local INFO
COMMAND="${1}"
if type "${COMMAND}" | command grep -q hashed; then
INFO="$(type "${COMMAND}" | command sed -E 's/\(|)//g' | command awk '{print $4}')"
elif type "${COMMAND}" | command grep -q aliased; then
INFO="$(which "${COMMAND}") ($(type "${COMMAND}" | command awk '{ $1=$2=$3=$4="" ;print }' | command sed -e 's/^\ *//g' -Ee "s/\`|'//g" ))"
elif type "${COMMAND}" | command grep -q "^${COMMAND} is an alias for"; then
INFO="$(which "${COMMAND}") ($(type "${COMMAND}" | command awk '{ $1=$2=$3=$4=$5="" ;print }' | command sed 's/^\ *//g'))"
elif type "${COMMAND}" | command grep -q "^${COMMAND} is \/"; then
INFO="$(type "${COMMAND}" | command awk '{print $3}')"
else
INFO="$(type "${COMMAND}")"
fi
nvm_echo "${INFO}"
}
nvm_has_colors() { nvm_has_colors() {
local NVM_COLORS local NVM_COLORS
NVM_COLORS="$(tput -T "${TERM:-vt100}" colors)" if nvm_has tput; then
NVM_COLORS="$(tput -T "${TERM:-vt100}" colors)"
fi
[ "${NVM_COLORS:--1}" -ge 8 ] [ "${NVM_COLORS:--1}" -ge 8 ]
} }
nvm_curl_libz_support() {
curl -V 2>/dev/null | nvm_grep "^Features:" | nvm_grep -q "libz"
}
nvm_get_latest() { nvm_get_latest() {
local NVM_LATEST_URL local NVM_LATEST_URL
local CURL_COMPRESSED_FLAG
if nvm_has "curl"; then if nvm_has "curl"; then
NVM_LATEST_URL="$(curl -q -w "%{url_effective}\n" -L -s -S http://latest.nvm.sh -o /dev/null)" if nvm_curl_libz_support; then
CURL_COMPRESSED_FLAG="--compressed"
fi
NVM_LATEST_URL="$(curl "${CURL_COMPRESSED_FLAG:-}" -q -w "%{url_effective}\n" -L -s -S http://latest.nvm.sh -o /dev/null)"
elif nvm_has "wget"; then elif nvm_has "wget"; then
NVM_LATEST_URL="$(wget http://latest.nvm.sh --server-response -O /dev/null 2>&1 | command awk '/^ Location: /{DEST=$2} END{ print DEST }')" NVM_LATEST_URL="$(wget http://latest.nvm.sh --server-response -O /dev/null 2>&1 | command awk '/^ Location: /{DEST=$2} END{ print DEST }')"
else else
@@ -62,18 +94,23 @@ nvm_get_latest() {
return 1 return 1
fi fi
if [ -z "${NVM_LATEST_URL}" ]; then if [ -z "${NVM_LATEST_URL}" ]; then
nvm_err "http://latest.nvm.sh did not redirect to the latest release on Github" nvm_err "http://latest.nvm.sh did not redirect to the latest release on GitHub"
return 2 return 2
fi fi
nvm_echo "${NVM_LATEST_URL##*/}" nvm_echo "${NVM_LATEST_URL##*/}"
} }
nvm_download() { nvm_download() {
local CURL_COMPRESSED_FLAG
if nvm_has "curl"; then if nvm_has "curl"; then
curl -q "$@" if nvm_curl_libz_support; then
CURL_COMPRESSED_FLAG="--compressed"
fi
curl "${CURL_COMPRESSED_FLAG:-}" -q "$@"
elif nvm_has "wget"; then elif nvm_has "wget"; then
# Emulate curl with wget # Emulate curl with wget
ARGS=$(nvm_echo "$@" | command sed -e 's/--progress-bar /--progress=bar /' \ ARGS=$(nvm_echo "$@" | command sed -e 's/--progress-bar /--progress=bar /' \
-e 's/--compressed //' \
-e 's/-L //' \ -e 's/-L //' \
-e 's/-I /--server-response /' \ -e 's/-I /--server-response /' \
-e 's/-s /-q /' \ -e 's/-s /-q /' \
@@ -125,16 +162,6 @@ if [ -z "${NVM_DIR-}" ]; then
fi fi
unset NVM_SCRIPT_SOURCE 2> /dev/null unset NVM_SCRIPT_SOURCE 2> /dev/null
# Setup mirror location if not already set
if [ -z "${NVM_NODEJS_ORG_MIRROR-}" ]; then
export NVM_NODEJS_ORG_MIRROR="https://nodejs.org/dist"
fi
if [ -z "${NVM_IOJS_ORG_MIRROR-}" ]; then
export NVM_IOJS_ORG_MIRROR="https://iojs.org/dist"
fi
nvm_tree_contains_path() { nvm_tree_contains_path() {
local tree local tree
tree="${1-}" tree="${1-}"
@@ -178,18 +205,16 @@ nvm_rc_version() {
export NVM_RC_VERSION='' export NVM_RC_VERSION=''
local NVMRC_PATH local NVMRC_PATH
NVMRC_PATH="$(nvm_find_nvmrc)" NVMRC_PATH="$(nvm_find_nvmrc)"
if [ -e "${NVMRC_PATH}" ]; then if [ ! -e "${NVMRC_PATH}" ]; then
read -r NVM_RC_VERSION < "${NVMRC_PATH}" || printf ''
if [ -n "${NVM_RC_VERSION}" ]; then
nvm_echo "Found '${NVMRC_PATH}' with version <${NVM_RC_VERSION}>"
else
nvm_err "Warning: empty .nvmrc file found at \"${NVMRC_PATH}\""
return 2
fi
else
nvm_err "No .nvmrc file found" nvm_err "No .nvmrc file found"
return 1 return 1
fi fi
read -r NVM_RC_VERSION < "${NVMRC_PATH}" || printf ''
if [ ! -n "${NVM_RC_VERSION}" ]; then
nvm_err "Warning: empty .nvmrc file found at \"${NVMRC_PATH}\""
return 2
fi
nvm_echo "Found '${NVMRC_PATH}' with version <${NVM_RC_VERSION}>"
} }
nvm_clang_version() { nvm_clang_version() {
@@ -262,6 +287,13 @@ nvm_version_path() {
nvm_ensure_version_installed() { nvm_ensure_version_installed() {
local PROVIDED_VERSION local PROVIDED_VERSION
PROVIDED_VERSION="${1-}" PROVIDED_VERSION="${1-}"
if [ "${PROVIDED_VERSION}" = 'system' ]; then
if nvm_has_system_iojs || nvm_has_system_node; then
return 0
fi
nvm_err "N/A: no system version of node/io.js is installed."
return 1
fi
local LOCAL_VERSION local LOCAL_VERSION
local EXIT_CODE local EXIT_CODE
LOCAL_VERSION="$(nvm_version "${PROVIDED_VERSION}")" LOCAL_VERSION="$(nvm_version "${PROVIDED_VERSION}")"
@@ -270,15 +302,13 @@ nvm_ensure_version_installed() {
if [ "${EXIT_CODE}" != "0" ] || ! nvm_is_version_installed "${LOCAL_VERSION}"; then if [ "${EXIT_CODE}" != "0" ] || ! nvm_is_version_installed "${LOCAL_VERSION}"; then
if VERSION="$(nvm_resolve_alias "${PROVIDED_VERSION}")"; then if VERSION="$(nvm_resolve_alias "${PROVIDED_VERSION}")"; then
nvm_err "N/A: version \"${PROVIDED_VERSION} -> ${VERSION}\" is not yet installed." nvm_err "N/A: version \"${PROVIDED_VERSION} -> ${VERSION}\" is not yet installed."
nvm_err ""
nvm_err "You need to run \"nvm install ${PROVIDED_VERSION}\" to install it before using it."
else else
local PREFIXED_VERSION local PREFIXED_VERSION
PREFIXED_VERSION="$(nvm_ensure_version_prefix "${PROVIDED_VERSION}")" PREFIXED_VERSION="$(nvm_ensure_version_prefix "${PROVIDED_VERSION}")"
nvm_err "N/A: version \"${PREFIXED_VERSION:-$PROVIDED_VERSION}\" is not yet installed." nvm_err "N/A: version \"${PREFIXED_VERSION:-$PROVIDED_VERSION}\" is not yet installed."
nvm_err ""
nvm_err "You need to run \"nvm install ${PROVIDED_VERSION}\" to install it before using it."
fi fi
nvm_err ""
nvm_err "You need to run \"nvm install ${PROVIDED_VERSION}\" to install it before using it."
return 1 return 1
fi fi
} }
@@ -309,9 +339,8 @@ nvm_version() {
if [ -z "${VERSION}" ] || [ "_${VERSION}" = "_N/A" ]; then if [ -z "${VERSION}" ] || [ "_${VERSION}" = "_N/A" ]; then
nvm_echo "N/A" nvm_echo "N/A"
return 3; return 3;
else
nvm_echo "${VERSION}"
fi fi
nvm_echo "${VERSION}"
} }
nvm_remote_version() { nvm_remote_version() {
@@ -699,8 +728,7 @@ nvm_resolve_alias() {
break break
fi fi
if [ -n "${ALIAS_TEMP}" ] \ if command printf "${SEEN_ALIASES}" | nvm_grep -e "^${ALIAS_TEMP}$" > /dev/null; then
&& command printf "${SEEN_ALIASES}" | nvm_grep -e "^${ALIAS_TEMP}$" > /dev/null; then
ALIAS="∞" ALIAS="∞"
break break
fi fi
@@ -779,7 +807,7 @@ nvm_strip_iojs_prefix() {
if [ "${1-}" = "${NVM_IOJS_PREFIX}" ]; then if [ "${1-}" = "${NVM_IOJS_PREFIX}" ]; then
nvm_echo nvm_echo
else else
nvm_echo "${1#"${NVM_IOJS_PREFIX}"-}" nvm_echo "${1#${NVM_IOJS_PREFIX}-}"
fi fi
} }
@@ -898,7 +926,7 @@ nvm_ls() {
fi fi
if [ -n "${NVM_DIRS_TO_SEARCH1}${NVM_DIRS_TO_SEARCH2}${NVM_DIRS_TO_SEARCH3}" ]; then if [ -n "${NVM_DIRS_TO_SEARCH1}${NVM_DIRS_TO_SEARCH2}${NVM_DIRS_TO_SEARCH3}" ]; then
VERSIONS="$(command find "${NVM_DIRS_TO_SEARCH1}"/* "${NVM_DIRS_TO_SEARCH2}"/* "${NVM_DIRS_TO_SEARCH3}"/* -name . -o -type d -prune -o -path "${PATTERN}*" \ VERSIONS="$(command find "${NVM_DIRS_TO_SEARCH1}"/* "${NVM_DIRS_TO_SEARCH2}"/* "${NVM_DIRS_TO_SEARCH3}"/* -name . -o -type d -prune -o -path "${PATTERN}*" \
| command sed " | command sed -e "
s#${NVM_VERSION_DIR_IOJS}/#versions/${NVM_IOJS_PREFIX}/#; s#${NVM_VERSION_DIR_IOJS}/#versions/${NVM_IOJS_PREFIX}/#;
s#^${NVM_DIR}/##; s#^${NVM_DIR}/##;
\#^[^v]# d; \#^[^v]# d;
@@ -907,7 +935,7 @@ nvm_ls() {
s#^v#${NVM_NODE_PREFIX}/v#; s#^v#${NVM_NODE_PREFIX}/v#;
\#${SEARCH_PATTERN}# !d; \#${SEARCH_PATTERN}# !d;
" \ " \
| command sed "s#^\([^/]\{1,\}\)/\(.*\)\$#\2.\1#;" \ -e "s#^\([^/]\{1,\}\)/\(.*\)\$#\2.\1#;" \
| command sort -t. -u -k 1.2,1n -k 2,2n -k 3,3n \ | command sort -t. -u -k 1.2,1n -k 2,2n -k 3,3n \
| command sed " | command sed "
s#\(.*\)\.\([^\.]\{1,\}\)\$#\2-\1#; s#\(.*\)\.\([^\.]\{1,\}\)\$#\2-\1#;
@@ -941,7 +969,7 @@ nvm_ls_remote() {
local PATTERN local PATTERN
PATTERN="${1-}" PATTERN="${1-}"
if nvm_validate_implicit_alias "${PATTERN}" 2> /dev/null ; then if nvm_validate_implicit_alias "${PATTERN}" 2> /dev/null ; then
PATTERN="$(NVM_LTS="${NVM_LTS-}" nvm_ls_remote "$(nvm_print_implicit_alias remote "${PATTERN}")" | command awk '{ print $1 }' | command tail -1)" PATTERN="$(NVM_LTS="${NVM_LTS-}" nvm_ls_remote "$(nvm_print_implicit_alias remote "${PATTERN}")" | command tail -1 | command awk '{ print $1 }')"
elif [ -n "${PATTERN}" ]; then elif [ -n "${PATTERN}" ]; then
PATTERN="$(nvm_ensure_version_prefix "${PATTERN}")" PATTERN="$(nvm_ensure_version_prefix "${PATTERN}")"
else else
@@ -1067,28 +1095,26 @@ nvm_ls_remote_index_tab() {
} }
nvm_get_checksum_alg() { nvm_get_checksum_alg() {
if nvm_has "sha256sum" && ! nvm_is_alias "sha256sum"; then if nvm_has_non_aliased "sha256sum"; then
nvm_echo 'sha-256' nvm_echo 'sha-256'
elif nvm_has "shasum" && ! nvm_is_alias "shasum"; then elif nvm_has_non_aliased "shasum"; then
nvm_echo 'sha-256' nvm_echo 'sha-256'
elif nvm_has "sha256" && ! nvm_is_alias "sha256"; then elif nvm_has_non_aliased "sha256"; then
nvm_echo 'sha-256' nvm_echo 'sha-256'
elif nvm_has "gsha256sum" && ! nvm_is_alias "gsha256sum"; then elif nvm_has_non_aliased "gsha256sum"; then
nvm_echo 'sha-256' nvm_echo 'sha-256'
elif nvm_has "openssl" && ! nvm_is_alias "openssl"; then elif nvm_has_non_aliased "openssl"; then
nvm_echo 'sha-256' nvm_echo 'sha-256'
elif nvm_has "libressl" && ! nvm_is_alias "libressl"; then elif nvm_has_non_aliased "bssl"; then
nvm_echo 'sha-256' nvm_echo 'sha-256'
elif nvm_has "bssl" && ! nvm_is_alias "bssl"; then elif nvm_has_non_aliased "sha1sum"; then
nvm_echo 'sha-256'
elif nvm_has "sha1sum" && ! nvm_is_alias "sha1sum"; then
nvm_echo 'sha-1' nvm_echo 'sha-1'
elif nvm_has "sha1" && ! nvm_is_alias "sha1"; then elif nvm_has_non_aliased "sha1"; then
nvm_echo 'sha-1' nvm_echo 'sha-1'
elif nvm_has "shasum" && ! nvm_is_alias "shasum"; then elif nvm_has_non_aliased "shasum"; then
nvm_echo 'sha-1' nvm_echo 'sha-1'
else else
nvm_err 'Unaliased sha256sum, shasum, sha256, gsha256sum, openssl, libressl, or bssl not found.' nvm_err 'Unaliased sha256sum, shasum, sha256, gsha256sum, openssl, or bssl not found.'
nvm_err 'Unaliased sha1sum, sha1, or shasum not found.' nvm_err 'Unaliased sha1sum, sha1, or shasum not found.'
return 1 return 1
fi fi
@@ -1105,34 +1131,31 @@ nvm_compute_checksum() {
return 1 return 1
fi fi
if nvm_has "sha256sum" && ! nvm_is_alias "sha256sum"; then if nvm_has_non_aliased "sha256sum"; then
nvm_err 'Computing checksum with sha256sum' nvm_err 'Computing checksum with sha256sum'
command sha256sum "${FILE}" | command awk '{print $1}' command sha256sum "${FILE}" | command awk '{print $1}'
elif nvm_has "shasum" && ! nvm_is_alias "shasum"; then elif nvm_has_non_aliased "shasum"; then
nvm_err 'Computing checksum with shasum -a 256' nvm_err 'Computing checksum with shasum -a 256'
command shasum -a 256 "${FILE}" | command awk '{print $1}' command shasum -a 256 "${FILE}" | command awk '{print $1}'
elif nvm_has "sha256" && ! nvm_is_alias "sha256"; then elif nvm_has_non_aliased "sha256"; then
nvm_err 'Computing checksum with sha256 -q' nvm_err 'Computing checksum with sha256 -q'
command sha256 -q "${FILE}" | command awk '{print $1}' command sha256 -q "${FILE}" | command awk '{print $1}'
elif nvm_has "gsha256sum" && ! nvm_is_alias "gsha256sum"; then elif nvm_has_non_aliased "gsha256sum"; then
nvm_err 'Computing checksum with gsha256sum' nvm_err 'Computing checksum with gsha256sum'
command gsha256sum "${FILE}" | command awk '{print $1}' command gsha256sum "${FILE}" | command awk '{print $1}'
elif nvm_has "openssl" && ! nvm_is_alias "openssl"; then elif nvm_has_non_aliased "openssl"; then
nvm_err 'Computing checksum with openssl dgst -sha256' nvm_err 'Computing checksum with openssl dgst -sha256'
command openssl dgst -sha256 "${FILE}" | rev | command awk '{print $1}' | rev command openssl dgst -sha256 "${FILE}" | command awk '{print $NF}'
elif nvm_has "libressl" && ! nvm_is_alias "libressl"; then elif nvm_has_non_aliased "bssl"; then
nvm_err 'Computing checksum with libressl dgst -sha256'
command libressl dgst -sha256 "${FILE}" | rev | command awk '{print $1}' | rev
elif nvm_has "bssl" && ! nvm_is_alias "bssl"; then
nvm_err 'Computing checksum with bssl sha256sum' nvm_err 'Computing checksum with bssl sha256sum'
command bssl sha256sum "${FILE}" | command awk '{print $1}' command bssl sha256sum "${FILE}" | command awk '{print $1}'
elif nvm_has "sha1sum" && ! nvm_is_alias "sha1sum"; then elif nvm_has_non_aliased "sha1sum"; then
nvm_err 'Computing checksum with sha1sum' nvm_err 'Computing checksum with sha1sum'
command sha1sum "${FILE}" | command awk '{print $1}' command sha1sum "${FILE}" | command awk '{print $1}'
elif nvm_has "sha1" && ! nvm_is_alias "sha1"; then elif nvm_has_non_aliased "sha1"; then
nvm_err 'Computing checksum with sha1 -q' nvm_err 'Computing checksum with sha1 -q'
command sha1 -q "${FILE}" command sha1 -q "${FILE}"
elif nvm_has "shasum" && ! nvm_is_alias "shasum"; then elif nvm_has_non_aliased "shasum"; then
nvm_err 'Computing checksum with shasum' nvm_err 'Computing checksum with shasum'
command shasum "${FILE}" | command awk '{print $1}' command shasum "${FILE}" | command awk '{print $1}'
fi fi
@@ -1194,41 +1217,37 @@ nvm_get_checksum() {
SHASUMS_URL="${MIRROR}/${3}/SHASUMS.txt" SHASUMS_URL="${MIRROR}/${3}/SHASUMS.txt"
fi fi
nvm_download -L -s "${SHASUMS_URL}" -o - | \ nvm_download -L -s "${SHASUMS_URL}" -o - | command awk "{ if (\"${4}.tar.${5}\" == \$2) print \$1}"
nvm_grep "${4}.tar.${5}" | \
command awk '{print $1}'
} }
nvm_checksum() { nvm_checksum() {
local NVM_CHECKSUM local NVM_CHECKSUM
if [ -z "${3-}" ] || [ "${3-}" = 'sha1' ]; then if [ -z "${3-}" ] || [ "${3-}" = 'sha1' ]; then
if nvm_has "sha1sum" && ! nvm_is_alias "sha1sum"; then if nvm_has_non_aliased "sha1sum"; then
NVM_CHECKSUM="$(command sha1sum "${1-}" | command awk '{print $1}')" NVM_CHECKSUM="$(command sha1sum "${1-}" | command awk '{print $1}')"
elif nvm_has "sha1" && ! nvm_is_alias "sha1"; then elif nvm_has_non_aliased "sha1"; then
NVM_CHECKSUM="$(command sha1 -q "${1-}")" NVM_CHECKSUM="$(command sha1 -q "${1-}")"
elif nvm_has "shasum" && ! nvm_is_alias "shasum"; then elif nvm_has_non_aliased "shasum"; then
NVM_CHECKSUM="$(command shasum "${1-}" | command awk '{print $1}')" NVM_CHECKSUM="$(command shasum "${1-}" | command awk '{print $1}')"
else else
nvm_err 'Unaliased sha1sum, sha1, or shasum not found.' nvm_err 'Unaliased sha1sum, sha1, or shasum not found.'
return 2 return 2
fi fi
else else
if nvm_has "sha256sum" && ! nvm_is_alias "sha256sum"; then if nvm_has_non_aliased "sha256sum"; then
NVM_CHECKSUM="$(command sha256sum "${1-}" | command awk '{print $1}')" NVM_CHECKSUM="$(command sha256sum "${1-}" | command awk '{print $1}')"
elif nvm_has "shasum" && ! nvm_is_alias "shasum"; then elif nvm_has_non_aliased "shasum"; then
NVM_CHECKSUM="$(command shasum -a 256 "${1-}" | command awk '{print $1}')" NVM_CHECKSUM="$(command shasum -a 256 "${1-}" | command awk '{print $1}')"
elif nvm_has "sha256" && ! nvm_is_alias "sha256"; then elif nvm_has_non_aliased "sha256"; then
NVM_CHECKSUM="$(command sha256 -q "${1-}" | command awk '{print $1}')" NVM_CHECKSUM="$(command sha256 -q "${1-}" | command awk '{print $1}')"
elif nvm_has "gsha256sum" && ! nvm_is_alias "gsha256sum"; then elif nvm_has_non_aliased "gsha256sum"; then
NVM_CHECKSUM="$(command gsha256sum "${1-}" | command awk '{print $1}')" NVM_CHECKSUM="$(command gsha256sum "${1-}" | command awk '{print $1}')"
elif nvm_has "openssl" && ! nvm_is_alias "openssl"; then elif nvm_has_non_aliased "openssl"; then
NVM_CHECKSUM="$(command openssl dgst -sha256 "${1-}" | rev | command awk '{print $1}' | rev)" NVM_CHECKSUM="$(command openssl dgst -sha256 "${1-}" | command awk '{print $NF}')"
elif nvm_has "libressl" && ! nvm_is_alias "libressl"; then elif nvm_has_non_aliased "bssl"; then
NVM_CHECKSUM="$(command libressl dgst -sha256 "${1-}" | rev | command awk '{print $1}' | rev)"
elif nvm_has "bssl" && ! nvm_is_alias "bssl"; then
NVM_CHECKSUM="$(command bssl sha256sum "${1-}" | command awk '{print $1}')" NVM_CHECKSUM="$(command bssl sha256sum "${1-}" | command awk '{print $1}')"
else else
nvm_err 'Unaliased sha256sum, shasum, sha256, gsha256sum, openssl, libressl, or bssl not found.' nvm_err 'Unaliased sha256sum, shasum, sha256, gsha256sum, openssl, or bssl not found.'
nvm_err 'WARNING: Continuing *without checksum verification*' nvm_err 'WARNING: Continuing *without checksum verification*'
return return
fi fi
@@ -1239,10 +1258,9 @@ nvm_checksum() {
elif [ -z "${2-}" ]; then elif [ -z "${2-}" ]; then
nvm_echo 'Checksums empty' #missing in raspberry pi binary nvm_echo 'Checksums empty' #missing in raspberry pi binary
return return
else
nvm_err 'Checksums do not match.'
return 1
fi fi
nvm_err 'Checksums do not match.'
return 1
} }
nvm_print_versions() { nvm_print_versions() {
@@ -1518,8 +1536,7 @@ nvm_ensure_default_set() {
if [ -z "$VERSION" ]; then if [ -z "$VERSION" ]; then
nvm_err 'nvm_ensure_default_set: a version is required' nvm_err 'nvm_ensure_default_set: a version is required'
return 1 return 1
fi elif nvm_alias default >/dev/null 2>&1; then
if nvm_alias default >/dev/null 2>&1; then
# default already set # default already set
return 0 return 0
fi fi
@@ -1537,8 +1554,8 @@ nvm_is_merged_node_version() {
nvm_get_mirror() { nvm_get_mirror() {
case "${1}-${2}" in case "${1}-${2}" in
node-std) nvm_echo "${NVM_NODEJS_ORG_MIRROR}" ;; node-std) nvm_echo "${NVM_NODEJS_ORG_MIRROR:-https://nodejs.org/dist}" ;;
iojs-std) nvm_echo "${NVM_IOJS_ORG_MIRROR}" ;; iojs-std) nvm_echo "${NVM_IOJS_ORG_MIRROR:-https://iojs.org/dist}" ;;
*) *)
nvm_err 'unknown type of node.js or io.js release' nvm_err 'unknown type of node.js or io.js release'
return 1 return 1
@@ -1841,7 +1858,11 @@ nvm_install_source() {
local NVM_ARCH local NVM_ARCH
NVM_ARCH="$(nvm_get_arch)" NVM_ARCH="$(nvm_get_arch)"
if [ "${NVM_ARCH}" = 'armv6l' ] || [ "${NVM_ARCH}" = 'armv7l' ]; then if [ "${NVM_ARCH}" = 'armv6l' ] || [ "${NVM_ARCH}" = 'armv7l' ]; then
ADDITIONAL_PARAMETERS="--without-snapshot ${ADDITIONAL_PARAMETERS}" if [ -n "${ADDITIONAL_PARAMETERS}" ]; then
ADDITIONAL_PARAMETERS="--without-snapshot ${ADDITIONAL_PARAMETERS}"
else
ADDITIONAL_PARAMETERS='--without-snapshot'
fi
fi fi
if [ -n "${ADDITIONAL_PARAMETERS}" ]; then if [ -n "${ADDITIONAL_PARAMETERS}" ]; then
@@ -1868,7 +1889,7 @@ nvm_install_source() {
esac esac
if nvm_has "clang++" && nvm_has "clang" && nvm_version_greater_than_or_equal_to nvm_clang_version 3.5; then if nvm_has "clang++" && nvm_has "clang" && nvm_version_greater_than_or_equal_to nvm_clang_version 3.5; then
if [ -z "${CC-}" ] || [ -z "${CXX-}" ] ; then if [ -z "${CC-}" ] || [ -z "${CXX-}" ] ; then
nvm_echo "Clang v3.5+ detected! CC or CXX not specified, will use Clang as c/c++ compiler!" nvm_echo "Clang v3.5+ detected! CC or CXX not specified, will use Clang as C/C++ compiler!"
MAKE_CXX="CC=${CC:-cc} CXX=${CXX:-c++}" MAKE_CXX="CC=${CC:-cc} CXX=${CXX:-c++}"
fi fi
fi fi
@@ -1892,37 +1913,49 @@ nvm_install_source() {
TARBALL="$(nvm_download_artifact "${FLAVOR}" source "${TYPE}" "${VERSION}" | command tail -1)" && \ TARBALL="$(nvm_download_artifact "${FLAVOR}" source "${TYPE}" "${VERSION}" | command tail -1)" && \
[ -f "${TARBALL}" ] && \ [ -f "${TARBALL}" ] && \
TMPDIR="$(dirname "${TARBALL}")/files" && \ TMPDIR="$(dirname "${TARBALL}")/files" && \
if ( if ! (
# shellcheck disable=SC2086 # shellcheck disable=SC2086
command mkdir -p "${TMPDIR}" && \ command mkdir -p "${TMPDIR}" && \
command "${tar}" -x${tar_compression_flag}f "${TARBALL}" -C "${TMPDIR}" --strip-components 1 && \ command "${tar}" -x${tar_compression_flag}f "${TARBALL}" -C "${TMPDIR}" --strip-components 1 && \
VERSION_PATH="$(nvm_version_path "${PREFIXED_VERSION}")" && \ VERSION_PATH="$(nvm_version_path "${PREFIXED_VERSION}")" && \
nvm_cd "${TMPDIR}" && \ nvm_cd "${TMPDIR}" && \
nvm_echo '$>'./configure --prefix="${VERSION_PATH}" $ADDITIONAL_PARAMETERS'<' && \
./configure --prefix="${VERSION_PATH}" $ADDITIONAL_PARAMETERS && \ ./configure --prefix="${VERSION_PATH}" $ADDITIONAL_PARAMETERS && \
$make -j "${NVM_MAKE_JOBS}" ${MAKE_CXX-} && \ $make -j "${NVM_MAKE_JOBS}" ${MAKE_CXX-} && \
command rm -f "${VERSION_PATH}" 2>/dev/null && \ command rm -f "${VERSION_PATH}" 2>/dev/null && \
$make -j "${NVM_MAKE_JOBS}" ${MAKE_CXX-} install $make -j "${NVM_MAKE_JOBS}" ${MAKE_CXX-} install
); then ); then
if ! nvm_has "npm" ; then nvm_err "nvm: install ${VERSION} failed!"
nvm_echo 'Installing npm...' command rm -rf "${TMPDIR-}"
if nvm_version_greater 0.2.0 "$VERSION"; then return 1
nvm_err 'npm requires node v0.2.3 or higher'
elif nvm_version_greater_than_or_equal_to "$VERSION" 0.2.0; then
if nvm_version_greater 0.2.3 "$VERSION"; then
nvm_err 'npm requires node v0.2.3 or higher'
else
nvm_download -L https://npmjs.org/install.sh -o - | clean=yes npm_install=0.2.19 sh
fi
else
nvm_download -L https://npmjs.org/install.sh -o - | clean=yes sh
fi
fi
return $?
fi fi
}
nvm_err "nvm: install ${VERSION} failed!" nvm_use_if_needed() {
command rm -rf "${TMPDIR-}" if [ "_${1-}" = "_$(nvm_ls_current)" ]; then
return 1 return
fi
nvm use "$@"
}
nvm_install_npm_if_needed() {
local VERSION
VERSION="$(nvm_ls_current)"
if ! nvm_has "npm"; then
nvm_echo 'Installing npm...'
if nvm_version_greater 0.2.0 "$VERSION"; then
nvm_err 'npm requires node v0.2.3 or higher'
elif nvm_version_greater_than_or_equal_to "$VERSION" 0.2.0; then
if nvm_version_greater 0.2.3 "$VERSION"; then
nvm_err 'npm requires node v0.2.3 or higher'
else
nvm_download -L https://npmjs.org/install.sh -o - | clean=yes npm_install=0.2.19 sh
fi
else
nvm_download -L https://npmjs.org/install.sh -o - | clean=yes sh
fi
fi
return $?
} }
nvm_match_version() { nvm_match_version() {
@@ -1991,9 +2024,7 @@ nvm_die_on_prefix() {
nvm_err "nvm is not compatible with the \"NPM_CONFIG_PREFIX\" environment variable: currently set to \"$NPM_CONFIG_PREFIX\"" nvm_err "nvm is not compatible with the \"NPM_CONFIG_PREFIX\" environment variable: currently set to \"$NPM_CONFIG_PREFIX\""
nvm_err 'Run `unset NPM_CONFIG_PREFIX` to unset it.' nvm_err 'Run `unset NPM_CONFIG_PREFIX` to unset it.'
return 4 return 4
fi elif ! nvm_has 'npm'; then
if ! nvm_has 'npm'; then
return return
fi fi
@@ -2101,20 +2132,20 @@ nvm_check_file_permissions() {
setopt nonomatch setopt nonomatch
fi fi
for FILE in $1/* $1/.[!.]* $1/..?* ; do for FILE in $1/* $1/.[!.]* $1/..?* ; do
if [ -d "$FILE" ]; then if [ -d "$FILE" ]; then
if ! nvm_check_file_permissions "$FILE"; then if ! nvm_check_file_permissions "$FILE"; then
if [ "${ZSH_HAS_NONOMATCH_UNSET}" -eq 1 ] && nvm_has "setopt"; then
setopt nomatch
fi
return 2
fi
elif [ -e "$FILE" ] && [ ! -w "$FILE" ] && [ ! -O "$FILE" ]; then
nvm_err "file is not writable or self-owned: $(nvm_sanitize_path "$FILE")"
if [ "${ZSH_HAS_NONOMATCH_UNSET}" -eq 1 ] && nvm_has "setopt"; then if [ "${ZSH_HAS_NONOMATCH_UNSET}" -eq 1 ] && nvm_has "setopt"; then
setopt nomatch setopt nomatch
fi fi
return 1 return 2
fi fi
elif [ -e "$FILE" ] && [ ! -w "$FILE" ] && [ ! -O "$FILE" ]; then
nvm_err "file is not writable or self-owned: $(nvm_sanitize_path "$FILE")"
if [ "${ZSH_HAS_NONOMATCH_UNSET}" -eq 1 ] && nvm_has "setopt"; then
setopt nomatch
fi
return 1
fi
done done
if [ "${ZSH_HAS_NONOMATCH_UNSET}" -eq 1 ] && nvm_has "setopt"; then if [ "${ZSH_HAS_NONOMATCH_UNSET}" -eq 1 ] && nvm_has "setopt"; then
setopt nomatch setopt nomatch
@@ -2242,6 +2273,30 @@ nvm() {
nvm_err "\$NVM_DIR: '$(nvm_sanitize_path "$NVM_DIR")'" nvm_err "\$NVM_DIR: '$(nvm_sanitize_path "$NVM_DIR")'"
nvm_err "\$PREFIX: '$(nvm_sanitize_path "$PREFIX")'" nvm_err "\$PREFIX: '$(nvm_sanitize_path "$PREFIX")'"
nvm_err "\$NPM_CONFIG_PREFIX: '$(nvm_sanitize_path "$NPM_CONFIG_PREFIX")'" nvm_err "\$NPM_CONFIG_PREFIX: '$(nvm_sanitize_path "$NPM_CONFIG_PREFIX")'"
nvm_err "\$NVM_NODEJS_ORG_MIRROR: '${NVM_NODEJS_ORG_MIRROR}'"
nvm_err "\$NVM_IOJS_ORG_MIRROR: '${NVM_IOJS_ORG_MIRROR}'"
nvm_err "shell version: '$(${SHELL} --version | command head -n 1)'"
nvm_err "uname -a: '$(uname -a | awk '{$2=""; print}' | xargs)'"
if [ "$(nvm_get_os)" = "darwin" ] && nvm_has sw_vers; then
nvm_err "OS version: $(sw_vers | command awk '{print $2}' | command xargs)"
elif [ -r "/etc/issue" ]; then
nvm_err "OS version: $(command head -n 1 /etc/issue | command sed 's/\\.//g')"
fi
if nvm_has "curl"; then
nvm_err "curl: $(nvm_command_info curl), $(command curl -V | command head -n 1)"
else
nvm_err "curl: not found"
fi
if nvm_has "wget"; then
nvm_err "wget: $(nvm_command_info wget), $(command wget -V | command head -n 1)"
else
nvm_err "wget: not found"
fi
if nvm_has "git"; then
nvm_err "git: $(nvm_command_info git), $(command git --version)"
else
nvm_err "git: not found"
fi
local NVM_DEBUG_OUTPUT local NVM_DEBUG_OUTPUT
for NVM_DEBUG_COMMAND in 'nvm current' 'which node' 'which iojs' 'which npm' 'npm config get prefix' 'npm root -g' for NVM_DEBUG_COMMAND in 'nvm current' 'which node' 'which iojs' 'which npm' 'npm config get prefix' 'npm root -g'
do do
@@ -2314,13 +2369,13 @@ nvm() {
fi fi
else else
nvm_rc_version nvm_rc_version
if [ $version_not_provided -eq 1 ]; then if [ $version_not_provided -eq 1 ] && [ -z "$NVM_RC_VERSION" ]; then
if [ -z "$NVM_RC_VERSION" ]; then unset NVM_RC_VERSION
>&2 nvm --help >&2 nvm --help
return 127 return 127
fi
fi fi
provided_version="$NVM_RC_VERSION" provided_version="$NVM_RC_VERSION"
unset NVM_RC_VERSION
fi fi
elif [ $# -gt 0 ]; then elif [ $# -gt 0 ]; then
shift shift
@@ -2405,8 +2460,8 @@ nvm() {
return $? return $?
fi fi
local NVM_INSTALL_SUCCESS local EXIT_CODE
NVM_INSTALL_SUCCESS=false EXIT_CODE=-1
if [ -n "${NVM_INSTALL_THIRD_PARTY_HOOK-}" ]; then if [ -n "${NVM_INSTALL_THIRD_PARTY_HOOK-}" ]; then
nvm_err '** $NVM_INSTALL_THIRD_PARTY_HOOK env var set; dispatching to third-party installation method **' nvm_err '** $NVM_INSTALL_THIRD_PARTY_HOOK env var set; dispatching to third-party installation method **'
local NVM_METHOD_PREFERENCE local NVM_METHOD_PREFERENCE
@@ -2416,7 +2471,6 @@ nvm() {
fi fi
local VERSION_PATH local VERSION_PATH
VERSION_PATH="$(nvm_version_path "${VERSION}")" VERSION_PATH="$(nvm_version_path "${VERSION}")"
local EXIT_CODE
"${NVM_INSTALL_THIRD_PARTY_HOOK}" "${VERSION}" "${FLAVOR}" std "${NVM_METHOD_PREFERENCE}" "${VERSION_PATH}" || { "${NVM_INSTALL_THIRD_PARTY_HOOK}" "${VERSION}" "${FLAVOR}" std "${NVM_METHOD_PREFERENCE}" "${VERSION_PATH}" || {
EXIT_CODE=$? EXIT_CODE=$?
nvm_err '*** Third-party $NVM_INSTALL_THIRD_PARTY_HOOK env var failed to install! ***' nvm_err '*** Third-party $NVM_INSTALL_THIRD_PARTY_HOOK env var failed to install! ***'
@@ -2426,7 +2480,7 @@ nvm() {
nvm_err '*** Third-party $NVM_INSTALL_THIRD_PARTY_HOOK env var claimed to succeed, but failed to install! ***' nvm_err '*** Third-party $NVM_INSTALL_THIRD_PARTY_HOOK env var claimed to succeed, but failed to install! ***'
return 33 return 33
fi fi
NVM_INSTALL_SUCCESS=true EXIT_CODE=0
else else
if [ "_$NVM_OS" = "_freebsd" ]; then if [ "_$NVM_OS" = "_freebsd" ]; then
@@ -2443,30 +2497,35 @@ nvm() {
# skip binary install if "nobinary" option specified. # skip binary install if "nobinary" option specified.
if [ $nobinary -ne 1 ] && nvm_binary_available "$VERSION"; then if [ $nobinary -ne 1 ] && nvm_binary_available "$VERSION"; then
if nvm_install_binary "${FLAVOR}" std "${VERSION}"; then nvm_install_binary "${FLAVOR}" std "${VERSION}"
NVM_INSTALL_SUCCESS=true EXIT_CODE=$?
fi
fi fi
if [ "$NVM_INSTALL_SUCCESS" != true ]; then if [ "$EXIT_CODE" -ne 0 ]; then
if [ -z "${NVM_MAKE_JOBS-}" ]; then if [ -z "${NVM_MAKE_JOBS-}" ]; then
nvm_get_make_jobs nvm_get_make_jobs
fi fi
if nvm_install_source "${FLAVOR}" std "${VERSION}" "${NVM_MAKE_JOBS}" "${ADDITIONAL_PARAMETERS}"; then nvm_install_source "${FLAVOR}" std "${VERSION}" "${NVM_MAKE_JOBS}" "${ADDITIONAL_PARAMETERS}"
NVM_INSTALL_SUCCESS=true EXIT_CODE=$?
fi
fi fi
fi fi
if [ "$NVM_INSTALL_SUCCESS" = true ] && nvm use "$VERSION"; then if [ "$EXIT_CODE" -eq 0 ] && nvm_use_if_needed "${VERSION}" && nvm_install_npm_if_needed "${VERSION}"; then
nvm_ensure_default_set "$provided_version" if [ -n "${LTS-}" ]; then
nvm_ensure_default_set "lts/${LTS}"
else
nvm_ensure_default_set "$provided_version"
fi
if [ ! -z "$REINSTALL_PACKAGES_FROM" ] \ if [ ! -z "$REINSTALL_PACKAGES_FROM" ] \
&& [ "_$REINSTALL_PACKAGES_FROM" != "_N/A" ]; then && [ "_$REINSTALL_PACKAGES_FROM" != "_N/A" ]; then
nvm reinstall-packages "$REINSTALL_PACKAGES_FROM" nvm reinstall-packages "$REINSTALL_PACKAGES_FROM"
EXIT_CODE=$?
fi fi
else
EXIT_CODE=$?
fi fi
return $? return $EXIT_CODE
;; ;;
"uninstall" ) "uninstall" )
if [ $# -ne 1 ]; then if [ $# -ne 1 ]; then
@@ -2613,6 +2672,7 @@ nvm() {
PROVIDED_VERSION="$NVM_RC_VERSION" PROVIDED_VERSION="$NVM_RC_VERSION"
VERSION="$(nvm_version "$PROVIDED_VERSION")" VERSION="$(nvm_version "$PROVIDED_VERSION")"
fi fi
unset NVM_RC_VERSION
else else
VERSION="$(nvm_match_version "$PROVIDED_VERSION")" VERSION="$(nvm_match_version "$PROVIDED_VERSION")"
fi fi
@@ -2633,12 +2693,10 @@ nvm() {
nvm_echo "Now using system version of io.js: $(iojs --version 2>/dev/null)$(nvm_print_npm_version)" nvm_echo "Now using system version of io.js: $(iojs --version 2>/dev/null)$(nvm_print_npm_version)"
fi fi
return return
else elif [ $NVM_USE_SILENT -ne 1 ]; then
if [ $NVM_USE_SILENT -ne 1 ]; then nvm_err 'System version of node not found.'
nvm_err 'System version of node not found.'
fi
return 127
fi fi
return 127
elif [ "_$VERSION" = "_∞" ]; then elif [ "_$VERSION" = "_∞" ]; then
if [ $NVM_USE_SILENT -ne 1 ]; then if [ $NVM_USE_SILENT -ne 1 ]; then
nvm_err "The alias \"$PROVIDED_VERSION\" leads to an infinite loop. Aborting." nvm_err "The alias \"$PROVIDED_VERSION\" leads to an infinite loop. Aborting."
@@ -2665,6 +2723,7 @@ nvm() {
PATH="$(nvm_prepend_path "$PATH" "$NVM_VERSION_DIR/bin")" PATH="$(nvm_prepend_path "$PATH" "$NVM_VERSION_DIR/bin")"
if nvm_has manpath; then if nvm_has manpath; then
if [ -z "$MANPATH" ]; then if [ -z "$MANPATH" ]; then
local MANPATH
MANPATH=$(manpath) MANPATH=$(manpath)
fi fi
# Strip other version from MANPATH # Strip other version from MANPATH
@@ -2737,6 +2796,7 @@ nvm() {
if [ -n "$NVM_RC_VERSION" ]; then if [ -n "$NVM_RC_VERSION" ]; then
VERSION="$(nvm_version "$NVM_RC_VERSION")" ||: VERSION="$(nvm_version "$NVM_RC_VERSION")" ||:
fi fi
unset NVM_RC_VERSION
if [ "${VERSION:-N/A}" = 'N/A' ]; then if [ "${VERSION:-N/A}" = 'N/A' ]; then
>&2 nvm --help >&2 nvm --help
return 127 return 127
@@ -2757,6 +2817,7 @@ nvm() {
fi fi
fi fi
VERSION="$(nvm_version "$NVM_RC_VERSION")" ||: VERSION="$(nvm_version "$NVM_RC_VERSION")" ||:
unset NVM_RC_VERSION
else else
shift shift
fi fi
@@ -2832,6 +2893,7 @@ nvm() {
nvm_rc_version nvm_rc_version
fi fi
provided_version="$NVM_RC_VERSION" provided_version="$NVM_RC_VERSION"
unset NVM_RC_VERSION
VERSION="$(nvm_version "$provided_version")" ||: VERSION="$(nvm_version "$provided_version")" ||:
else else
shift shift
@@ -2930,10 +2992,9 @@ nvm() {
if [ -n "$NVM_OUTPUT" ]; then if [ -n "$NVM_OUTPUT" ]; then
NVM_NO_COLORS="${NVM_NO_COLORS-}" nvm_print_versions "$NVM_OUTPUT" NVM_NO_COLORS="${NVM_NO_COLORS-}" nvm_print_versions "$NVM_OUTPUT"
return $EXIT_CODE return $EXIT_CODE
else
NVM_NO_COLORS="${NVM_NO_COLORS-}" nvm_print_versions "N/A"
return 3
fi fi
NVM_NO_COLORS="${NVM_NO_COLORS-}" nvm_print_versions "N/A"
return 3
;; ;;
"current" ) "current" )
nvm_version current nvm_version current
@@ -2947,6 +3008,7 @@ nvm() {
provided_version="${NVM_RC_VERSION}" provided_version="${NVM_RC_VERSION}"
VERSION=$(nvm_version "${NVM_RC_VERSION}") ||: VERSION=$(nvm_version "${NVM_RC_VERSION}") ||:
fi fi
unset NVM_RC_VERSION
elif [ "_${1}" != '_system' ]; then elif [ "_${1}" != '_system' ]; then
VERSION="$(nvm_version "${provided_version}")" ||: VERSION="$(nvm_version "${provided_version}")" ||:
else else
@@ -2964,13 +3026,11 @@ nvm() {
if [ -n "$NVM_BIN" ]; then if [ -n "$NVM_BIN" ]; then
nvm_echo "$NVM_BIN" nvm_echo "$NVM_BIN"
return return
else
return 1
fi fi
else return 1
nvm_err 'System version of node not found.'
return 127
fi fi
nvm_err 'System version of node not found.'
return 127
elif [ "_$VERSION" = "_∞" ]; then elif [ "_$VERSION" = "_∞" ]; then
nvm_err "The alias \"$2\" leads to an infinite loop. Aborting." nvm_err "The alias \"$2\" leads to an infinite loop. Aborting."
return 8 return 8
@@ -3150,18 +3210,19 @@ nvm() {
NVM_VERSION_ONLY=true NVM_LTS="${NVM_LTS-}" nvm_remote_version "${PATTERN:-node}" NVM_VERSION_ONLY=true NVM_LTS="${NVM_LTS-}" nvm_remote_version "${PATTERN:-node}"
;; ;;
"--version" ) "--version" )
nvm_echo '0.33.0' nvm_echo '0.33.2'
;; ;;
"unload" ) "unload" )
nvm deactivate >/dev/null 2>&1
unset -f nvm \ unset -f nvm \
nvm_iojs_prefix nvm_node_prefix \ nvm_iojs_prefix nvm_node_prefix \
nvm_add_iojs_prefix nvm_strip_iojs_prefix \ nvm_add_iojs_prefix nvm_strip_iojs_prefix \
nvm_is_iojs_version nvm_is_alias \ nvm_is_iojs_version nvm_is_alias nvm_has_non_aliased \
nvm_ls_remote nvm_ls_remote_iojs nvm_ls_remote_index_tab \ nvm_ls_remote nvm_ls_remote_iojs nvm_ls_remote_index_tab \
nvm_ls nvm_remote_version nvm_remote_versions \ nvm_ls nvm_remote_version nvm_remote_versions \
nvm_install_binary nvm_clang_version \ nvm_install_binary nvm_install_source nvm_clang_version \
nvm_get_mirror nvm_get_download_slug nvm_download_artifact \ nvm_get_mirror nvm_get_download_slug nvm_download_artifact \
nvm_install_source nvm_check_file_permissions \ nvm_install_npm_if_needed nvm_use_if_needed nvm_check_file_permissions \
nvm_print_versions nvm_compute_checksum nvm_checksum \ nvm_print_versions nvm_compute_checksum nvm_checksum \
nvm_get_checksum_alg nvm_get_checksum nvm_compare_checksum \ nvm_get_checksum_alg nvm_get_checksum nvm_compare_checksum \
nvm_version nvm_rc_version nvm_match_version \ nvm_version nvm_rc_version nvm_match_version \
@@ -3187,6 +3248,7 @@ nvm() {
nvm_print_default_alias nvm_print_formatted_alias nvm_resolve_local_alias \ nvm_print_default_alias nvm_print_formatted_alias nvm_resolve_local_alias \
nvm_sanitize_path nvm_has_colors nvm_process_parameters \ nvm_sanitize_path nvm_has_colors nvm_process_parameters \
node_version_has_solaris_binary iojs_version_has_solaris_binary \ node_version_has_solaris_binary iojs_version_has_solaris_binary \
nvm_curl_libz_support nvm_command_info \
> /dev/null 2>&1 > /dev/null 2>&1
unset RC_VERSION NVM_NODEJS_ORG_MIRROR NVM_IOJS_ORG_MIRROR NVM_DIR \ unset RC_VERSION NVM_NODEJS_ORG_MIRROR NVM_IOJS_ORG_MIRROR NVM_DIR \
NVM_CD_FLAGS NVM_BIN NVM_MAKE_JOBS \ NVM_CD_FLAGS NVM_BIN NVM_MAKE_JOBS \
@@ -3221,8 +3283,8 @@ nvm_supports_xz() {
fi fi
# 0.10x: node v0.10.42 and later have xz # 0.10x: node v0.10.42 and later have xz
if nvm_version_greater_than_or_equal_to "$1" "0.10.42" \ if nvm_version_greater_than_or_equal_to "${1}" "0.10.42" \
&& nvm_version_greater "0.11.0" "$1"; then && nvm_version_greater "0.11.0" "${1}"; then
return 0 return 0
fi fi

View File

@@ -1,6 +1,6 @@
{ {
"name": "nvm", "name": "nvm",
"version": "0.33.0", "version": "0.33.2",
"description": "Node Version Manager - Simple bash script to manage multiple active node.js versions", "description": "Node Version Manager - Simple bash script to manage multiple active node.js versions",
"directories": { "directories": {
"test": "test" "test": "test"
@@ -13,7 +13,8 @@
"test/installation": "npm run --silent test/installation/node && npm run --silent test/installation/iojs", "test/installation": "npm run --silent test/installation/node && npm run --silent test/installation/iojs",
"test/installation/node": "shell=$(basename -- $(ps -o comm= $(ps -o ppid= -p $PPID)) | sed 's/^-//'); make TEST_SUITE=installation_node test-$shell", "test/installation/node": "shell=$(basename -- $(ps -o comm= $(ps -o ppid= -p $PPID)) | sed 's/^-//'); make TEST_SUITE=installation_node test-$shell",
"test/installation/iojs": "shell=$(basename -- $(ps -o comm= $(ps -o ppid= -p $PPID)) | sed 's/^-//'); make TEST_SUITE=installation_iojs test-$shell", "test/installation/iojs": "shell=$(basename -- $(ps -o comm= $(ps -o ppid= -p $PPID)) | sed 's/^-//'); make TEST_SUITE=installation_iojs test-$shell",
"test/sourcing": "shell=$(basename -- $(ps -o comm= $(ps -o ppid= -p $PPID)) | sed 's/^-//'); make TEST_SUITE=sourcing test-$shell" "test/sourcing": "shell=$(basename -- $(ps -o comm= $(ps -o ppid= -p $PPID)) | sed 's/^-//'); make TEST_SUITE=sourcing test-$shell",
"doctoc": "doctoc --title='## Table of Contents' --github README.md"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@@ -35,6 +36,7 @@
"devDependencies": { "devDependencies": {
"replace": "^0.3.0", "replace": "^0.3.0",
"semver": "^5.0.1", "semver": "^5.0.1",
"urchin": "^0.0.5" "urchin": "^0.0.5",
"doctoc": "^1.2.0"
} }
} }

View File

@@ -7,6 +7,8 @@ set -ex
LTS_ALIAS_PATH="$(nvm_alias_path)/lts" LTS_ALIAS_PATH="$(nvm_alias_path)/lts"
rm -rf "${LTS_ALIAS_PATH}"
die () { echo "$@" ; exit 1; } die () { echo "$@" ; exit 1; }
[ ! -d "${LTS_ALIAS_PATH}" ] || die "'${LTS_ALIAS_PATH}' exists and should not" [ ! -d "${LTS_ALIAS_PATH}" ] || die "'${LTS_ALIAS_PATH}' exists and should not"

View File

@@ -1,4 +1,21 @@
version date files npm v8 uv zlib openssl modules lts version date files npm v8 uv zlib openssl modules lts
v7.7.2 2017-03-08 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 4.1.2 5.5.372.41 1.11.0 1.2.11 1.0.2k 51 -
v7.7.1 2017-03-02 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 4.1.2 5.5.372.41 1.11.0 1.2.11 1.0.2k 51 -
v7.7.0 2017-02-28 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 4.1.2 5.5.372.41 1.11.0 1.2.11 1.0.2k 51 -
v7.6.0 2017-02-21 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 4.1.2 5.5.372.40 1.11.0 1.2.11 1.0.2k 51 -
v7.5.0 2017-01-31 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 4.1.2 5.4.500.48 1.10.2 1.2.8 1.0.2k 51 -
v7.4.0 2017-01-04 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 4.0.5 5.4.500.45 1.10.1 1.2.8 1.0.2j 51 -
v7.3.0 2016-12-20 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 3.10.10 5.4.500.45 1.10.1 1.2.8 1.0.2j 51 -
v7.2.1 2016-12-06 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 3.10.10 5.4.500.44 1.10.1 1.2.8 1.0.2j 51 -
v7.2.0 2016-11-22 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 3.10.9 5.4.500.43 1.10.1 1.2.8 1.0.2j 51 -
v7.1.0 2016-11-08 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 3.10.9 5.4.500.36 1.10.0 1.2.8 1.0.2j 51 -
v7.0.0 2016-10-25 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 3.10.8 5.4.500.36 1.9.1 1.2.8 1.0.2j 51 -
v6.10.0 2017-02-21 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 3.10.10 5.1.281.93 1.9.1 1.2.8 1.0.2k 48 Boron
v6.9.5 2017-01-31 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 3.10.10 5.1.281.89 1.9.1 1.2.8 1.0.2k 48 Boron
v6.9.4 2017-01-05 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 3.10.10 5.1.281.89 1.9.1 1.2.8 1.0.2j 48 Boron
v6.9.3 2017-01-05 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 3.10.10 5.1.281.89 1.9.1 1.2.8 1.0.2j 48 Boron
v6.9.2 2016-12-06 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 3.10.9 5.1.281.88 1.9.1 1.2.8 1.0.2j 48 Boron
v6.9.1 2016-10-19 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 3.10.8 5.1.281.84 1.9.1 1.2.8 1.0.2j 48 Boron
v6.9.0 2016-10-18 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 3.10.8 5.1.281.84 1.9.1 1.2.8 1.0.2j 48 Boron v6.9.0 2016-10-18 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 3.10.8 5.1.281.84 1.9.1 1.2.8 1.0.2j 48 Boron
v6.8.1 2016-10-14 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 3.10.8 5.1.281.84 1.9.1 1.2.8 1.0.2j 48 - v6.8.1 2016-10-14 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 3.10.8 5.1.281.84 1.9.1 1.2.8 1.0.2j 48 -
v6.8.0 2016-10-12 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 3.10.8 5.1.281.84 1.9.1 1.2.8 1.0.2j 48 - v6.8.0 2016-10-12 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 3.10.8 5.1.281.84 1.9.1 1.2.8 1.0.2j 48 -
@@ -32,6 +49,12 @@ v5.2.0 2015-12-09 headers,linux-arm64,linux-armv6l,linux-armv7l,linux-x64,linux-
v5.1.1 2015-12-03 headers,linux-arm64,linux-armv6l,linux-armv7l,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 3.3.12 4.6.85.31 1.7.5 1.2.8 1.0.2e 47 - v5.1.1 2015-12-03 headers,linux-arm64,linux-armv6l,linux-armv7l,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 3.3.12 4.6.85.31 1.7.5 1.2.8 1.0.2e 47 -
v5.1.0 2015-11-17 headers,linux-arm64,linux-armv6l,linux-armv7l,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 3.3.12 4.6.85.31 1.7.5 1.2.8 1.0.2d 47 - v5.1.0 2015-11-17 headers,linux-arm64,linux-armv6l,linux-armv7l,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 3.3.12 4.6.85.31 1.7.5 1.2.8 1.0.2d 47 -
v5.0.0 2015-10-29 headers,linux-arm64,linux-armv6l,linux-armv7l,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 3.3.6 4.6.85.28 1.7.5 1.2.8 1.0.2d 47 - v5.0.0 2015-10-29 headers,linux-arm64,linux-armv6l,linux-armv7l,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 3.3.6 4.6.85.28 1.7.5 1.2.8 1.0.2d 47 -
v4.8.0 2017-02-21 headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 2.15.11 4.5.103.45 1.9.1 1.2.8 1.0.2k 46 Argon
v4.7.3 2017-01-31 headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 2.15.11 4.5.103.43 1.9.1 1.2.8 1.0.2k 46 Argon
v4.7.2 2017-01-05 headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 2.15.11 4.5.103.43 1.9.1 1.2.8 1.0.2j 46 Argon
v4.7.1 2017-01-05 headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 2.15.11 4.5.103.43 1.9.1 1.2.8 1.0.2j 46 Argon
v4.7.0 2016-12-06 headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 2.15.11 4.5.103.43 1.9.1 1.2.8 1.0.2j 46 Argon
v4.6.2 2016-11-08 headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 2.15.11 4.5.103.42 1.9.1 1.2.8 1.0.2j 46 Argon
v4.6.1 2016-10-18 headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 2.15.9 4.5.103.37 1.9.1 1.2.8 1.0.2j 46 Argon v4.6.1 2016-10-18 headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 2.15.9 4.5.103.37 1.9.1 1.2.8 1.0.2j 46 Argon
v4.6.0 2016-09-27 headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 2.15.9 4.5.103.37 1.9.1 1.2.8 1.0.2j 46 Argon v4.6.0 2016-09-27 headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 2.15.9 4.5.103.37 1.9.1 1.2.8 1.0.2j 46 Argon
v4.5.0 2016-08-16 headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 2.15.9 4.5.103.37 1.9.1 1.2.8 1.0.2h 46 Argon v4.5.0 2016-08-16 headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 2.15.9 4.5.103.37 1.9.1 1.2.8 1.0.2h 46 Argon
@@ -57,6 +80,7 @@ v4.1.2 2015-10-05 headers,linux-arm64,linux-armv6l,linux-armv7l,linux-x64,linux-
v4.1.1 2015-09-23 headers,linux-arm64,linux-armv6l,linux-armv7l,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 2.14.4 4.5.103.33 1.7.4 1.2.8 1.0.2d 46 - v4.1.1 2015-09-23 headers,linux-arm64,linux-armv6l,linux-armv7l,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 2.14.4 4.5.103.33 1.7.4 1.2.8 1.0.2d 46 -
v4.1.0 2015-09-17 headers,linux-arm64,linux-armv6l,linux-armv7l,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 2.14.3 4.5.103.33 1.7.4 1.2.8 1.0.2d 46 - v4.1.0 2015-09-17 headers,linux-arm64,linux-armv6l,linux-armv7l,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 2.14.3 4.5.103.33 1.7.4 1.2.8 1.0.2d 46 -
v4.0.0 2015-09-08 headers,linux-arm64,linux-armv6l,linux-armv7l,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 2.14.2 4.5.103.30 1.7.3 1.2.8 1.0.2d 46 - v4.0.0 2015-09-08 headers,linux-arm64,linux-armv6l,linux-armv7l,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x64-msi,win-x86-exe,win-x86-msi 2.14.2 4.5.103.30 1.7.3 1.2.8 1.0.2d 46 -
v0.12.18 2017-02-22 headers,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,osx-x86-tar,src,sunos-x86,win-x64-exe,win-x86-exe,win-x86-msi 2.15.11 3.28.71.20 1.6.1 1.2.8 1.0.1u 14 -
v0.12.17 2016-10-18 headers,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,osx-x86-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x86-exe,win-x86-msi 2.15.1 3.28.71.19 1.6.1 1.2.8 1.0.1u 14 - v0.12.17 2016-10-18 headers,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,osx-x86-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x86-exe,win-x86-msi 2.15.1 3.28.71.19 1.6.1 1.2.8 1.0.1u 14 -
v0.12.16 2016-09-27 headers,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,osx-x86-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x86-exe,win-x86-msi 2.15.1 3.28.71.19 1.6.1 1.2.8 1.0.1u 14 - v0.12.16 2016-09-27 headers,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,osx-x86-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x86-exe,win-x86-msi 2.15.1 3.28.71.19 1.6.1 1.2.8 1.0.1u 14 -
v0.12.15 2016-06-23 headers,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,osx-x86-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x86-exe,win-x86-msi 2.15.1 3.28.71.19 1.6.1 1.2.8 1.0.1t 14 - v0.12.15 2016-06-23 headers,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,osx-x86-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x86-exe,win-x86-msi 2.15.1 3.28.71.19 1.6.1 1.2.8 1.0.1t 14 -

View File

@@ -18,5 +18,17 @@
v4.4.7  (LTS: Argon) v4.4.7  (LTS: Argon)
v4.5.0  (LTS: Argon) v4.5.0  (LTS: Argon)
v4.6.0  (LTS: Argon) v4.6.0  (LTS: Argon)
v4.6.1  (Latest LTS: Argon) v4.6.1  (LTS: Argon)
v6.9.0  (Latest LTS: Boron) v4.6.2  (LTS: Argon)
v4.7.0  (LTS: Argon)
v4.7.1  (LTS: Argon)
v4.7.2  (LTS: Argon)
v4.7.3  (LTS: Argon)
v4.8.0  (Latest LTS: Argon)
v6.9.0  (LTS: Boron)
v6.9.1  (LTS: Boron)
v6.9.2  (LTS: Boron)
v6.9.3  (LTS: Boron)
v6.9.4  (LTS: Boron)
v6.9.5  (LTS: Boron)
v6.10.0  (Latest LTS: Boron)

View File

@@ -234,6 +234,7 @@
v0.12.15 v0.12.15
v0.12.16 v0.12.16
v0.12.17 v0.12.17
v0.12.18
v4.0.0 v4.0.0
v4.1.0 v4.1.0
v4.1.1 v4.1.1
@@ -258,7 +259,13 @@
v4.4.7  (LTS: Argon) v4.4.7  (LTS: Argon)
v4.5.0  (LTS: Argon) v4.5.0  (LTS: Argon)
v4.6.0  (LTS: Argon) v4.6.0  (LTS: Argon)
v4.6.1  (Latest LTS: Argon) v4.6.1  (LTS: Argon)
v4.6.2  (LTS: Argon)
v4.7.0  (LTS: Argon)
v4.7.1  (LTS: Argon)
v4.7.2  (LTS: Argon)
v4.7.3  (LTS: Argon)
v4.8.0  (Latest LTS: Argon)
v5.0.0 v5.0.0
v5.1.0 v5.1.0
v5.1.1 v5.1.1
@@ -291,4 +298,21 @@
v6.7.0 v6.7.0
v6.8.0 v6.8.0
v6.8.1 v6.8.1
v6.9.0  (Latest LTS: Boron) v6.9.0  (LTS: Boron)
v6.9.1  (LTS: Boron)
v6.9.2  (LTS: Boron)
v6.9.3  (LTS: Boron)
v6.9.4  (LTS: Boron)
v6.9.5  (LTS: Boron)
v6.10.0  (Latest LTS: Boron)
v7.0.0
v7.1.0
v7.2.0
v7.2.1
v7.3.0
v7.4.0
v7.5.0
v7.6.0
v7.7.0
v7.7.1
v7.7.2

View File

@@ -234,6 +234,7 @@
v0.12.15 v0.12.15
v0.12.16 v0.12.16
v0.12.17 v0.12.17
v0.12.18
iojs-v1.0.0 iojs-v1.0.0
iojs-v1.0.1 iojs-v1.0.1
iojs-v1.0.2 iojs-v1.0.2
@@ -299,7 +300,13 @@
v4.4.7  (LTS: Argon) v4.4.7  (LTS: Argon)
v4.5.0  (LTS: Argon) v4.5.0  (LTS: Argon)
v4.6.0  (LTS: Argon) v4.6.0  (LTS: Argon)
v4.6.1  (Latest LTS: Argon) v4.6.1  (LTS: Argon)
v4.6.2  (LTS: Argon)
v4.7.0  (LTS: Argon)
v4.7.1  (LTS: Argon)
v4.7.2  (LTS: Argon)
v4.7.3  (LTS: Argon)
v4.8.0  (Latest LTS: Argon)
v5.0.0 v5.0.0
v5.1.0 v5.1.0
v5.1.1 v5.1.1
@@ -332,4 +339,21 @@
v6.7.0 v6.7.0
v6.8.0 v6.8.0
v6.8.1 v6.8.1
v6.9.0  (Latest LTS: Boron) v6.9.0  (LTS: Boron)
v6.9.1  (LTS: Boron)
v6.9.2  (LTS: Boron)
v6.9.3  (LTS: Boron)
v6.9.4  (LTS: Boron)
v6.9.5  (LTS: Boron)
v6.10.0  (Latest LTS: Boron)
v7.0.0
v7.1.0
v7.2.0
v7.2.1
v7.3.0
v7.4.0
v7.5.0
v7.6.0
v7.7.0
v7.7.1
v7.7.2

View File

@@ -19,3 +19,9 @@ v4.4.7 Argon
v4.5.0 Argon v4.5.0 Argon
v4.6.0 Argon v4.6.0 Argon
v4.6.1 Argon v4.6.1 Argon
v4.6.2 Argon
v4.7.0 Argon
v4.7.1 Argon
v4.7.2 Argon
v4.7.3 Argon
v4.8.0 Argon

View File

@@ -19,4 +19,16 @@ v4.4.7 Argon
v4.5.0 Argon v4.5.0 Argon
v4.6.0 Argon v4.6.0 Argon
v4.6.1 Argon v4.6.1 Argon
v4.6.2 Argon
v4.7.0 Argon
v4.7.1 Argon
v4.7.2 Argon
v4.7.3 Argon
v4.8.0 Argon
v6.9.0 Boron v6.9.0 Boron
v6.9.1 Boron
v6.9.2 Boron
v6.9.3 Boron
v6.9.4 Boron
v6.9.5 Boron
v6.10.0 Boron

View File

@@ -1 +1 @@
v6.9.0 Boron v7.7.2

View File

@@ -234,6 +234,7 @@ v0.12.14
v0.12.15 v0.12.15
v0.12.16 v0.12.16
v0.12.17 v0.12.17
v0.12.18
v4.0.0 v4.0.0
v4.1.0 v4.1.0
v4.1.1 v4.1.1
@@ -259,6 +260,12 @@ v4.4.7 Argon
v4.5.0 Argon v4.5.0 Argon
v4.6.0 Argon v4.6.0 Argon
v4.6.1 Argon v4.6.1 Argon
v4.6.2 Argon
v4.7.0 Argon
v4.7.1 Argon
v4.7.2 Argon
v4.7.3 Argon
v4.8.0 Argon
v5.0.0 v5.0.0
v5.1.0 v5.1.0
v5.1.1 v5.1.1
@@ -292,3 +299,20 @@ v6.7.0
v6.8.0 v6.8.0
v6.8.1 v6.8.1
v6.9.0 Boron v6.9.0 Boron
v6.9.1 Boron
v6.9.2 Boron
v6.9.3 Boron
v6.9.4 Boron
v6.9.5 Boron
v6.10.0 Boron
v7.0.0
v7.1.0
v7.2.0
v7.2.1
v7.3.0
v7.4.0
v7.5.0
v7.6.0
v7.7.0
v7.7.1
v7.7.2

View File

@@ -1,3 +1,3 @@
lts/*|lts/boron lts/*|lts/boron
lts/boron|v6.9.0 lts/boron|v6.10.0
lts/argon|v4.6.1 lts/argon|v4.8.0

View File

@@ -0,0 +1,40 @@
#!/bin/sh
cleanup() {
unalias wget
unset -f wget
unset WGET_EXPECTED_INFO WGET_COMMAND_INFO
}
die() { echo "$@" ; cleanup ; exit 1; }
\. ../../../nvm.sh
# 1. test wget command
WGET_COMMAND_INFO="$(nvm_command_info wget)"
WGET_EXPECTED_INFO="$(which wget)"
[ "${WGET_COMMAND_INFO}" = "${WGET_EXPECTED_INFO}" ] || die "wget command info wrong(stage 1), expected: '${WGET_EXPECTED_INFO}', got '${WGET_COMMAND_INFO}'"
cleanup
# 2. test aliased wget
shopt -s expand_aliases
# enable expand_aliases to make alias working in interactive shell
alias wget="wget -V"
WGET_COMMAND_INFO="$(nvm_command_info wget)"
WGET_EXPECTED_INFO="$(which wget) (wget -V)"
[ "${WGET_COMMAND_INFO}" = "${WGET_EXPECTED_INFO}" ] || die "wget command info wrong(stage 2), expected: '${WGET_EXPECTED_INFO}', got '${WGET_COMMAND_INFO}'"
cleanup
# 3. test wget function
wget() {
echo "wget function"
}
WGET_COMMAND_INFO="$(nvm_command_info wget)"
WGET_EXPECTED_INFO="$(type wget)"
[ "${WGET_COMMAND_INFO}" = "${WGET_EXPECTED_INFO}" ] || die "wget command info wrong(stage 3), expected: '${WGET_EXPECTED_INFO}', got '${WGET_COMMAND_INFO}'"
cleanup

View File

@@ -0,0 +1,39 @@
#!/bin/sh
cleanup() {
unset -f curl
}
die() { cleanup; echo "$@" ; exit 1; }
\. ../../../nvm.sh
curl() {
# curl with libz feature
if [ $# -ne 1 ] || [ "$1" != "-V" ]; then
die "This fake curl only takes one parameter -V"
fi
echo "
curl 7.47.0 (x86_64-pc-linux-gnu) libcurl/7.47.0 GnuTLS/3.4.10 zlib/1.2.8 libidn/1.32 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP UnixSockets"
}
nvm_curl_libz_support || die "nvm_curl_libz_support should return 0"
unset -f curl
curl() {
# curl without libz feature
if [ "$#" -ne 1 ] || [ "$1" != "-V" ]; then
die "This fake curl only takes one parameter -V"
fi
echo "
curl 7.47.0 (x86_64-pc-linux-gnu) libcurl/7.47.0 GnuTLS/3.4.10 zlib/1.2.8 libidn/1.32 librtmp/2.32
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL TLS-SRP UnixSockets"
}
! nvm_curl_libz_support || die "nvm_curl_libz_support should return 1"
unset -f curl

View File

@@ -3,6 +3,7 @@
die () { echo "$@" ; cleanup ; exit 1; } die () { echo "$@" ; cleanup ; exit 1; }
cleanup () { cleanup () {
rm -rf "$(nvm_version_path v0.1.2)" rm -rf "$(nvm_version_path v0.1.2)"
unset -f nvm_has_system_node nvm_has_system_iojs
} }
\. ../../../nvm.sh \. ../../../nvm.sh
@@ -31,4 +32,31 @@ You need to run "nvm install iojs" to install it before using it.'
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "expected 'nvm_ensure_version_installed iojs' to give $EXPECTED_OUTPUT, got $OUTPUT" [ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "expected 'nvm_ensure_version_installed iojs' to give $EXPECTED_OUTPUT, got $OUTPUT"
[ "_$EXIT_CODE" = "_1" ] || die "expected 'nvm_ensure_version_installed iojs' to exit with 1, got $EXIT_CODE" [ "_$EXIT_CODE" = "_1" ] || die "expected 'nvm_ensure_version_installed iojs' to exit with 1, got $EXIT_CODE"
nvm_has_system_node() { return 1; }
nvm_has_system_iojs() { return 1; }
OUTPUT="$(nvm_ensure_version_installed system 2>&1)"
EXIT_CODE=$?
EXPECTED_OUTPUT='N/A: no system version of node/io.js is installed.'
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "expected 'nvm_ensure_version_installed system' with neither installed to give $EXPECTED_OUTPUT, got $OUTPUT"
[ "_$EXIT_CODE" = "_1" ] || die "expected 'nvm_ensure_version_installed system' with neither installed to exit with 1, got $EXIT_CODE"
nvm_has_system_node() { return 0; }
nvm_has_system_iojs() { return 1; }
OUTPUT="$(nvm_ensure_version_installed system 2>&1)"
EXIT_CODE=$?
EXPECTED_OUTPUT=''
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "expected 'nvm_ensure_version_installed system' with node installed to give $EXPECTED_OUTPUT, got $OUTPUT"
[ "_$EXIT_CODE" = "_0" ] || die "expected 'nvm_ensure_version_installed system' with node installed to exit with 0, got $EXIT_CODE"
nvm_has_system_node() { return 1; }
nvm_has_system_iojs() { return 0; }
OUTPUT="$(nvm_ensure_version_installed system 2>&1)"
EXIT_CODE=$?
EXPECTED_OUTPUT=''
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "expected 'nvm_ensure_version_installed system' with iojs installed to give $EXPECTED_OUTPUT, got $OUTPUT"
[ "_$EXIT_CODE" = "_0" ] || die "expected 'nvm_ensure_version_installed system' with iojs installed to exit with 0, got $EXIT_CODE"
cleanup cleanup

View File

@@ -4,6 +4,9 @@ set -ex
die () { echo "$@" ; exit 1; } die () { echo "$@" ; exit 1; }
unset NVM_NODEJS_ORG_MIRROR
unset NVM_IOJS_ORG_MIRROR
\. ../../../nvm.sh \. ../../../nvm.sh
! nvm_get_mirror || die 'unknown release type did not error' ! nvm_get_mirror || die 'unknown release type did not error'
@@ -12,5 +15,17 @@ die () { echo "$@" ; exit 1; }
! nvm_get_mirror node foo || die 'unknown release type did not error' ! nvm_get_mirror node foo || die 'unknown release type did not error'
! nvm_get_mirror iojs foo || die 'unknown release type did not error' ! nvm_get_mirror iojs foo || die 'unknown release type did not error'
[ "$(nvm_get_mirror node std)" = "${NVM_NODEJS_ORG_MIRROR}" ] || die 'node std did not yield NVM_NODEJS_ORG_MIRROR' [ -z "$NVM_NODEJS_ORG_MIRROR" ] || die "MIRROR environment variables should not be exported"
[ "$(nvm_get_mirror iojs std)" = "${NVM_IOJS_ORG_MIRROR}" ] || die 'node std did not yield NVM_NODEJS_ORG_MIRROR' [ -z "$NVM_IOJS_ORG_MIRROR" ] || die "MIRROR environment variables should not be exported"
[ "$(nvm_get_mirror node std)" = "https://nodejs.org/dist" ] || die "incorrect default node-std mirror"
[ "$(nvm_get_mirror iojs std)" = "https://iojs.org/dist" ] || die "incorrect default iojs-std mirror"
NVM_NODEJS_ORG_MIRROR="test://domain"
[ "$(nvm_get_mirror node std)" = "test://domain" ] || die "node-std mirror should respect NVM_NODEJS_ORG_MIRROR"
unset NVM_NODEJS_ORG_MIRROR
NVM_IOJS_ORG_MIRROR="test://domain"
[ "$(nvm_get_mirror iojs std)" = "test://domain" ] || die "iojs-std mirror should respect NVM_IOJS_ORG_MIRROR"
unset NVM_IOJS_ORG_MIRROR

View File

@@ -0,0 +1,24 @@
#!/bin/sh
cleanup () { unalias foo; unalias grep; }
die () { echo "$@" ; cleanup ; exit 1; }
\. ../../../nvm.sh
alias foo='bar'
! nvm_has_non_aliased foo || die '"nvm_has_non_aliased foo" was not true'
alias grep='grep'
unalias grep || die '"unalias grep" failed'
nvm_has_non_aliased grep || die '"nvm_has_non_aliased grep" with unaliased grep was not false'
alias grep='grep'
! nvm_has_non_aliased grep || die '"nvm_is_alias grep" with aliased grep was not true'
nvm_has_non_aliased cat && type cat > /dev/null || die 'nvm_has_non_aliased locates "cat" properly'
[ "~$(nvm_has_non_aliased foobarbaz 2>&1)" = "~" ] || die "nvm_has_non_aliased does not suppress error output"
! nvm_has_non_aliased foobarbaz && ! type foobarbaz >/dev/null 2>&1 || die "nvm_has_non_aliased does not return a nonzero exit code when not found"
cleanup

View File

@@ -0,0 +1,24 @@
#!/bin/sh
cleanup() { unset -f nvm_ls_current nvm; }
die () { echo "$@" ; cleanup ; exit 1; }
\. ../../../nvm.sh
nvm_ls_current() { echo foo; }
nvm() {
echo "nvm: $@"
}
OUTPUT="$(nvm_use_if_needed foo)"
EXPECTED_OUTPUT=''
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "expected >${EXPECTED_OUTPUT}<; got >${OUTPUT}<"
OUTPUT="$(nvm_use_if_needed bar)"
EXPECTED_OUTPUT='nvm: use bar'
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "expected >${EXPECTED_OUTPUT}<; got >${OUTPUT}<"
cleanup

View File

@@ -0,0 +1,13 @@
#!/bin/sh
die () { echo "$@" ; exit 1; }
NVM_ENV=testing \. ../../install.sh
#nvm_profile_is_bash_or_zsh is available
type nvm_profile_is_bash_or_zsh > /dev/null 2>&1 || die 'nvm_profile_is_bash_or_zsh is not available'
nvm_profile_is_bash_or_zsh "/home/nvm/.bashrc" || die '/home/nvm/.bashrc is bash profile'
nvm_profile_is_bash_or_zsh "/home/nvm/.bash_profile" || die '/home/nvm/.bash_profile is bash profile'
nvm_profile_is_bash_or_zsh "/home/nvm/.zshrc" || die '/home/nvm/.zshrc is zsh profile'
if nvm_profile_is_bash_or_zsh "/home/nvm/.bash"; then die '/home/nvm/.bash is not bash nor zsh profile'; fi
if nvm_profile_is_bash_or_zsh "/home/nvm/.zsh" ; then die '/home/nvm/.zsh is not bash nor zsh profile'; fi

View File

@@ -24,8 +24,6 @@ EXPECTED_OUTPUT="Version '3' (with LTS filter 'argon') not found - try \`nvm ls-
[ "${EXIT_CODE}" = 3 ] || die "\`nvm install --lts=argon 3\` did not exit with 3, got >${EXIT_CODE}<" [ "${EXIT_CODE}" = 3 ] || die "\`nvm install --lts=argon 3\` did not exit with 3, got >${EXIT_CODE}<"
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "\`nvm install --lts=argon 3\` output >${OUTPUT}<, expected >${EXPECTED_OUTPUT}<" [ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "\`nvm install --lts=argon 3\` output >${OUTPUT}<, expected >${EXPECTED_OUTPUT}<"
set +e # TODO: fix
nvm install --lts 4.2.2 || die 'nvm install --lts 4.2.2 failed' nvm install --lts 4.2.2 || die 'nvm install --lts 4.2.2 failed'
set -e
[ "$(nvm current)" = "v4.2.2" ] || die "v4.2.2 not current, got $(nvm_current)" [ "$(nvm current)" = "v4.2.2" ] || die "v4.2.2 not current, got $(nvm_current)"

View File

@@ -4,7 +4,7 @@ die () { echo "$@" ; exit 1; }
\. ../../nvm.sh \. ../../nvm.sh
NVM_TEST_VERSION=v0.10.41 NVM_TEST_VERSION=v0.10.7
# STAGE 1 # # STAGE 1 #

View File

@@ -23,8 +23,7 @@ OUTPUT="$(NVM_INSTALL_THIRD_PARTY_HOOK=succeed nvm install "${VERSION}")"
USE_OUTPUT="$(nvm use "${VERSION}")" USE_OUTPUT="$(nvm use "${VERSION}")"
EXPECTED_OUTPUT="${VERSION} node std binary ${VERSION_PATH} EXPECTED_OUTPUT="${VERSION} node std binary ${VERSION_PATH}
Downloading and installing node ${VERSION}... Downloading and installing node ${VERSION}...
${USE_OUTPUT} ${USE_OUTPUT}"
${USE_OUTPUT}" # double use output is from the normal install in succeed()
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "expected >${EXPECTED_OUTPUT}<; got >${OUTPUT}<" [ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "expected >${EXPECTED_OUTPUT}<; got >${OUTPUT}<"

View File

@@ -10,11 +10,16 @@ cleanup() {
EXPECTED_VERSION="v12.3.456" EXPECTED_VERSION="v12.3.456"
URL="https://github.com/creationix/nvm/releases/tag/$EXPECTED_VERSION" URL="https://github.com/creationix/nvm/releases/tag/$EXPECTED_VERSION"
EXPECTED_CURL_ARGS="-q -w %{url_effective}\n -L -s -S http://latest.nvm.sh -o /dev/null" EXPECTED_CURL_ARGS="--compressed -q -w %{url_effective}\n -L -s -S http://latest.nvm.sh -o /dev/null"
EXPECTED_WGET_ARGS="http://latest.nvm.sh --server-response -O /dev/null" EXPECTED_WGET_ARGS="http://latest.nvm.sh --server-response -O /dev/null"
curl() { curl() {
if [ "_$*" != "_$EXPECTED_CURL_ARGS" ]; then if [ $# -eq 1 ] && [ "$1" = "-V" ]; then
echo "
curl 7.47.0 (x86_64-pc-linux-gnu) libcurl/7.47.0 GnuTLS/3.4.10 zlib/1.2.8 libidn/1.32 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP UnixSockets"
elif [ "_$*" != "_$EXPECTED_CURL_ARGS" ]; then
echo >&2 "expected args ($EXPECTED_CURL_ARGS), got ($*)" echo >&2 "expected args ($EXPECTED_CURL_ARGS), got ($*)"
return 1 return 1
else else

View File

@@ -17,7 +17,7 @@ wget() {
OUTPUT="$(nvm_get_latest 2>&1)" OUTPUT="$(nvm_get_latest 2>&1)"
EXIT_CODE="$(nvm_get_latest >/dev/null 2>&1 ; echo $?)" EXIT_CODE="$(nvm_get_latest >/dev/null 2>&1 ; echo $?)"
[ "_$OUTPUT" = "_http://latest.nvm.sh did not redirect to the latest release on Github" ] \ [ "_$OUTPUT" = "_http://latest.nvm.sh did not redirect to the latest release on GitHub" ] \
|| die "failed redirect did not report correct error message, got '$OUTPUT'" || die "failed redirect did not report correct error message, got '$OUTPUT'"
[ "_$EXIT_CODE" = "_2" ] \ [ "_$EXIT_CODE" = "_2" ] \
|| die "failed redirect did not exit with code 2, got $EXIT_CODE" || die "failed redirect did not exit with code 2, got $EXIT_CODE"