Compare commits

..

210 Commits

Author SHA1 Message Date
Jordan Harband
65f0572bdc v0.33.7
Fixes
 - fix unassigned variable (#1665, #1664)
 - Fix for $path used by zsh (#1669)
 - `set -u`: ensure `NVM_USE_OUTPUT` is always set (#1671)
 - `install.sh`: Fix a bug that block that installation of node in install.sh (#1676)
 - `nvm install-latest-npm`: fix node 4-4.6

Documentation
 - Make `nvm cache clear` message less ambiguous (#1644)
 - Added missing piece (#1658)
2017-12-08 21:21:42 -08:00
Jordan Harband
b6a7a54d04 [Fix] nvm install-latest-npm: fix node 4-4.6 2017-12-08 21:20:59 -08:00
Jordan Harband
8a8dcbb393 Merge pull request #1676 from Quadric/fix-node-version-in-install-script
`install.sh`: Fix a bug that block that installation of node in install.sh
2017-12-03 11:47:39 -08:00
Ahmad Magdy
bacdd95591 Update test/install_script/nvm_install_with_node_version to use nvm ls 8 instead of grep! 2017-11-30 15:33:01 +01:00
Ahmad Magdy
4b0563093c Add test nvm_install_with_node_version under test/install_script 2017-11-30 15:23:37 +01:00
Ahmad Magdy
c7ac69bfbb Fix nvm_install_node function in install.sh script to not override the actual NODE_VERSION value 2017-11-30 14:47:42 +01:00
Jordan Harband
a57fe846e8 [Fix] set -u: ensure NVM_USE_OUTPUT is always set.
Fixes #1671.
2017-11-23 10:02:37 -06:00
Jordan Harband
7bfd1e0644 Merge pull request #1669 from mail6543210/master
Fix for $path used by zsh
2017-11-22 08:52:13 -08:00
mail6543210
9352f6913a Add symbolic link for printf in case of command-not-found 2017-11-22 02:01:38 +08:00
mail6543210
16d3e6d2dc Remove unnecessary, incorrect workaround.
The "\printf" calls zsh shell builtin instead of `command printf` in scripting.

The workaround is no longer needed given 91a29c0.
2017-11-22 00:57:27 +08:00
mail6543210
91a29c0da2 Fix for $path used by zsh
"The lower-case version of PATH is an array parameter
bound to the scalar upper-case parameter."
-- http://www.zsh.org/mla/users/2015/msg00178.html
2017-11-20 22:32:13 +08:00
Jordan Harband
4b48556e92 Merge pull request #1665 from norpol/fix_issue_1664_unassigned_variable_20171115
Fix #1664: unassigned variable
2017-11-17 23:31:26 -06:00
Phileas Lebada
be171bba33 Add unset-variable as exit error 2017-11-15 17:19:05 +01:00
Phileas Lebada
049a86022f Add empty value to local variable 2017-11-15 17:17:57 +01:00
David Gatti
a7b7eec0c5 [Docs] Added missing piece
This sentence broke my brain when I read it the first time :) I hope this helps.
2017-11-08 01:02:15 +01:00
Jordan Harband
9953a52afb Merge pull request #1644 from citrusui/patch-1
[Docs] Make `nvm cache clear` message less ambiguous
2017-10-28 22:42:14 -07:00
Avery Magnotti
fc30e0ade4 Make nvm cache clear message less ambiguous 2017-10-28 20:30:28 -04:00
Jordan Harband
b546436113 v0.33.6 2017-10-23 23:53:26 -07:00
Darío Hereñú
016bc134d5 Typo 2017-10-23 02:23:04 -03:00
Peter Dave Hello
9c25a8f316 [Cleanup] Remove ghc related things in .travis.yml, cc #1619 2017-10-22 00:42:07 +08:00
Christopher Beland
a954458829 [Docs] Improve git installation instructions 2017-10-18 10:39:11 -04:00
Jordan Harband
09951b49c5 Only apps should have lockfiles 2017-10-05 13:34:54 -07:00
Jordan Harband
3b133fac2f [Fix] install-latest-npm: npm v5.4+ breaks on node v4.5 and v4.6. 2017-10-04 11:04:27 -07:00
Michał Gołębiowski-Owczarek
6ac8ebafba Add a Git .mailmap with my new name
In this way my past contributions are mapped correctly.
2017-10-04 12:55:41 +02:00
Jordan Harband
62fb0d0ad6 Merge pull request #1605 from PeterDaveHello/fix-install.sh
[Fix] install.sh shouldn't use not existed variable
2017-10-03 22:23:48 -07:00
Peter Dave Hello
a461a0fffc [Fix] install.sh shouldn't use not existed $NVM_PROFILE 2017-10-04 10:10:47 +08:00
Jordan Harband
6597e11971 v0.33.5 2017-09-29 12:50:27 -04:00
Jordan Harband
707d268a76 Merge pull request #1619 from PeterDaveHello/refactor-travis-config
Remove the manual ShellCheck install proecss on Travis CI
2017-09-28 10:45:49 -07:00
Peter Dave Hello
73ad812215 Remove the manual ShellCheck install proecss on Travis CI 2017-09-29 00:22:43 +08:00
Jordan Harband
8c578b864d [Fix] ensure all grep calls go through nvm_grep.
Fixes #1615.
2017-09-22 19:11:43 -07:00
Peter Dave Hello
d535c97d0f Enhance nvm debug with more tools info 2017-09-21 22:09:15 +08:00
Xandor Schiefer
334897ae39 Preserve PATH locations order when changing versions 2016-11-14 19:19:39 +02:00
Jordan Harband
7b8af94fc9 [Tests] retry io.js test runs, since iojs.org is flaky. 2017-09-08 01:32:54 -07:00
Peter Dave Hello
7753b24948 [Docs] Update README.md for Alpine linux reference
Add 4 packages as Alpine Linux wiki suggested:
(grep util-linux binutils findutils)

https://wiki.alpinelinux.org/wiki/How_to_get_regular_stuff_working
2017-09-07 18:00:08 +08:00
Xandor Schiefer
44ab611421 [Fix] unset NVM_RC_VERSION when unloading 2017-09-07 16:52:05 +02:00
Jordan Harband
c0b56d03a1 [Fix] install-latest-npm: io.js v1.0.x has weird behavior with npm v4.6.x.
- comment out node 0.6 test due to travis-ci breakage
2017-09-07 15:57:09 -07:00
Jordan Harband
d91b6197f3 v0.33.4 2017-09-04 22:59:50 -07:00
Jordan Harband
e3d1519567 [Fix] install-latest-npm: io.js v1.0.0 has weird behavior with npm v4.6.x. 2017-09-04 22:01:46 -07:00
Jordan Harband
6f19babbff v0.33.3 2017-09-03 12:46:59 -07:00
Jordan Harband
b3e25b15f9 nvm_install_latest_npm: npm v5.4+ breaks on node v4-4.4 and v5-5.9, due to missing Buffer.alloc. 2017-09-02 14:04:37 -07:00
Jordan Harband
cf5272e1a0 [Fix] set -u: nvm install: fix unbound vars
Fixes #1587.
2017-08-08 20:53:51 -07:00
Jordan Harband
3e1b4591bd [New] install.sh: install bash_completion via script method.
Fixes #1588.
2017-08-08 10:11:41 -07:00
Jordan Harband
389a53cca9 [Fix] set -u: nvm use: ensure these two vars don’t error out.
Fixes #1587.
2017-08-08 00:05:38 -07:00
Peter Dave Hello
248706d5f8 [New] Clean up git reflog history before git gc 2017-07-14 00:37:58 +08:00
Peter Dave Hello
ab591b07ef [New] Print $TERM_PROGRAM in nvm debug if it exists 2017-07-14 01:48:27 +08:00
Peter Dave Hello
38a568c9c9 [New] Add --auto to git gc to speed up install & upgrade 2017-07-11 09:19:02 +08:00
GeekBlogTV
b3bdbb2712 [Docs] updated to reflect current script output 2017-07-08 01:31:13 -05:00
Mike Ferrari
6921adb2f4 [Docs] add note about Linux troubleshooting 2017-06-26 12:22:34 -07:00
Peter Dave Hello
f37ddea78f [Docs] Fix typos in Docker instructions 2017-07-08 18:50:06 +08:00
Peter Dave Hello
1e69c4c77d [New] Speedup process to install nvm from git by dropping commit history 2017-04-02 15:49:01 +08:00
Peter Dave Hello
3ac49e5ef1 [New] Introduce Docker environment for nvm 2017-04-02 08:03:32 +08:00
Peter Dave Hello
0356839d05 [Fix] Adjust $CURL_COMPRESSED_FLAG usage for curl, fix #1562 2017-06-27 15:04:28 +08:00
Peter Dave Hello
b5034bb2b2 [bash completion] add missing install-latest-npm; remove undocumented clear-cache 2017-06-23 14:21:10 +08:00
Jiri Spac
d073bc96c7 [Docs] bump sample version numbers 2017-06-01 16:46:53 +02:00
Peter Dave Hello
11370fe823 [Fix] curl should fail if something wrong, fix #1556 2017-06-14 10:58:38 +08:00
Jordan Harband
cbdd41eee2 [New] nvm install: add --latest-npm option to automatically try to upgrade to the latest working version of npm.
- also add `nvm install-latest-npm` top-level command
2017-06-11 14:15:04 -07:00
J Huang
28fe93cd15 [Fix] nvm install -s: properly precompute clang version 2017-06-13 13:06:53 +08:00
J Huang
7965796569 [Fix] enable curl compression only on curl >=7.21.0
curl < 7.21.0 will output redirection reponse body to the output when compressed, which will cause tarball is prepended with redirection reponse body and leads to checksum mismatch.

 - add `nvm_curl_use_compression` and `nvm_curl_version`
2017-06-10 15:25:26 +08:00
Shiva Bhusal
d2644b22f9 [Docs] Install script - Improve installation guide
If installation is prompted to be successful, yet `which nvm` command returns `not found` then you might need to restart your terminal instance. Try opening a new tab/window in your terminal and retry.
2017-06-03 11:49:33 +05:45
Nicolás Bevacqua
051ef09daf Fix --version help text 2017-06-01 10:06:43 -03:00
Jordan Harband
3497474fef [Docs] move the install script to the top; put the notes in a separate section. 2017-05-26 21:09:59 -07:00
Peter Dave Hello
c3c2d350e9 [Tests] Fix cache for WITHOUT_CURL tests in Travis 2017-05-19 13:58:14 +08:00
Jordan Harband
4f626eac0d [Fix] set -u: when ALIAS is unset, don’t reference an unbound variable.
Fixes #1526.
2017-05-16 22:58:26 -07:00
Weston Ganger
7f3145bc98 [New] add support for $NVM_DIR/default-packages file 2017-03-28 09:37:14 -07:00
Jordan Harband
dc5dfe3bc1 [Fix] set IFS to default for all nvm commands.
Fixes #1227. Fixes #1244. Fixes #1514. Fixes #1518.
2017-04-28 00:41:55 -07:00
Jordan Harband
accd6ae298 [Fix] ensure if npm link fails, that $IFS is not improperly set.
https://github.com/creationix/nvm/issues/1519#issuecomment-297850323
2017-04-28 00:39:48 -07:00
Jumpei Ogawa
caa7de37af [Fix] set -u: ensure that potentially unbound variables aren’t called unchecked.
This commit is follow up for 853afbf.
Fixes remaining bug in #1363
2017-04-27 20:17:21 +09:00
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
Jordan Harband
40e40975eb v0.33.0 2016-12-29 21:22:13 -10:00
Jordan Harband
ae8eb80d0b make release should pop up the EDITOR for the annotated tag. 2016-12-29 21:22:08 -10:00
Jordan Harband
186509be24 [github] modify the issue template 2016-12-28 09:04:12 -10:00
Jordan Harband
853afbf595 Revert "Revert "[Fix] set -u: ensure that potentially unbound variables aren’t called unchecked.""
This reverts commit a8c465018e.

Fixes #1363.
2016-12-26 21:57:55 -08:00
Jordan Harband
a8c465018e Revert "[Fix] set -u: ensure that potentially unbound variables aren’t called unchecked."
This reverts commit 60239e39cd.
2016-12-25 12:18:56 -08:00
Jordan Harband
1cac5194b9 [github] Flesh out issue template a bit. 2016-12-25 12:07:08 -08:00
Peter Dave Hello
71b49f1744 Add GitHub issue template 2016-12-26 02:46:49 +08:00
Jordan Harband
60239e39cd [Fix] set -u: ensure that potentially unbound variables aren’t called unchecked.
Fixes #1363.
2016-12-25 11:31:37 -08:00
Jordan Harband
0f6997d90a [Tests] remove the unused and broken $NVM_PATH. 2016-12-16 11:23:23 -08:00
Jordan Harband
fcd6331f09 [Fix] remove the unused and broken $NVM_PATH.
Added in 359a83e. Fixes #1353.
2016-12-16 10:57:22 -08:00
Peter Dave Hello
2af47b0034 [Docs] Remove mixed addtional indent in the Bash completion codeblock 2016-12-03 21:33:54 +08:00
Peter Dave Hello
7c0dc2be68 [Docs] Make the indent in readme consistenly use soft tabs 2016-12-03 21:32:41 +08:00
Peter Dave Hello
d5340539d9 [Docs] Link version badge to the release page 2016-12-02 19:33:48 +08:00
Peter Dave Hello
45771499ee [Fix] nvm should respect CC/CXX env var
- Also set CC for Freebsd, not only CXX

 - Also set CC=cc, CXX=c++ on Mac OS by default as upstream

Reference:
1bd871655a/configure (L16-L17)
2016-11-29 15:30:01 +08:00
Peter Dave Hello
84575cf353 [Refactor] Use "case" instead of multi "if" 2016-11-28 03:39:48 +08:00
Jordan Harband
47c60dfc1d [Tests] add test to ensure that nvm unload unloads all functions. 2016-11-28 12:50:35 -08:00
Peter Dave Hello
c96c561c88 [Fix] nvm unload missed node_version_has_solaris_binary() 2016-11-28 18:35:32 +08:00
Peter Dave Hello
f29cd1a2ab [Fix] nvm unload missed NVM_CD_FLAGS NVM_BIN NVM_MAKE_JOBS NVM_PATH 2016-11-28 04:14:21 +08:00
Peter Dave Hello
00a1ee6c4d [Fix] nvm unload missed nvm_cache_dir() nvm_cd() 2016-11-28 04:10:42 +08:00
George Adams
a7648ebd9f [Fix] nvm install -s: aix: detect number of threads on aix and not just number of processors 2016-11-23 06:36:52 -05:00
Peter Dave Hello
26fec8035f [Docs] update alpine environment installation info 2016-11-28 02:43:59 +08:00
Peter Dave Hello
c58540666d [Docs] update readme about compile nodejs v0.10+ from src 2016-11-27 21:21:49 +08:00
Gibson Fahnestock
7f1917d0aa [Refactor] Rename NVM_CPU_THREADS to NVM_CPU_CORES 2016-11-24 18:04:14 +00:00
Peter Dave Hello
7d08ad4311 [Tests] also cache $HOME/.ghc for cabal 2016-11-25 23:57:08 +08:00
Jordan Harband
5b820a453c [Refactor] avoid S2181 spellcheck error. 2016-11-25 00:56:28 -06:00
Jordan Harband
af73102481 [Fix] fix a typo i made in 20ae7ee309 2016-11-25 00:35:33 -06:00
Peter Dave Hello
20ae7ee309 [Tests] Run shellcheck on nvm-exec in Travis CI 2016-11-24 14:07:56 +08:00
Peter Dave Hello
ac63638469 [Fix] add missing quotes for $NODE_VERSION in nvm-exec 2016-11-24 13:44:39 +08:00
Peter Dave Hello
7ed1e71944 [Refactor] Add missing backslash for dots
Related: #1279, 2a2b8bd, cadbbce
2016-11-24 13:47:20 +08:00
Peter Dave Hello
b7f9fbd3a7 [Tests] run shellcheck for bash_completion in Travis CI 2016-11-24 16:00:23 +08:00
Peter Dave Hello
9963660a11 [shellcheck] SC1004,SC2086 fixes in bash_completion 2016-11-24 15:59:16 +08:00
Peter Dave Hello
60ba4bca0c [Tests] Remove not working clang part until we refactor the workflow 2016-11-24 14:38:22 +08:00
Peter Dave Hello
e47b313b85 [readme] Auto install not exist version in zsh .nvmrc script
Fixes #1272.
2016-11-14 19:44:55 +08:00
Peter Dave Hello
4b4e71f05c [shellcheck] disable "Check exit code directly" warning on line 273, 666
We need to use both the exit state and result form the previous commit,
so SC2181 should be disabled here.
2016-11-23 22:04:45 +08:00
Peter Dave Hello
5508f8dc70 [Tests] switch to use Cabal to install ShellCheck
1. This can help speed up the apt process since we decrease the
complexity of apt sources and package dependencies resolving by dropping
an additional ppa source.

2. Stack doesn't update ShellCheck to v0.4.5 after it has been released
more than one month, Cabal can provide ShellCheck v0.4.5
2016-11-23 22:04:45 +08:00
Peter Dave Hello
1ffa41886a [New] Install bash programmble completions automatically 2015-05-23 14:07:34 +08:00
Peter Dave Hello
49e8068271 [CI] Drop manual apt source and package installation
- Use Travis CI apt addon source whitelist to load apt source
 - Use Travis CI apt addon to install additional packages

This can prevent duplicating apt package list update and dependencies
calculation which means it can speed up the CI build.
2016-11-17 21:11:48 +08:00
Jordan Harband
ab6be9c0c1 Merge pull request #1300 from PeterDaveHello/clang-llvm
[New] `nvm install -s`: Use clang as C/C++ compiler if detected

Fixes #902
2016-11-17 00:19:04 -08:00
Peter Dave Hello
61ae478c38 [Doc] Add current version on the top of README 2016-11-16 21:23:20 +08:00
Peter Dave Hello
8c03637023 [Fix] nvm install: Handle 'N/A' version instead of asking to install it
Fixes #1304.
2016-11-14 19:31:35 +08:00
Peter Dave Hello
65acb403ce Add nvm_clang_version to ensure clang version > 3.5 2016-11-14 12:28:41 +08:00
Peter Dave Hello
9f67d3ef66 [Tests] Upgrade clang from llvm in Travis-ci 2016-11-14 12:04:36 +08:00
Peter Dave Hello
38934bf16c [New] nvm install -s: Use clang as C/C++ compiler if detected.
Fixes #902.
2016-11-14 05:39:34 +08:00
Peter Dave Hello
03608291a6 [caching] nvm install: Do not remove src dir after compilation succeeds
This will help speed up the installation time for the non-first time
installation, especially can speed up the build time and test time on
Travis-CI as we'll cache .cache dir.
2016-11-14 03:45:52 +08:00
Peter Dave Hello
fd33179119 Revert "Also run git gc after nvm upgraded"
This reverts commit ce7f6d6e52.
2016-11-14 06:19:29 +08:00
Jordan Harband
e5316ddbe3 [Fix] allow uninstalls when files are nonwritable but self-owned.
Fixes #1270.
2016-11-13 00:09:29 -08:00
Peter Dave Hello
eab41ed8ef [Fix] add missing "command" prefix call for some commands 2016-11-13 04:53:41 +08:00
Peter Dave Hello
c5303a6973 Improve nvm_download_artifact() process, fix #1291
- Delete broken/checksum not matched local cache
 - More output message.
2016-11-13 04:02:06 +08:00
Peter Dave Hello
7ef38cf7e8 fix/retab indent in bash_completion [no-ci] 2016-11-11 19:43:36 +08:00
George Adams
8f82eab5db Add AIX support
Currently AIX isn't supported in nvm so I have made a few small changes
to make this work:
change tar to gtar for AIX
change make to gmake for AIX
Set ARCH as ppc64 for AIX
2016-11-10 13:52:00 -05:00
Peter Dave Hello
9c92b5a4ea [New] nvm install: Print the version that is being installed 2016-11-06 20:43:47 +08:00
Peter Dave Hello
f7763c8ba9 [Tests] die() in tests should quote "$@" for echo 2016-11-07 03:34:36 +08:00
Jordan Harband
24f8ae5c46 [New] support external install hook “$NVM_INSTALL_THIRD_PARTY_HOOK”.
Fixes #1207.
2016-11-03 23:42:55 -07:00
Qiangjun Ran
cadbbced20 [Tests] Replace all dots with backslash dots 2016-11-03 23:44:59 -07:00
Qiangjun Ran
2a2b8bdeb3 [Robustness] use backslash when sourcing in case of overridden dot
Fixes #1278.
2016-11-03 23:44:20 -07:00
Jordan Harband
942e9ab1f5 [Fix] bypass aliased cd in a few places.
Fixes #1284.
2016-11-03 10:08:24 -07:00
Peter Dave Hello
a458ccbb87 Retab tab to 4 spaces and use echo instead of cat in install.sh 2016-10-29 11:17:54 +08:00
Peter Dave Hello
ce7f6d6e52 Also run git gc after nvm upgraded 2016-10-28 09:08:54 +08:00
Peter Dave Hello
f3cddf8271 [Doc] Bold leading "Note:" in readme for readability 2016-10-28 11:20:12 +08:00
211 changed files with 2315 additions and 867 deletions

17
.dockerignore Normal file
View File

@@ -0,0 +1,17 @@
HEAD
.cache
v*
alias
# For testing
test/bak
.urchin.log
.urchin_stdout
test/**/test_output
node_modules/
npm-debug.log
.DS_Store
current

3
.gitattributes vendored
View File

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

41
.github/ISSUE_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,41 @@
<!-- Thank you for being interested in nvm! Please help us by filling out the following form if youre having trouble. If you have a feature request, or some other question, please feel free to clear out the form. Thanks! -->
- Operating system and version:
- `nvm debug` output:
<details>
<!-- do not delete the following blank line -->
```sh
```
</details>
- `nvm ls` output:
<details>
<!-- do not delete the following blank line -->
```sh
```
</details>
- How did you install `nvm`? (e.g. install script in readme, homebrew):
- What steps did you perform?
- What happened?
- What did you expect to happen?
- 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 you are having installation issues, or getting "N/A", what does `curl -I --compressed -v https://nodejs.org/dist/` print out?
<details>
<!-- do not delete the following blank line -->
```sh
```
</details>

7
.gitignore vendored
View File

@@ -1,3 +1,4 @@
# gitignore
HEAD
.cache
v*
@@ -14,3 +15,9 @@ npm-debug.log
.DS_Store
current
default-packages
# Only apps should have lockfiles
npm-shrinkwrap.json
package-lock.json
yarn.lock

1
.mailmap Normal file
View File

@@ -0,0 +1 @@
Michał Gołębiowski-Owczarek <m.goleb@gmail.com>

View File

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

1
.npmrc Normal file
View File

@@ -0,0 +1 @@
package-lock=false

View File

@@ -1,37 +1,43 @@
language: generic
dist: trusty
sudo: required
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-4.8
- g++-4.8
- zsh
- ksh
# - ksh
# - gcc-4.8
# - g++-4.8
cache:
directories:
- $HOME/.stack
- $HOME/.npm
- $TRAVIS_BUILD_DIR/.cache
- $TRAVIS_BUILD_DIR/node_modules
before_install:
- $SHELL --version 2> /dev/null || dpkg -s $SHELL 2> /dev/null || which $SHELL
- curl --version
- wget --version
- if [ -n "${SHELLCHECK-}" ]; then sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 575159689BEFB442 && echo 'deb http://download.fpcomplete.com/ubuntu precise main' | sudo tee /etc/apt/sources.list.d/fpco.list && sudo apt-get update && sudo apt-get install stack bc -y && stack setup && stack install ShellCheck && shellcheck --version ; fi
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*)
- 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'
script:
- if [ -n "${SHELLCHECK-}" ]; then shellcheck -s bash nvm.sh && shellcheck -s sh nvm.sh && shellcheck -s dash nvm.sh && shellcheck -s ksh nvm.sh && shellcheck -s bash install.sh ; fi
- if [ -z "${SHELLCHECK-}" ]; then make TEST_SUITE=$TEST_SUITE URCHIN=/tmp/urchin/package/urchin test-$SHELL ; fi
- 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 install.sh bash_completion nvm-exec ; fi
- if [ -n "${SHELL-}" ] && [ -n "${TEST_SUITE}" ]; then if [ "${TEST_SUITE}" = 'installation_iojs' ]; then travis_retry make TEST_SUITE=$TEST_SUITE URCHIN="$(npm bin)/urchin" test-$SHELL ; else make TEST_SUITE=$TEST_SUITE URCHIN="$(npm bin)/urchin" test-$SHELL; fi; fi
before_cache:
- if [ -n "$WITHOUT_CURL" ]; then sudo apt-get install curl -y ; fi
env:
global:
- CXX=g++-4.8
- CC=gcc-4.8
- PATH=$(echo $PATH | sed 's/::/:/')
- PATH="$(echo $PATH | sed 's/::/:/')"
- NVM_DIR="${TRAVIS_BUILD_DIR}"
matrix:
- MAKE_RELEASE=true
- DOCTOCCHECK=true
- SHELLCHECK=true
- SHELL=bash TEST_SUITE=install_script
- SHELL=sh TEST_SUITE=fast
@@ -50,22 +56,22 @@ env:
- SHELL=zsh TEST_SUITE=slow
# - SHELL=ksh TEST_SUITE=slow
- 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 WITHOUT_CURL=1
- SHELL=dash TEST_SUITE=installation_node WITHOUT_CURL=1
- 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 WITHOUT_CURL=1
- SHELL=zsh TEST_SUITE=installation_node WITHOUT_CURL=1
# - SHELL=ksh TEST_SUITE=installation_node
# - SHELL=ksh TEST_SUITE=installation_node WITHOUT_CURL=1
- 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 WITHOUT_CURL=1
- SHELL=dash TEST_SUITE=installation_iojs WITHOUT_CURL=1
- 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 WITHOUT_CURL=1
- SHELL=zsh TEST_SUITE=installation_iojs WITHOUT_CURL=1
# - SHELL=ksh TEST_SUITE=installation_iojs
# - SHELL=ksh TEST_SUITE=installation_iojs WITHOUT_CURL=1

View File

@@ -1,15 +1,20 @@
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:
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 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.
- 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!

105
Dockerfile Normal file
View File

@@ -0,0 +1,105 @@
# Dockerized nvm development environment
#
# This Dockerfile is for building nvm development environment only,
# not for any distribution/production usage.
#
# Please note that it'll use about 1.2 GB disk space and about 15 minutes to
# build this image, it depends on your hardware.
# Use Ubuntu Trusty Tahr as base image as we're using on Travis CI
# I also tested with Ubuntu 16.04, should be good with it!
From ubuntu:14.04
MAINTAINER Peter Dave Hello <hsu@peterdavehello.org>
# Prevent dialog during apt install
ENV DEBIAN_FRONTEND noninteractive
# Pick a Ubuntu apt mirror site for better speed
# ref: https://launchpad.net/ubuntu/+archivemirrors
ENV UBUNTU_APT_SITE ubuntu.cs.utah.edu
# Disable src package source
RUN sed -i 's/^deb-src\ /\#deb-src\ /g' /etc/apt/sources.list
# Replace origin apt pacakge site with the mirror site
RUN sed -E -i "s/([a-z]+.)?archive.ubuntu.com/$UBUNTU_APT_SITE/g" /etc/apt/sources.list
RUN sed -i "s/security.ubuntu.com/$UBUNTU_APT_SITE/g" /etc/apt/sources.list
# Install apt packages
RUN apt update && \
apt upgrade -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" && \
apt install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" \
coreutils \
util-linux \
bsdutils \
file \
openssl \
ca-certificates \
ssh \
wget \
patch \
sudo \
htop \
dstat \
vim \
tmux \
curl \
git \
jq \
realpath \
zsh \
ksh \
ghc \
gcc-4.8 \
g++-4.8 \
cabal-install \
build-essential \
bash-completion && \
apt-get clean
# Set locale
RUN locale-gen en_US.UTF-8
# Print tool versions
RUN bash --version | head -n 1
RUN zsh --version
RUN ksh --version || true
RUN dpkg -s dash | grep ^Version | awk '{print $2}'
RUN git --version
RUN curl --version
RUN wget --version
RUN cabal --version
# Add user "nvm" as non-root user
RUN useradd -ms /bin/bash nvm
# Set sudoer for "nvm"
RUN echo 'nvm ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
# Switch to user "nvm" from now
USER nvm
# Shellcheck
RUN cabal update
RUN cabal install ShellCheck
RUN ~/.cabal/bin/shellcheck --version
RUN echo 'export PATH="~/.cabal/bin/:${PATH}"' >> $HOME/.bashrc
# nvm
COPY . /home/nvm/.nvm/
RUN sudo chown nvm:nvm -R $HOME/.nvm
RUN echo 'export NVM_DIR="$HOME/.nvm"' >> $HOME/.bashrc
RUN echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm' >> $HOME/.bashrc
RUN echo '[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion" # This loads nvm bash_completion' >> $HOME/.bashrc
# nodejs and tools
RUN bash -c 'source $HOME/.nvm/nvm.sh && \
nvm install node && \
npm install -g doctoc urchin && \
npm install --prefix "$HOME/.nvm/"'
# Set WORKDIR to nvm directory
WORKDIR /home/nvm/.nvm
ENTRYPOINT /bin/bash

View File

@@ -1,6 +1,6 @@
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
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)))
endif
# 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>`.
SHELLS := sh bash dash zsh # ksh (#574)
# 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)
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.
.PHONY: _ensure-clean
_ensure-clean:
@@ -62,7 +70,7 @@ _ensure-clean:
# Makes a release; invoke with `make TAG=<versionOrIncrementSpec> 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}; \
new_ver=`echo "$(TAG)" | sed 's/^v//'`; new_ver=$${new_ver:-patch}; \
if printf "$$new_ver" | grep -q '^[0-9]'; then \
@@ -74,4 +82,4 @@ release: _ensure-tag _ensure-clean
printf "=== Bumping version **$$old_ver** to **$$new_ver** before committing and tagging:\n=== TYPE 'proceed' TO PROCEED, anything else to abort: " && read response && [ "$$response" = 'proceed' ] || { echo 'Aborted.' >&2; exit 2; }; \
replace "$$old_ver" "$$new_ver" -- $(VERSIONED_FILES) && \
git commit -m "v$$new_ver" $(VERSIONED_FILES) && \
git tag -a -m "v$$new_ver" "v$$new_ver"
git tag -a "v$$new_ver"

View File

@@ -1,73 +1,53 @@
# Node Version Manager [![Build Status](https://travis-ci.org/creationix/nvm.svg?branch=master)][3]
# 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.7-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
- [Installation](#installation)
- [Install script](#install-script)
- [Verify installation](#verify-installation)
- [Manual install](#manual-install)
- [Manual upgrade](#manual-upgrade)
- [Usage](#usage)
- [Long-term support](#long-term-support)
- [Migrating global packages while installing](#migrating-global-packages-while-installing)
- [io.js](#iojs)
- [System version of node](#system-version-of-node)
- [Listing versions](#listing-versions)
- [.nvmrc](#nvmrc)
- [Deeper Shell Integration](#deeper-shell-integration)
- [License](#license)
- [Running tests](#running-tests)
- [Bash completion](#bash-completion)
- [Usage](#usage-1)
- [Compatibility Issues](#compatibility-issues)
- [Installing nvm on Alpine Linux](#installing-nvm-on-alpine-linux)
- [Problems](#problems)
- [Installation](#installation)
- [Install script](#install-script)
- [Verify installation](#verify-installation)
- [Important Notes](#important-notes)
- [Git install](#git-install)
- [Manual Install](#manual-install)
- [Manual upgrade](#manual-upgrade)
- [Usage](#usage)
- [Long-term support](#long-term-support)
- [Migrating global packages while installing](#migrating-global-packages-while-installing)
- [Default global packages from file while installing](#default-global-packages-from-file-while-installing)
- [io.js](#iojs)
- [System version of node](#system-version-of-node)
- [Listing versions](#listing-versions)
- [.nvmrc](#nvmrc)
- [Deeper Shell Integration](#deeper-shell-integration)
- [zsh](#zsh)
- [Calling `nvm use` automatically in a directory with a `.nvmrc` file](#calling-nvm-use-automatically-in-a-directory-with-a-nvmrc-file)
- [License](#license)
- [Running tests](#running-tests)
- [Bash completion](#bash-completion)
- [Usage](#usage-1)
- [Compatibility Issues](#compatibility-issues)
- [Installing nvm on Alpine Linux](#installing-nvm-on-alpine-linux)
- [Docker for development environment](#docker-for-development-environment)
- [Problems](#problems)
- [Mac OS "troubleshooting"](#mac-os-troubleshooting)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
## 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.
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)
- [nodist](https://github.com/marcelklehr/nodist)
Note: `nvm` does not support [Fish] either (see [#303](https://github.com/creationix/nvm/issues/303)). Alternatives exist, which are neither supported nor developed by us:
- [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
- [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
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)
- [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:
- [How to Install Command Line Tools in OS X Mavericks & Yosemite (Without Xcode)](http://osxdaily.com/2014/02/12/install-command-line-tools-mac-os-x/)
Note: On OS X, if you have/had a "system" node installed and want to install modules globally, keep in mind that:
- When using nvm you do not need `sudo` to globally install a module with `npm -g`, so instead of doing `sudo npm install -g grunt`, do instead `npm install -g grunt`
- If you have an `~/.npmrc` file, make sure it does not contain any `prefix` settings (which is not compatible with nvm)
- You can (but should not?) keep your previous "system" node install, but nvm will only be available to your user account (the one used to install nvm). This might cause version mismatches, as other users will be using `/usr/local/lib/node_modules/*` VS your user account using `~/.nvm/versions/node/vX.X.X/lib/node_modules/*`
Homebrew installation is not supported. If you have issues with homebrew-installed `nvm`, please `brew uninstall` it, and install it using the instructions below, before filing an issue.
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.
### Install script
To install or update nvm, you can use the [install script][2] using cURL:
```sh
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | bash
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.7/install.sh | bash
```
or Wget:
```sh
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | bash
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.7/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>
@@ -82,7 +62,16 @@ Eg: `curl ... | NVM_DIR=/usr/local/nvm bash` for a global install.
<sub>*NB. The installer can use `git`, `curl`, or `wget` to download `nvm`, whatever is available.*</sub>
Note: On OS X, if you get `nvm: command not found` after running the install script, your system may not have a [.bash_profile file] where the command is set up. Simply create one with `touch ~/.bash_profile` and run the install script again.
**Note:** On Linux, after running the install script, if you get `nvm: command not found` or see no feedback from your terminal after you type:
```sh
command -v nvm
```
simply close your current terminal, open a new terminal, and try verifying again.
**Note:** On OS X, if you get `nvm: command not found` after running the install script, one of the following might be the reason:-
- your system may not have a [`.bash_profile file`] where the command is set up. Simply create one with `touch ~/.bash_profile` and run the install script again
- you might need to restart your terminal instance. Try opening a new tab/window in your terminal and retry.
If the above doesn't fix the problem, open your `.bash_profile` and add the following line of code:
@@ -90,7 +79,6 @@ If the above doesn't fix the problem, open your `.bash_profile` and add the foll
- For more information about this issue and possible workarounds, please [refer here](https://github.com/creationix/nvm/issues/576)
### Verify installation
To verify that nvm has been installed, do:
@@ -101,15 +89,59 @@ 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.
### Manual install
### Important Notes
For manual install create a folder somewhere in your filesystem with the `nvm.sh` file inside it. I put mine in `~/.nvm`.
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.
Or if you have `git` installed (requires git v1.7+):
**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)
- [nodist](https://github.com/marcelklehr/nodist)
1. clone this repo
1. check out the latest version
1. activate nvm by sourcing it from your shell
**Note:** `nvm` does not support [Fish] either (see [#303](https://github.com/creationix/nvm/issues/303)). Alternatives exist, which are neither supported nor developed by us:
- [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
- [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:
- [[#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)
**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:
- [How to Install Command Line Tools in OS X Mavericks & Yosemite (Without Xcode)](http://osxdaily.com/2014/02/12/install-command-line-tools-mac-os-x/)
**Note:** On OS X, if you have/had a "system" node installed and want to install modules globally, keep in mind that:
- When using nvm you do not need `sudo` to globally install a module with `npm -g`, so instead of doing `sudo npm install -g grunt`, do instead `npm install -g grunt`
- If you have an `~/.npmrc` file, make sure it does not contain any `prefix` settings (which is not compatible with nvm)
- You can (but should not?) keep your previous "system" node install, but nvm will only be available to your user account (the one used to install nvm). This might cause version mismatches, as other users will be using `/usr/local/lib/node_modules/*` VS your user account using `~/.nvm/versions/node/vX.X.X/lib/node_modules/*`
Homebrew installation is not supported. If you have issues with homebrew-installed `nvm`, please `brew uninstall` it, and install it using the instructions below, before filing an issue.
**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 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.
### Git install
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`
2. `cd ~/.nvm` and check out the latest version with `git checkout v0.33.7`
3. activate nvm by sourcing it from your shell: `. nvm.sh`
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
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
```
### 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
export NVM_DIR="$HOME/.nvm" && (
@@ -119,7 +151,7 @@ export NVM_DIR="$HOME/.nvm" && (
) && . "$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)
```sh
@@ -210,6 +242,18 @@ nvm install 6 --reinstall-packages-from=5
nvm install v4.2 --reinstall-packages-from=iojs
```
### Default global packages from file while installing
If you have a list of default packages you want installed every time you install a new version we support that too. You can add anything npm would accept as a package argument on the command line.
```sh
# $NVM_DIR/default-packages
rimraf
object-inspect@1.0.2
stevemao/left-pad
```
### io.js
If you want to install [io.js](https://github.com/iojs/io.js/):
@@ -281,7 +325,7 @@ NVM_IOJS_ORG_MIRROR=https://iojs.org/dist nvm install iojs-v1.0.3
### .nvmrc
You can create a `.nvmrc` file containing version number in the project root directory (or any parent directory).
`nvm use`, `nvm install`, `nvm exec`, `nvm run`, and `nvm which` will all respect an `.nvmrc` file when a version is not supplied.
`nvm use`, `nvm install`, `nvm exec`, `nvm run`, and `nvm which` will all respect an `.nvmrc` file when a version is not supplied on the command line.
For example, to make nvm default to the latest 5.9 release for the current directory:
@@ -305,7 +349,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.
#### Zsh
#### zsh
##### Calling `nvm use` automatically in a directory with a `.nvmrc` file
@@ -322,8 +366,10 @@ load-nvmrc() {
if [ -n "$nvmrc_path" ]; then
local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")
if [ "$nvmrc_node_version" != "N/A" ] && [ "$nvmrc_node_version" != "$node_version" ]; then
nvm use
if [ "$nvmrc_node_version" = "N/A" ]; then
nvm install
elif [ "$nvmrc_node_version" != "$node_version" ]; then
nvm use
fi
elif [ "$node_version" != "$(nvm version default)" ]; then
echo "Reverting to nvm default version"
@@ -339,7 +385,7 @@ load-nvmrc
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:
@@ -374,7 +420,7 @@ Nota bene: Avoid running nvm while the tests are running.
To activate, you need to source `bash_completion`:
```sh
[[ -r $NVM_DIR/bash_completion ]] && . $NVM_DIR/bash_completion
[[ -r $NVM_DIR/bash_completion ]] && . $NVM_DIR/bash_completion
```
Put the above sourcing line just below the sourcing line for nvm in your profile (`.bashrc`, `.bash_profile`).
@@ -382,29 +428,35 @@ Put the above sourcing line just below the sourcing line for nvm in your profile
### Usage
nvm:
$ nvm [tab][tab]
alias deactivate install ls run unload
clear-cache exec list ls-remote unalias use
current help list-remote reinstall-packages uninstall version
> $ nvm <kbd>Tab</kbd>
```
alias deactivate install ls run unload
clear-cache exec list ls-remote unalias use
current help list-remote reinstall-packages uninstall version
```
nvm alias:
> $ nvm alias <kbd>Tab</kbd>
```
default
```
$ nvm alias [tab][tab]
default
$ nvm alias my_alias [tab][tab]
v0.6.21 v0.8.26 v0.10.28
> $ nvm alias my_alias <kbd>Tab</kbd>
```
v0.6.21 v0.8.26 v0.10.28
```
nvm use:
$ nvm use [tab][tab]
my_alias default v0.6.21 v0.8.26 v0.10.28
> $ nvm use <kbd>Tab</kbd>
```
my_alias default v0.6.21 v0.8.26 v0.10.28
```
nvm uninstall:
$ nvm uninstall [tab][tab]
my_alias default v0.6.21 v0.8.26 v0.10.28
> $ nvm uninstall <kbd>Tab</kbd>
```
my_alias default v0.6.21 v0.8.26 v0.10.28
```
## Compatibility Issues
`nvm` will encounter some issues if you have some non-default settings set. (see [#606](/../../issues/606))
@@ -429,44 +481,81 @@ In order to provide the best performance (and other optimisations), nvm will dow
Alpine Linux, unlike mainstream/traditional Linux distributions, is based on [busybox](https://www.busybox.net/), a very compact (~5MB) Linux distribution. Busybox (and thus Alpine Linux) uses a different C/C++ stack to most mainstream/traditional Linux distributions - [musl](https://www.musl-libc.org/). This makes binary programs built for such mainstream/traditional incompatible with Alpine Linux, thus we cannot simply `nvm install X` on Alpine Linux and expect the downloaded binary to run correctly - you'll likely see "...does not exist" errors if you try that.
There is a `-s` flag for `nvm install` which requests nvm download Node source and compile it locally but currently (May 2016), this is not available for Node versions newer than v0.10 so unless you need an older Node version, this won't help you. Work is in progress on source-builds for newer Node versions but is not yet complete.
There is a `-s` flag for `nvm install` which requests nvm download Node source and compile it locally.
If installing nvm on Alpine Linux *is* still what you want or need to do, you should be able to achieve this by running the following from you Alpine Linux shell:
```sh
apk add bash
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | /bin/bash
apk add -U curl bash ca-certificates openssl ncurses coreutils python2 make gcc g++ libgcc linux-headers grep util-linux binutils findutils
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.7/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.
As a potential alternative, @mhart (a Node contributor) has some [Docker images for Alpine Linux with Node and optionally, npm, pre-installed](https://github.com/mhart/alpine-node).
## Docker for development environment
To make the development and testing work easier, we have a Dockerfile for development usage, which is based on Ubuntu 14.04 base image, prepared with essential and useful tools for `nvm` development, to build the docker image of the environment, run the docker command at the root of `nvm` repository:
```sh
$ docker build -t nvm-dev .
```
This will package your current nvm repository with our pre-defiend development environment into a docker image named `nvm-dev`, once it's built with success, validate your image via `docker images`:
```sh
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nvm-dev latest 9ca4c57a97d8 7 days ago 1.22 GB
```
If you got no error message, now you can easily involve in:
```sh
$ docker run -it nvm-dev -h nvm-dev
nvm@nvm-dev:~/.nvm$
```
Please note that it'll take about 15 minutes to build the image and the image size would be about 1.2GB, so it's not suitable for production usage.
For more information and documentation about docker, please refer to its official website:
- https://www.docker.com/
- https://docs.docker.com/
## 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.
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
On Arch Linux and other systems using python3 by default, before running *install* you need to:
- 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:
```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
[2]: https://github.com/creationix/nvm/blob/v0.32.1/install.sh
[2]: https://github.com/creationix/nvm/blob/v0.33.7/install.sh
[3]: https://travis-ci.org/creationix/nvm
[4]: https://github.com/creationix/nvm/releases/tag/v0.33.7
[Urchin]: https://github.com/scraperwiki/urchin
[Fish]: http://fishshell.com

View File

@@ -2,6 +2,10 @@
# bash completion for Node Version Manager (NVM)
if ! nvm &> /dev/null; then
return
fi
__nvm_generate_completion()
{
declare current_word
@@ -17,12 +21,13 @@ __nvm_commands ()
current_word="${COMP_WORDS[COMP_CWORD]}"
COMMANDS='\
help install uninstall use run exec \
alias unalias reinstall-packages \
current list ls list-remote ls-remote \
clear-cache deactivate unload \
version which'
COMMANDS='
help install uninstall use run exec
alias unalias reinstall-packages
current list ls list-remote ls-remote
install-latest-npm
cache deactivate unload
version version-remote which'
if [ ${#COMP_WORDS[@]} == 4 ]; then
@@ -56,8 +61,8 @@ __nvm_aliases ()
{
declare aliases
aliases=""
if [ -d $NVM_DIR/alias ]; then
aliases="$(cd $NVM_DIR/alias && find $PWD -type f | sed "s:$PWD/::")"
if [ -d "$NVM_DIR/alias" ]; then
aliases="$(cd "$NVM_DIR/alias" && command find "$PWD" -type f | command sed "s:$PWD/::")"
fi
echo "${aliases} node stable unstable iojs"
}
@@ -85,8 +90,8 @@ __nvm ()
# called bashcompinit that will create a complete in ZSH. If the user is in
# ZSH, load and run bashcompinit before calling the complete function.
if [[ -n ${ZSH_VERSION-} ]]; then
autoload -U +X bashcompinit && bashcompinit
autoload -U +X bashcompinit && bashcompinit
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() {
echo "${NVM_DIR:-"$HOME/.nvm"}"
printf %s "${NVM_DIR:-"$HOME/.nvm"}"
}
nvm_latest_version() {
echo "v0.32.1"
echo "v0.33.7"
}
nvm_profile_is_bash_or_zsh() {
local TEST_PROFILE
TEST_PROFILE="${1-}"
case "${TEST_PROFILE-}" in
*"/.bashrc" | *"/.bash_profile" | *"/.zshrc")
return
;;
*)
return 1
;;
esac
}
#
@@ -27,6 +40,8 @@ nvm_source() {
NVM_SOURCE_URL="$NVM_SOURCE"
if [ "_$NVM_METHOD" = "_script-nvm-exec" ]; then
NVM_SOURCE_URL="https://raw.githubusercontent.com/creationix/nvm/$(nvm_latest_version)/nvm-exec"
elif [ "_$NVM_METHOD" = "_script-nvm-bash-completion" ]; then
NVM_SOURCE_URL="https://raw.githubusercontent.com/creationix/nvm/$(nvm_latest_version)/bash_completion"
elif [ -z "$NVM_SOURCE_URL" ]; then
if [ "_$NVM_METHOD" = "_script" ]; then
NVM_SOURCE_URL="https://raw.githubusercontent.com/creationix/nvm/$(nvm_latest_version)/nvm.sh"
@@ -49,11 +64,12 @@ nvm_node_version() {
nvm_download() {
if nvm_has "curl"; then
curl -q "$@"
curl --compressed -q "$@"
elif nvm_has "wget"; then
# Emulate curl with wget
ARGS=$(echo "$*" | command sed -e 's/--progress-bar /--progress=bar /' \
-e 's/-L //' \
-e 's/--compressed //' \
-e 's/-I /--server-response /' \
-e 's/-s /-q /' \
-e 's/-o /-O /' \
@@ -70,7 +86,7 @@ install_nvm_from_git() {
if [ -d "$INSTALL_DIR/.git" ]; then
echo "=> nvm is already installed in $INSTALL_DIR, trying to update using git"
command printf "\r=> "
command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" fetch 2> /dev/null || {
command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" fetch origin tag "$(nvm_latest_version)" --depth=1 2> /dev/null || {
echo >&2 "Failed to update nvm, run 'git fetch' in $INSTALL_DIR yourself."
exit 1
}
@@ -89,12 +105,12 @@ install_nvm_from_git() {
echo >&2 'Failed to add remote "origin" (or set the URL). Please report this!'
exit 2
}
command git --git-dir="${INSTALL_DIR}/.git" fetch origin --tags || {
command git --git-dir="${INSTALL_DIR}/.git" fetch origin tag "$(nvm_latest_version)" --depth=1 || {
echo >&2 'Failed to fetch origin with tags. Please report this!'
exit 2
}
else
command git clone "$(nvm_source)" "${INSTALL_DIR}" || {
command git clone "$(nvm_source)" -b "$(nvm_latest_version)" --depth=1 "${INSTALL_DIR}" || {
echo >&2 'Failed to clone nvm repo. Please report this!'
exit 2
}
@@ -111,8 +127,11 @@ install_nvm_from_git() {
fi
echo "=> Compressing and cleaning up git repository"
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!"
if ! command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" reflog expire --expire=now --all; then
echo >&2 "Your version of git is out of date. Please update it!"
fi
if ! command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" gc --auto --aggressive --prune=now ; then
echo >&2 "Your version of git is out of date. Please update it!"
fi
return
}
@@ -121,22 +140,22 @@ install_nvm_from_git() {
# Automatically install Node.js
#
nvm_install_node() {
local NODE_VERSION
NODE_VERSION="$(nvm_node_version)"
local NODE_VERSION_LOCAL
NODE_VERSION_LOCAL="$(nvm_node_version)"
if [ -z "$NODE_VERSION" ]; then
if [ -z "$NODE_VERSION_LOCAL" ]; then
return 0
fi
echo "=> Installing Node.js version $NODE_VERSION"
nvm install "$NODE_VERSION"
echo "=> Installing Node.js version $NODE_VERSION_LOCAL"
nvm install "$NODE_VERSION_LOCAL"
local CURRENT_NVM_NODE
CURRENT_NVM_NODE="$(nvm_version current)"
if [ "$(nvm_version "$NODE_VERSION")" == "$CURRENT_NVM_NODE" ]; then
echo "=> Node.js version $NODE_VERSION has been successfully installed"
if [ "$(nvm_version "$NODE_VERSION_LOCAL")" == "$CURRENT_NVM_NODE" ]; then
echo "=> Node.js version $NODE_VERSION_LOCAL has been successfully installed"
else
echo >&2 "Failed to install Node.js $NODE_VERSION"
echo >&2 "Failed to install Node.js $NODE_VERSION_LOCAL"
fi
}
@@ -144,9 +163,11 @@ install_nvm_as_script() {
local INSTALL_DIR
INSTALL_DIR="$(nvm_install_dir)"
local NVM_SOURCE_LOCAL
NVM_SOURCE_LOCAL=$(nvm_source script)
NVM_SOURCE_LOCAL="$(nvm_source script)"
local NVM_EXEC_SOURCE
NVM_EXEC_SOURCE=$(nvm_source script-nvm-exec)
NVM_EXEC_SOURCE="$(nvm_source script-nvm-exec)"
local NVM_BASH_COMPLETION_SOURCE
NVM_BASH_COMPLETION_SOURCE="$(nvm_source script-nvm-bash-completion)"
# Downloading to $INSTALL_DIR
mkdir -p "$INSTALL_DIR"
@@ -158,17 +179,32 @@ install_nvm_as_script() {
nvm_download -s "$NVM_SOURCE_LOCAL" -o "$INSTALL_DIR/nvm.sh" || {
echo >&2 "Failed to download '$NVM_SOURCE_LOCAL'"
return 1
}
} &
nvm_download -s "$NVM_EXEC_SOURCE" -o "$INSTALL_DIR/nvm-exec" || {
echo >&2 "Failed to download '$NVM_EXEC_SOURCE'"
return 2
}
} &
nvm_download -s "$NVM_BASH_COMPLETION_SOURCE" -o "$INSTALL_DIR/bash_completion" || {
echo >&2 "Failed to download '$NVM_BASH_COMPLETION_SOURCE'"
return 2
} &
for job in $(jobs -p | sort)
do
wait "$job" || return $?
done
chmod a+x "$INSTALL_DIR/nvm-exec" || {
echo >&2 "Failed to mark '$INSTALL_DIR/nvm-exec' as executable"
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
# (eg: PROFILE=~/.myprofile)
@@ -197,15 +233,12 @@ nvm_detect_profile() {
fi
if [ -z "$DETECTED_PROFILE" ]; then
if [ -f "$HOME/.profile" ]; then
DETECTED_PROFILE="$HOME/.profile"
elif [ -f "$HOME/.bashrc" ]; then
DETECTED_PROFILE="$HOME/.bashrc"
elif [ -f "$HOME/.bash_profile" ]; then
DETECTED_PROFILE="$HOME/.bash_profile"
elif [ -f "$HOME/.zshrc" ]; then
DETECTED_PROFILE="$HOME/.zshrc"
fi
for EACH_PROFILE in ".profile" ".bashrc" ".bash_profile" ".zshrc"
do
if DETECTED_PROFILE="$(nvm_try_profile "${HOME}/${EACH_PROFILE}")"; then
break
fi
done
fi
if [ ! -z "$DETECTED_PROFILE" ]; then
@@ -228,8 +261,7 @@ nvm_check_global_modules() {
local NPM_GLOBAL_MODULES
NPM_GLOBAL_MODULES="$(
npm list -g --depth=0 |
command sed '/ npm@/d' |
command sed '/ (empty)$/d'
command sed -e '/ npm@/d' -e '/ (empty)$/d'
)"
local MODULE_COUNT
@@ -240,23 +272,24 @@ nvm_check_global_modules() {
)"
if [ "${MODULE_COUNT}" != '0' ]; then
cat <<-'END_MESSAGE'
=> You currently have modules installed globally with `npm`. These will no
=> longer be linked to the active version of Node when you install a new node
=> with `nvm`; and they may (depending on how you construct your `$PATH`)
=> override the binaries of modules installed with `nvm`:
# shellcheck disable=SC2016
echo '=> You currently have modules installed globally with `npm`. These will no'
# shellcheck disable=SC2016
echo '=> longer be linked to the active version of Node when you install a new node'
# shellcheck disable=SC2016
echo '=> with `nvm`; and they may (depending on how you construct your `$PATH`)'
# shellcheck disable=SC2016
echo '=> override the binaries of modules installed with `nvm`:'
echo
END_MESSAGE
command printf %s\\n "$NPM_GLOBAL_MODULES"
cat <<-'END_MESSAGE'
=> If you wish to uninstall them at a later point (or re-install them under your
=> `nvm` Nodes), you can remove them from the system Node as follows:
$ nvm use system
$ npm uninstall -g a_module
END_MESSAGE
echo '=> If you wish to uninstall them at a later point (or re-install them under your'
# shellcheck disable=SC2016
echo '=> `nvm` Nodes), you can remove them from the system Node as follows:'
echo
echo ' $ nvm use system'
echo ' $ npm uninstall -g a_module'
echo
fi
}
@@ -289,30 +322,49 @@ nvm_do_install() {
local NVM_PROFILE
NVM_PROFILE="$(nvm_detect_profile)"
local INSTALL_DIR
INSTALL_DIR="$(nvm_install_dir)"
local PROFILE_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"
BASH_OR_ZSH=false
if [ -z "${NVM_PROFILE-}" ] ; then
echo "=> Profile not found. Tried ${NVM_PROFILE} (as defined in \$PROFILE), ~/.bashrc, ~/.bash_profile, ~/.zshrc, and ~/.profile."
local TRIED_PROFILE
if [ -n "${PROFILE}" ]; then
TRIED_PROFILE="${NVM_PROFILE} (as defined in \$PROFILE), "
fi
echo "=> Profile not found. Tried ${TRIED_PROFILE-}~/.bashrc, ~/.bash_profile, ~/.zshrc, and ~/.profile."
echo "=> Create one of them and run this script again"
echo "=> Create it (touch ${NVM_PROFILE}) and run this script again"
echo " OR"
echo "=> Append the following lines to the correct file yourself:"
command printf "${SOURCE_STR}"
else
if ! command grep -qc '/nvm.sh' "$NVM_PROFILE"; then
echo "=> Appending source string to $NVM_PROFILE"
command printf "$SOURCE_STR" >> "$NVM_PROFILE"
else
echo "=> Source string already in ${NVM_PROFILE}"
if nvm_profile_is_bash_or_zsh "${NVM_PROFILE-}"; then
BASH_OR_ZSH=true
fi
if ! command grep -qc '/nvm.sh' "$NVM_PROFILE"; then
echo "=> Appending nvm source string to $NVM_PROFILE"
command printf "${SOURCE_STR}" >> "$NVM_PROFILE"
else
echo "=> nvm source string already in ${NVM_PROFILE}"
fi
# shellcheck disable=SC2016
if ${BASH_OR_ZSH} && ! command grep -qc '$NVM_DIR/bash_completion' "$NVM_PROFILE"; then
echo "=> Appending bash_completion source string to $NVM_PROFILE"
command printf "$COMPLETION_STR" >> "$NVM_PROFILE"
else
echo "=> bash_completion source string already in ${NVM_PROFILE}"
fi
fi
if ${BASH_OR_ZSH} && [ -z "${NVM_PROFILE-}" ] ; then
echo "=> Please also append the following lines to the if you are using bash/zsh shell:"
command printf "${COMPLETION_STR}"
fi
# Source nvm
# shellcheck source=/dev/null
. "${INSTALL_DIR}/nvm.sh"
\. "$(nvm_install_dir)/nvm.sh"
nvm_check_global_modules
@@ -321,7 +373,10 @@ nvm_do_install() {
nvm_reset
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
command printf "${COMPLETION_STR}"
fi
}
#
@@ -329,10 +384,10 @@ nvm_do_install() {
# during the execution of the install script
#
nvm_reset() {
unset -f nvm_reset nvm_has nvm_latest_version \
nvm_source nvm_download install_nvm_as_script install_nvm_from_git \
nvm_detect_profile nvm_check_global_modules nvm_do_install \
nvm_install_dir nvm_node_version nvm_install_node
unset -f nvm_has nvm_install_dir nvm_latest_version nvm_profile_is_bash_or_zsh \
nvm_source nvm_node_version nvm_download install_nvm_from_git nvm_install_node \
install_nvm_as_script nvm_try_profile nvm_detect_profile nvm_check_global_modules \
nvm_do_install nvm_reset
}
[ "_$NVM_ENV" = "_testing" ] || nvm_do_install

View File

@@ -2,10 +2,11 @@
DIR="$(command cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. "$DIR/nvm.sh" --no-use
# shellcheck disable=SC1090
\. "$DIR/nvm.sh" --no-use
if [ -n "$NODE_VERSION" ]; then
nvm use $NODE_VERSION > /dev/null || exit 127
nvm use "$NODE_VERSION" > /dev/null || exit 127
elif ! nvm use >/dev/null 2>&1; then
echo "No NODE_VERSION provided; no .nvmrc file found" >&2
exit 127

917
nvm.sh

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "nvm",
"version": "0.32.1",
"version": "0.33.7",
"description": "Node Version Manager - Simple bash script to manage multiple active node.js versions",
"directories": {
"test": "test"
@@ -13,7 +13,8 @@
"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/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": {
"type": "git",
@@ -35,6 +36,7 @@
"devDependencies": {
"replace": "^0.3.0",
"semver": "^5.0.1",
"urchin": "^0.0.5"
"urchin": "^0.0.5",
"doctoc": "^1.2.0"
}
}

View File

@@ -1,8 +1,8 @@
#!/bin/sh
. ../../../nvm.sh
\. ../../../nvm.sh
die () { echo $@ ; exit 1; }
die () { echo "$@" ; exit 1; }
OUTPUT="$(nvm alias foo/bar baz 2>&1)"
EXPECTED_OUTPUT="Aliases in subdirectories are not supported."

View File

@@ -1,8 +1,8 @@
#!/bin/sh
. ../../../nvm.sh
\. ../../../nvm.sh
die () { echo $@ ; exit 1; }
die () { echo "$@" ; exit 1; }
OUTPUT="$(nvm unalias foo/bar 2>&1)"
EXPECTED_OUTPUT="Aliases in subdirectories are not supported."

View File

@@ -1,9 +1,9 @@
#!/bin/sh
. ../../../nvm.sh
. ../../common.sh
\. ../../../nvm.sh
\. ../../common.sh
die () { echo $@ ; exit 1; }
die () { echo "$@" ; exit 1; }
if [ -n "$ZSH_VERSION" ]; then
# set clobber option in order to test that this does not produce any

View File

@@ -1,4 +1,4 @@
#!/bin/sh
. ../../../nvm.sh
\. ../../../nvm.sh
[ $(nvm alias test-stable-1 | wc -l) = '2' ]

View File

@@ -1,9 +1,9 @@
#!/bin/sh
. ../../../nvm.sh
. ../../common.sh
\. ../../../nvm.sh
\. ../../common.sh
die () { echo $@ ; exit 1; }
die () { echo "$@" ; exit 1; }
NVM_ALIAS_OUTPUT=$(nvm alias | strip_colors)

View File

@@ -1,9 +1,9 @@
#!/bin/sh
. ../../../nvm.sh
. ../../common.sh
\. ../../../nvm.sh
\. ../../common.sh
die () { echo $@ ; cleanup ; exit 1; }
die () { echo "$@" ; cleanup ; exit 1; }
cleanup () {
rm -rf "$(nvm_alias_path)/stable"
rm -rf "$(nvm_alias_path)/unstable"

View File

@@ -1,9 +1,9 @@
#!/bin/sh
. ../../../nvm.sh
. ../../common.sh
\. ../../../nvm.sh
\. ../../common.sh
die () { echo $@ ; exit 1; }
die () { echo "$@" ; exit 1; }
NVM_ALIAS_OUTPUT="$(nvm alias | strip_colors)"
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-stable-1 -> 0.0.1 (-> v0.0.1)' \

View File

@@ -1,9 +1,9 @@
#!/bin/sh
. ../../../common.sh
\. ../../../common.sh
die () { echo $@ ; exit 1; }
die () { echo "$@" ; exit 1; }
. ../../../../nvm.sh
\. ../../../../nvm.sh
ALIAS="$(nvm_resolve_alias loopback | strip_colors)"
[ "_$ALIAS" = "_∞" ] || die "nvm_resolve_alias loopback was not ∞; got $ALIAS"

View File

@@ -1,9 +1,9 @@
#!/bin/sh
. ../../../common.sh
\. ../../../common.sh
die () { echo $@ ; exit 1; }
die () { echo "$@" ; exit 1; }
. ../../../../nvm.sh
\. ../../../../nvm.sh
ALIAS="$(nvm_resolve_local_alias loopback | strip_colors)"
[ "_$ALIAS" = "_∞" ] || die "nvm_resolve_local_alias loopback was not ∞; got $ALIAS"

View File

@@ -2,12 +2,14 @@
set -ex
. ../../../../nvm.sh
. ../../../common.sh
\. ../../../../nvm.sh
\. ../../../common.sh
LTS_ALIAS_PATH="$(nvm_alias_path)/lts"
die () { echo $@ ; exit 1; }
rm -rf "${LTS_ALIAS_PATH}"
die () { echo "$@" ; exit 1; }
[ ! -d "${LTS_ALIAS_PATH}" ] || die "'${LTS_ALIAS_PATH}' exists and should not"

View File

@@ -1,6 +1,6 @@
#!/bin/sh
. ../../../../nvm.sh
\. ../../../../nvm.sh
LTS_ALIAS_PATH="$(nvm_alias_path)/lts"

View File

@@ -1,6 +1,6 @@
#!/bin/sh
. ../../../../nvm.sh
\. ../../../../nvm.sh
LTS_ALIAS_PATH="$(nvm_alias_path)/lts"

View File

@@ -1,10 +1,10 @@
#!/bin/sh
. ../../common.sh
\. ../../common.sh
die () { echo $@ ; exit 1; }
die () { echo "$@" ; exit 1; }
. ../../../nvm.sh
\. ../../../nvm.sh
nvm alias default 0.1 >/dev/null || die "'nvm alias default 0.1' failed"

View File

@@ -1,8 +1,8 @@
#!/bin/sh
die () { echo $@ ; exit 1; }
die () { echo "$@" ; exit 1; }
. ../../../nvm.sh
\. ../../../nvm.sh
EXIT_CODE=$(nvm_resolve_alias ; echo $?)
[ $EXIT_CODE = "1" ] || die "nvm_resolve_alias without an argument did not return 1; got $EXIT_CODE"

View File

@@ -1,8 +1,8 @@
#!/bin/sh
die () { echo $@ ; exit 1; }
die () { echo "$@" ; exit 1; }
. ../../../nvm.sh
\. ../../../nvm.sh
EXIT_CODE=$(nvm_resolve_local_alias ; echo $?)
[ "_$EXIT_CODE" = "_1" ] || die "nvm_resolve_local_alias without an argument did not return 1; got $EXIT_CODE"

View File

@@ -1,12 +1,12 @@
#!/bin/sh
. ../../../nvm.sh
\. ../../../nvm.sh
mkdir -p "${NVM_DIR}/v0.0.2"
mkdir -p "${NVM_DIR}/v0.0.20"
mkdir -p "${NVM_DIR}/versions/node/v0.12.0"
die () { echo $@ ; exit 1; }
die () { echo "$@" ; exit 1; }
# The result should contain only the appropriate version numbers.

View File

@@ -1,6 +1,6 @@
#!/bin/sh
. ../../../nvm.sh
\. ../../../nvm.sh
nvm which nonexistent_version
[ "_$?" = "_1" ]

View File

@@ -1,11 +1,11 @@
#!/bin/sh
. ../../../nvm.sh
\. ../../../nvm.sh
mkdir "${NVM_DIR}/v0.0.2"
mkdir "${NVM_DIR}/v0.0.20"
die () { echo $@ ; exit 1; }
die () { echo "$@" ; exit 1; }
# The result should contain only the appropriate version numbers.

View File

@@ -1,12 +1,12 @@
#!/bin/sh
. ../../../nvm.sh
\. ../../../nvm.sh
mkdir "${NVM_DIR}/v0.1.3"
mkdir "${NVM_DIR}/v0.2.3"
mkdir "${NVM_DIR}/v0.20.3"
die () { echo $@ ; exit 1; }
die () { echo "$@" ; exit 1; }
# The result should contain only the appropriate version numbers.

View File

@@ -1,6 +1,6 @@
#!/bin/sh
. ../../../nvm.sh
\. ../../../nvm.sh
nvm ls nonexistent_version
[ "$?" = "3" ]

View File

@@ -1,6 +1,6 @@
#!/bin/sh
. ../../../nvm.sh
\. ../../../nvm.sh
nvm ls io
[ "$?" = "3" ]

View File

@@ -1,6 +1,6 @@
#!/bin/sh
. ../../../nvm.sh
\. ../../../nvm.sh
nvm ls node_
[ "$?" = "3" ]

View File

@@ -1,8 +1,8 @@
#!/bin/sh
. ../../../nvm.sh
\. ../../../nvm.sh
die () { echo $@ ; exit 1; }
die () { echo "$@" ; exit 1; }
mkdir "${NVM_DIR}/v0.2.3"
mkdir "${NVM_DIR}/v0.3.3"

View File

@@ -1,8 +1,8 @@
#!/bin/sh
die () { echo $@ ; exit 1; }
die () { echo "$@" ; exit 1; }
. ../../../nvm.sh
\. ../../../nvm.sh
mkdir -p "${NVM_DIR}/v0.0.1"
mkdir -p "${NVM_DIR}/v0.0.3"

View File

@@ -1,6 +1,6 @@
#!/bin/sh
. ../../../nvm.sh
\. ../../../nvm.sh
mkdir "${NVM_DIR}/v0.0.1"
mkdir "${NVM_DIR}/v0.0.3"

View File

@@ -1,6 +1,6 @@
#!/bin/sh
. ../../../nvm.sh
\. ../../../nvm.sh
mkdir "${NVM_DIR}/v0.1.3"
mkdir "${NVM_DIR}/v0.2.3"

View File

@@ -1,6 +1,6 @@
#!/bin/sh
. ../../../nvm.sh
\. ../../../nvm.sh
mkdir "${NVM_DIR}/v0.1.3"
mkdir "${NVM_DIR}/v0.2.3"

View File

@@ -1,8 +1,8 @@
#!/bin/sh
die () { echo $@ ; exit 1; }
die () { echo "$@" ; exit 1; }
. ../../../nvm.sh
\. ../../../nvm.sh
mkdir -p "${NVM_DIR}/v0.0.1"
mkdir -p "${NVM_DIR}/v0.0.3"

View File

@@ -1,8 +1,8 @@
#!/bin/sh
die () { echo $@ ; exit 1; }
die () { echo "$@" ; exit 1; }
. ../../../nvm.sh
\. ../../../nvm.sh
mkdir -p "${NVM_DIR}/versions/node/v0.12.1"
mkdir "${NVM_DIR}/v0.1.3"

View File

@@ -1,6 +1,6 @@
#!/bin/sh
. ../../../nvm.sh
\. ../../../nvm.sh
mkdir "${NVM_DIR}/v0.1.2"

View File

@@ -0,0 +1,18 @@
#!/bin/sh
\. ../../../nvm.sh
mkdir "${NVM_DIR}/v0.0.1"
mkdir "${NVM_DIR}/v0.0.3"
mkdir "${NVM_DIR}/v0.0.9"
mkdir "${NVM_DIR}/v0.3.1"
mkdir "${NVM_DIR}/v0.3.3"
mkdir "${NVM_DIR}/v0.3.9"
mkdir -p "${NVM_DIR}/versions/node/v0.12.87"
mkdir -p "${NVM_DIR}/versions/node/v0.12.9"
mkdir -p "${NVM_DIR}/versions/io.js/v0.1.2"
mkdir -p "${NVM_DIR}/versions/io.js/v0.10.2"
set -e
IFS='' nvm ls

View File

@@ -2,7 +2,7 @@
set -ex
. ../../nvm.sh
\. ../../nvm.sh
nvm alias test v0.1.2

View File

@@ -2,9 +2,9 @@
set -ex
die () { echo $@ ; exit 1; }
die () { echo "$@" ; exit 1; }
. ../../nvm.sh
\. ../../nvm.sh
nvm deactivate 2>&1

View File

@@ -4,21 +4,19 @@ set -ex
mkdir -p ../../v0.2.3
die () { echo $@ ; exit 1; }
die () { echo "$@" ; exit 1; }
[ `expr $PATH : ".*v0.2.3/.*/bin"` = 0 ] || echo "WARNING: Unexpectedly found v0.2.3 already active" >&2
[ `expr $PATH : ".*v0.2.3/.*/bin.*"` = 0 ] || echo "WARNING: Unexpectedly found v0.2.3 already active" >&2
. ../../nvm.sh
\. ../../nvm.sh
nvm use --delete-prefix v0.2.3 || die "Failed to activate v0.2.3"
[ `expr "$PATH" : ".*v0.2.3/.*/bin"` != 0 ] || die "PATH not set up properly"
[ `expr "$NODE_PATH" : ".*v0.2.3/.*/lib/node_modules"` = 0 ] || die "NODE_PATH should not contain (npm root -g)"
[ `expr "$NVM_BIN" : ".*v0.2.3/bin"` != 0 ] || die "NODE_BIN should contain bin directory path"
[ `expr "$NVM_PATH" : ".*v0.2.3/lib/node"` != 0 ] || die "NODE_PATH should contain lib node directory path"
[ `expr "$PATH" : ".*v0.2.3/.*/bin.*"` != 0 ] || die "PATH not set up properly"
[ `expr "$NODE_PATH" : ".*v0.2.3/.*/lib/node_modules.*"` = 0 ] || die "NODE_PATH should not contain (npm root -g)"
# ^ note: NODE_PATH should not contain `npm root -g` since globals should not be requireable
[ `expr "$NVM_BIN" : ".*v0.2.3/bin"` != 0 ] || die "NODE_BIN should contain bin directory path"
nvm deactivate || die "Failed to deactivate v0.2.3"
[ `expr "$PATH" : ".*v0.2.3/.*/bin"` = 0 ] || die "PATH not cleaned properly"
[ `expr "$NODE_PATH" : ".*v0.2.3/.*/lib/node_modules"` = 0 ] || die "NODE_PATH not cleaned properly"
[ `expr "$PATH" : ".*v0.2.3/.*/bin.*"` = 0 ] || die "PATH not cleaned properly"
[ `expr "$NODE_PATH" : ".*v0.2.3/.*/lib/node_modules.*"` = 0 ] || die "NODE_PATH not cleaned properly"
[ "_$NVM_BIN" = "_" ] || die "NVM_BIN should be unset: got '$NVM_BIN'"
[ "_$NVM_PATH" = "_" ] || die "NVM_PATH should be unset: got '$NVM_PATH'"

View File

@@ -2,12 +2,12 @@
set -ex
die () { echo $@ ; cleanup ; exit 1; }
die () { echo "$@" ; cleanup ; exit 1; }
cleanup () {
rm -rf "${NVM_DIR}/v0.10.4"
}
. ../../nvm.sh
\. ../../nvm.sh
mkdir "${NVM_DIR}/v0.10.4"

View File

@@ -2,9 +2,9 @@
set -ex
die () { echo $@ ; exit 1; }
die () { echo "$@" ; exit 1; }
. ../../nvm.sh
\. ../../nvm.sh
set +ex # needed for stderr
OUTPUT="$(nvm install invalid.invalid 2>&1)"

View File

@@ -6,7 +6,7 @@ ALIAS_PATH="../../alias"
echo v0.1.2 > "${ALIAS_PATH}/test"
. ../../nvm.sh
\. ../../nvm.sh
nvm unalias test

View File

@@ -2,12 +2,27 @@
set -ex
die () { echo $@ ; exit 1; }
BEFORE="./before.tmp"
AFTER="./after.tmp"
. ../../nvm.sh
cleanup () { rm -f "${BEFORE}" "${AFTER}"; }
die () { echo "$@" ; cleanup ; exit 1; }
typeset -f | awk '/ \(\) $/ && !/^main / {print $1}' > "${BEFORE}"
set +e # TODO: fix
\. ../../nvm.sh
set -e
type nvm > /dev/null 2>&1 || die "nvm not loaded"
nvm unload
typeset -f | awk '/ \(\) $/ && !/^main / {print $1}' > "${AFTER}"
! type nvm > /dev/null 2>&1 || die "nvm not unloaded"
DIFF="$(diff "${BEFORE}" "${AFTER}" ||:)"
[ -z "${DIFF}" ] || die "function pollution found: ${DIFF}"
cleanup

View File

@@ -2,13 +2,13 @@
set -ex
die () { echo $@ ; cleanup ; exit 1; }
die () { echo "$@" ; cleanup ; exit 1; }
cleanup() {
rm -rf "$(nvm_alias_path)/foo"
}
. ../../nvm.sh
\. ../../nvm.sh
nvm_make_alias foo foo

View File

@@ -2,9 +2,9 @@
set -ex
. ../common.sh
\. ../common.sh
die () { echo $@ ; cleanup ; exit 1; }
die () { echo "$@" ; cleanup ; exit 1; }
VERSION="v3.99.0"
@@ -13,7 +13,7 @@ cleanup() {
rm -rf "$(nvm_version_path "iojs-${VERSION}")"
}
. ../../nvm.sh
\. ../../nvm.sh
nvm deactivate || die "unable to deactivate; current: >$(nvm current)<"

View File

@@ -1,13 +1,13 @@
#!/bin/sh
set -ex
set -eux
cleanup() {
unset -f nvm_has_system_node nvm_print_npm_version
}
die() { echo $@ ; cleanup ; exit 1; }
die() { echo "$@" ; cleanup ; exit 1; }
. ../../nvm.sh
\. ../../nvm.sh
nvm_has_system_node() { return 0; }
nvm_print_npm_version() { command printf ' (npm v1.2.3)'; }

View File

@@ -3,7 +3,7 @@
set -ex
export NVM_SYMLINK_CURRENT=true
. ../../nvm.sh
\. ../../nvm.sh
rm -rf "${NVM_DIR}/v0.10.29"
mkdir "${NVM_DIR}/v0.10.29"

View File

@@ -2,7 +2,7 @@
set -ex
. ../../nvm.sh
\. ../../nvm.sh
TEST_NODE_VERSION="v0.10.29"

View File

@@ -2,6 +2,6 @@
set -ex
. ../../nvm.sh
\. ../../nvm.sh
nvm

View File

@@ -3,5 +3,5 @@
set -ex
set -- yes
. ../../nvm.sh
\. ../../nvm.sh
[ "$1" = yes ]

View File

@@ -1,9 +1,9 @@
#!/bin/sh
die () { echo $@ ; exit 1; }
die () { echo "$@" ; exit 1; }
. ../../../nvm.sh
. ../../common.sh
\. ../../../nvm.sh
\. ../../common.sh
assert_not_ok iojs_version_has_solaris_binary ""
assert_not_ok iojs_version_has_solaris_binary "foo"

View File

@@ -1,4 +1,21 @@
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.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 -
@@ -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.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 -
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.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
@@ -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.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 -
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.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 -

View File

@@ -18,5 +18,17 @@
v4.4.7  (LTS: Argon)
v4.5.0  (LTS: Argon)
v4.6.0  (LTS: Argon)
v4.6.1  (Latest LTS: Argon)
v6.9.0  (Latest LTS: Boron)
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)
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.16
v0.12.17
v0.12.18
v4.0.0
v4.1.0
v4.1.1
@@ -258,7 +259,13 @@
v4.4.7  (LTS: Argon)
v4.5.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.1.0
v5.1.1
@@ -291,4 +298,21 @@
v6.7.0
v6.8.0
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.16
v0.12.17
v0.12.18
iojs-v1.0.0
iojs-v1.0.1
iojs-v1.0.2
@@ -299,7 +300,13 @@
v4.4.7  (LTS: Argon)
v4.5.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.1.0
v5.1.1
@@ -332,4 +339,21 @@
v6.7.0
v6.8.0
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.6.0 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.6.0 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.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.16
v0.12.17
v0.12.18
v4.0.0
v4.1.0
v4.1.1
@@ -259,6 +260,12 @@ v4.4.7 Argon
v4.5.0 Argon
v4.6.0 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.1.0
v5.1.1
@@ -292,3 +299,20 @@ v6.7.0
v6.8.0
v6.8.1
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/boron|v6.9.0
lts/argon|v4.6.1
lts/boron|v6.10.0
lts/argon|v4.8.0

View File

@@ -1,9 +1,9 @@
#!/bin/sh
die () { echo $@ ; exit 1; }
die () { echo "$@" ; exit 1; }
. ../../../nvm.sh
. ../../common.sh
\. ../../../nvm.sh
\. ../../common.sh
# Invalid version numbers fail
assert_not_ok node_version_has_solaris_binary ""

View File

@@ -2,17 +2,17 @@
set -ex
die () { echo $@ ; cleanup ; exit 1; }
die () { echo "$@" ; cleanup ; exit 1; }
cleanup() {
unset -f nvm_download nvm_ls_remote nvm_ls_remote_iojs
}
. ../../../nvm.sh
\. ../../../nvm.sh
nvm deactivate 2>/dev/null || die 'unable to deactivate'
. ../../common.sh
\. ../../common.sh
REMOTE="$PWD/mocks/nvm_ls_remote.txt"
nvm_ls_remote() {

View File

@@ -2,15 +2,15 @@
set -ex
die () { echo $@ ; cleanup ; exit 1; }
die () { echo "$@" ; cleanup ; exit 1; }
cleanup() {
unset -f nvm_remote_version
}
. ../../../nvm.sh
\. ../../../nvm.sh
. ../../common.sh
\. ../../common.sh
nvm_remote_version() {
echo "NVM_VERSION_ONLY:${NVM_VERSION_ONLY-},NVM_LTS:${NVM_LTS-},PATTERN:${PATTERN-}"

View File

@@ -1,8 +1,8 @@
#!/bin/sh
die () { echo $@ ; exit 1; }
die () { echo "$@" ; exit 1; }
. ../../../nvm.sh
\. ../../../nvm.sh
[ "_$(nvm_add_iojs_prefix 1)" = "_iojs-v1" ] || die '"nvm_add_iojs_prefix 1" did not return "iojs-v1"'
[ "_$(nvm_add_iojs_prefix iojs-1)" = "_iojs-v1" ] || die '"nvm_add_iojs_prefix iojs-1" did not return "iojs-v1"'

View File

@@ -1,12 +1,12 @@
#!/bin/sh
die () { echo $@ ; cleanup ; exit 1; }
die () { echo "$@" ; cleanup ; exit 1; }
cleanup () {
rm -rf ../../../alias/test
}
. ../../../nvm.sh
\. ../../../nvm.sh
OUTPUT="$(nvm_alias 2>&1)"
EXPECTED_OUTPUT='An alias is required.'

View File

@@ -1,8 +1,8 @@
#!/bin/sh
die () { echo $@ ; exit 1; }
die () { echo "$@" ; exit 1; }
. ../../../nvm.sh
\. ../../../nvm.sh
[ "_$(nvm_alias_path)" = "_$NVM_DIR/alias" ] || die "nvm_alias_path did not requrn correct location"

View File

@@ -0,0 +1,43 @@
#!/bin/sh
die () { echo "$@" ; exit 1; }
\. ../../../nvm.sh
TEST_PATH=/usr/bin:/usr/local/bin
# New version dir
NEW_PATH=`nvm_change_path "$TEST_PATH" "/bin" "$NVM_DIR/versions/node/v7.1.0"`
[ "$NEW_PATH" = "$NVM_DIR/versions/node/v7.1.0/bin:/usr/bin:/usr/local/bin" ] || die "Not correctly changed: $NEW_PATH "
# Old version dir
NEW_PATH=`nvm_change_path "$TEST_PATH" "/bin" "$NVM_DIR/v0.1.2"`
[ "$NEW_PATH" = "$NVM_DIR/v0.1.2/bin:/usr/bin:/usr/local/bin" ] || die "Not correctly changed: $NEW_PATH "
TEST_PATH=/home/user/code/test/node_modules/.bin:$NVM_DIR/versions/node/v4.5.0/bin:/usr/bin:/usr/local/bin
# New version dir
NEW_PATH=`nvm_change_path "$TEST_PATH" "/bin" "$NVM_DIR/versions/node/v7.1.0"`
[ "$NEW_PATH" = "/home/user/code/test/node_modules/.bin:$NVM_DIR/versions/node/v7.1.0/bin:/usr/bin:/usr/local/bin" ] || die "Not correctly changed: $NEW_PATH "
# Old version dir
NEW_PATH=`nvm_change_path "$TEST_PATH" "/bin" "$NVM_DIR/v0.1.2"`
[ "$NEW_PATH" = "/home/user/code/test/node_modules/.bin:$NVM_DIR/v0.1.2/bin:/usr/bin:/usr/local/bin" ] || die "Not correctly changed: $NEW_PATH "
EMPTY_PATH=
# New version dir
NEW_PATH=`nvm_change_path "$EMPTY_PATH" "/bin" "$NVM_DIR/versions/node/v7.1.0"`
[ "$NEW_PATH" = "$NVM_DIR/versions/node/v7.1.0/bin" ] || die "Not correctly prepended: $NEW_PATH "
# Old version dir
NEW_PATH=`nvm_change_path "$EMPTY_PATH" "/bin" "$NVM_DIR/v0.1.2"`
[ "$NEW_PATH" = "$NVM_DIR/v0.1.2/bin" ] || die "Not correctly prepended: $NEW_PATH "

View File

@@ -4,9 +4,9 @@ cleanup () {
rm tmp/emptyfile tmp/testfile
rmdir tmp
}
die () { echo $@ ; cleanup; exit 1; }
die () { echo "$@" ; cleanup; exit 1; }
. ../../../nvm.sh
\. ../../../nvm.sh
mkdir -p tmp
touch tmp/emptyfile

View File

@@ -0,0 +1,62 @@
#!/bin/sh
cleanup () {
unset -f die
}
die () { echo -e "$@" ; cleanup ; exit 1; }
if type "clang" > /dev/null 2>&1 ; then
clang_exec="$(type "clang")"
sudo rm -rf "${clang_exec}"
fi
if type "clang++" > /dev/null 2>&1 ; then
clangxx_exec="$(type "clang++")"
sudo rm -rf "${clangxx_exec}"
fi
NVM_ENV=testing \. ../../../nvm.sh
clang() {
if [ "$1" = "--version" ]; then
echo "${VERSION_MESSAGE}"
fi
}
assert_version_is() {
if [ "${1}" != "${2}" ]; then
die "Expected ${2}, got ${1}, origin version message:\n${VERSION_MESSAGE}"
return 1
fi
}
CLANG_VERSION_ON_DEBIAN_JESSIE="Debian clang version 3.5.0-10 (tags/RELEASE_350/final) (based on LLVM 3.5.0)
Target: x86_64-pc-linux-gnu
Thread model: posix"
CLANG_VERSION_ON_UBUNTU_TRUSTY="Ubuntu clang version 3.4-1ubuntu3 (tags/RELEASE_34/final) (based on LLVM 3.4)
Target: x86_64-pc-linux-gnu
Thread model: posix"
CLANG_VERSION_ON_ARCHLINUX="clang version 3.9.0 (tags/RELEASE_390/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/sbin"
CLANG_VERSION_ON_FREEBSD="FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512
Target: x86_64-unknown-freebsd10.3
Thread model: posix"
VERSION_MESSAGE="${CLANG_VERSION_ON_DEBIAN_JESSIE}"
assert_version_is "$(nvm_clang_version)" "3.5.0"
VERSION_MESSAGE="${CLANG_VERSION_ON_UBUNTU_TRUSTY}"
assert_version_is "$(nvm_clang_version)" "3.4"
VERSION_MESSAGE="${CLANG_VERSION_ON_ARCHLINUX}"
assert_version_is "$(nvm_clang_version)" "3.9.0"
VERSION_MESSAGE="${CLANG_VERSION_ON_FREEBSD}"
assert_version_is "$(nvm_clang_version)" "3.4.1"
cleanup

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

@@ -3,9 +3,9 @@
cleanup () {
unset -f nvm_compute_checksum
}
die () { echo $@ ; cleanup ; exit 1; }
die () { echo "$@" ; cleanup ; exit 1; }
. ../../../nvm.sh
\. ../../../nvm.sh
set -ex

View File

@@ -2,9 +2,9 @@
set -ex
die () { echo $@ ; exit 1; }
die () { echo "$@" ; exit 1; }
. ../../../nvm.sh
\. ../../../nvm.sh
set +x
OUTPUT="$(nvm_compute_checksum 2>&1 >/dev/null || echo)"

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

@@ -0,0 +1,38 @@
#!/bin/sh
cleanup () {
unset -f die
}
die () { echo -e "$@" ; cleanup ; exit 1; }
NVM_ENV=testing \. ../../../nvm.sh
curl() {
if [ "$1" = "-V" ]; then
echo "${VERSION_MESSAGE}"
fi
}
CURL_VERSION_ON_ARCHLINUX_WITH_LIBZ="curl 7.54.0 (x86_64-pc-linux-gnu) libcurl/7.54.0 OpenSSL/1.1.0f zlib/1.2.11 libpsl/0.17.0 (+libicu/59.1) libssh2/1.8.0 nghttp2/1.22.0
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy PSL"
CURL_VERSION_ON_ARCHLINUX_WITHOUT_LIBZ="curl 7.54.0 (x86_64-pc-linux-gnu) libcurl/7.54.0 OpenSSL/1.1.0f zlib/1.2.11 libpsl/0.17.0 (+libicu/59.1) libssh2/1.8.0 nghttp2/1.22.0
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL TLS-SRP HTTP2 UnixSockets HTTPS-proxy PSL"
CURL_VERSION_ON_CENTOS6_WITH_LIBZ="curl 7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.19.1 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
Protocols: tftp ftp telnet dict ldap ldaps http file https ftps scp sftp
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz"
VERSION_MESSAGE="${CURL_VERSION_ON_ARCHLINUX_WITH_LIBZ}"
nvm_curl_use_compression || die "nvm_curl_use_compression should return 0"
VERSION_MESSAGE="${CURL_VERSION_ON_ARCHLINUX_WITHOUT_LIBZ}"
! nvm_curl_use_compression || die "nvm_curl_use_compression should return 1 without libz support"
VERSION_MESSAGE="${CURL_VERSION_ON_CENTOS6_WITH_LIBZ}"
! nvm_curl_use_compression || die "nvm_curl_use_compression should return 1 when curl < 7.21.0"
cleanup

View File

@@ -0,0 +1,32 @@
#!/bin/sh
cleanup () {
unset -f die
unset -f curl
}
die () { echo -e "$@" ; cleanup ; exit 1; }
NVM_ENV=testing \. ../../../nvm.sh
curl() {
if [ "$1" = "-V" ]; then
echo "${VERSION_MESSAGE}"
fi
}
assert_version_is() {
if [ "${1}" != "${2}" ]; then
die "Expected ${2}, got ${1}, origin version message:\n${VERSION_MESSAGE}"
return 1
fi
}
CURL_VERSION_MESSAGE="curl 7.54.0 (x86_64-pc-linux-gnu) libcurl/7.54.0 OpenSSL/1.1.0f zlib/1.2.11 libpsl/0.17.0 (+libicu/59.1) libssh2/1.8.0 nghttp2/1.22.0
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy PSL"
VERSION_MESSAGE="${CURL_VERSION_MESSAGE}"
assert_version_is "$(nvm_curl_version)" "7.54.0"
cleanup

View File

@@ -0,0 +1,115 @@
#!/bin/sh
FILE="$NVM_DIR/default-packages"
die () { echo "$@" ; cleanup ; exit 1; }
setup () {
if [ -f $FILE ]; then
ORIG_DEFAULT_PACKAGES=$(cat $FILE)
mkdir ./tmp/ ||:
mv $FILE ./tmp/default-packages ||:
fi
touch $FILE
}
cleanup () {
rm -rf "$(nvm_version_path v6.10.1)" $FILE
if [ "$ORIG_DEFAULT_PACKAGES" != "" ]; then
rm -rf ./tmp/
echo "$ORIG_DEFAULT_PACKAGES" > $FILE
fi
}
setup
\. ../../../nvm.sh
cat > $FILE << EOF
rimraf
object-inspect@1.0.2
# commented-package
stevemao/left-pad
EOF
nvm install v6.10.1 2>&1
EXIT_CODE=$?
[ "_$EXIT_CODE" = "_0" ] || die "expected 'nvm install v6.10.1' to exit with 0, got $EXIT_CODE"
nvm exec v6.10.1 npm ls -g --depth=0 | grep -q 'rimraf'
if [ -z "$?" ]; then
die "expected 'nvm exec v6.10.1 npm ls -g --depth=0 | grep -q 'rimraf'' to exit with 0, got $?"
fi
cleanup
setup
\. ../../../nvm.sh
cat > $FILE << EOF
rimraf
object-inspect@1.0.2
# commented-package
stevemao/left-pad
EOF
nvm install v6.10.1 --skip-default-packages 2>&1
EXIT_CODE=$?
[ "_$EXIT_CODE" = "_0" ] || die "expected 'nvm install v6.10.1' to exit with 0, got $EXIT_CODE"
if nvm exec v6.10.1 npm ls -g --depth=0 | grep -q 'rimraf'; then
die "expected 'nvm exec v6.10.1 npm ls -g --depth=0 | grep -q 'rimraf'' to be empty"
fi
cleanup
setup
cat > $FILE << EOF
not~a~package~name
EOF
nvm install v6.10.1
EXIT_CODE=$?
[ "_$EXIT_CODE" = "_0" ] || die "expected 'nvm install v6.10.1' to exit with 0, got $EXIT_CODE"
if nvm exec v6.10.1 npm ls -g --depth=0 | grep -q 'not~a~package~name'; then
die "expected 'nvm exec v6.10.1 npm ls -g --depth=0 | grep -q 'not~a~package~name'' to exit with 1, got $?"
fi
cleanup
setup
cat > $FILE << EOF
object-inspect @ 1.0.2
EOF
nvm install v6.10.1 2>&1
EXIT_CODE=$?
[ "_$EXIT_CODE" = "_1" ] || die "expected 'nvm install v6.10.1' to exit with 1, got $EXIT_CODE"
if nvm exec v6.10.1 npm ls -g --depth=0 | grep -q 'object-inspect'; then
die "expected 'nvm exec v6.10.1 npm ls -g --depth=0 | grep -q 'object-inspect'' to exit with 1, got $?"
fi
cleanup
setup
rm -rf $FILE
nvm install v6.10.1 2>&1
EXIT_CODE=$?
[ "_$EXIT_CODE" = "_0" ] || die "expected 'nvm install v6.10.1' to exit with 0, got $EXIT_CODE"
if nvm exec v6.10.1 npm ls -g --depth=0 | grep -q 'object-inspect'; then
die "expected 'nvm exec v6.10.1 npm ls -g --depth=0 | grep -q 'object-inspect'' to exit with 1, got $?"
fi
touch $FILE
cleanup

View File

@@ -5,9 +5,9 @@ cleanup () {
alias npm='\npm'
unset -f nvm_has npm
}
die () { echo $@ ; exit 1; }
die () { echo "$@" ; exit 1; }
. ../../../nvm.sh
\. ../../../nvm.sh
OUTPUT="$(nvm_die_on_prefix 2>&1)"
EXPECTED_OUTPUT="First argument \"delete the prefix\" must be zero or one"

View File

@@ -1,10 +1,10 @@
#!/bin/sh
. ../../common.sh
\. ../../common.sh
die () { echo $@ ; exit 1; }
die () { echo "$@" ; exit 1; }
. ../../../nvm.sh
\. ../../../nvm.sh
EXPECTED_OUTPUT="nvm_ensure_default_set: a version is required"
OUTPUT="$(nvm_ensure_default_set 2>&1 >/dev/null)"

View File

@@ -1,11 +1,12 @@
#!/bin/sh
die () { echo $@ ; cleanup ; exit 1; }
die () { echo "$@" ; cleanup ; exit 1; }
cleanup () {
rm -rf "$(nvm_version_path v0.1.2)"
unset -f nvm_has_system_node nvm_has_system_iojs
}
. ../../../nvm.sh
\. ../../../nvm.sh
mkdir -p "$(nvm_version_path v0.1.2)"
@@ -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"
[ "_$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

View File

@@ -1,8 +1,8 @@
#!/bin/sh
die () { echo $@ ; exit 1; }
die () { echo "$@" ; exit 1; }
. ../../../nvm.sh
\. ../../../nvm.sh
[ "_$(nvm_ensure_version_prefix 1)" = "_v1" ] || die '"nvm_ensure_version_prefix 1" did not return "v1"'
[ "_$(nvm_ensure_version_prefix v1)" = "_v1" ] || die '"nvm_ensure_version_prefix v1" did not return "v1"'

View File

@@ -1,6 +1,6 @@
#!/bin/sh
die () { echo $@ ; cleanup ; exit 1; }
die () { echo "$@" ; cleanup ; exit 1; }
setup() {
cleanup
mkdir -p tmp_nvm_find_up/a/b/c/d
@@ -11,7 +11,7 @@ cleanup () {
rm -rf tmp_nvm_find_up
}
. ../../../nvm.sh
\. ../../../nvm.sh
setup

View File

@@ -1,8 +1,8 @@
#!/bin/sh
die () { echo $@ ; exit 1; }
die () { echo "$@" ; exit 1; }
. ../../../nvm.sh
\. ../../../nvm.sh
INPUT="0.1.2"
OUTPUT="$(nvm_format_version "$INPUT")"

View File

@@ -9,9 +9,9 @@ cleanup() {
export PATH=ORIG_PATH
}
die () { cleanup; echo $@ ; exit 1; }
die () { cleanup; echo "$@" ; exit 1; }
. ../../../nvm.sh
\. ../../../nvm.sh
# Directory where mocked binaries used by nvm_get_arch for each OS/arch are
# located

View File

@@ -5,10 +5,10 @@ set -ex
cleanup () {
unset -f nvm_download nvm_get_checksum_alg nvm_get_mirror
}
die () { echo $@ ; cleanup ; exit 1; }
die () { echo "$@" ; cleanup ; exit 1; }
set +e # TODO: fix
. ../../../nvm.sh
\. ../../../nvm.sh
set -e
nvm_get_mirror() {

View File

@@ -2,9 +2,11 @@
set -ex
die () { echo $@ ; exit 1; }
die () { echo "$@" ; exit 1; }
. ../../../nvm.sh
set +e # TODO: fix
\. ../../../nvm.sh
set -e
ALG="$(nvm_get_checksum_alg)"

View File

@@ -1,12 +1,12 @@
#!/bin/sh
die () { echo $@ ; cleanup ; exit 1; }
die () { echo "$@" ; cleanup ; exit 1; }
cleanup() {
unset -f nvm_has
}
. ../../../nvm.sh
\. ../../../nvm.sh
nvm_has() { return 1 ; }

Some files were not shown because too many files have changed in this diff Show More