Compare commits

..

76 Commits

Author SHA1 Message Date
Jordan Harband
31e58d1827 v0.31.4 2016-07-29 16:54:13 -07:00
Julien Gilli
a32b914bab Fix nvm on SmartOS setups using 64 bits pkgsrc repository
On SmartOS setups using 64 bits pkgsrc repositories, `nvm_get_arch`
would not handle pkg_info's output properly.

This would result in nvm not being to install any node binary when
running on SmartOS setups using a 64 bits pkgsrc repository.

This change fixes this problem, and fixes the tests suite on similar
setups.
2016-07-29 14:08:31 -07:00
Joe Lencioni
f51b1bf8ae Document required git version
git-describe was taught `--abbrev=0` in 1.5.0:

  https://github.com/git/git/blob/master/Documentation/RelNotes/1.5.0.txt

git-describe was taught `--match` in 1.5.5:

  https://github.com/git/git/blob/master/Documentation/RelNotes/1.5.5.txt

I don't see anything else potentially weird in here, so I think it is
safe to proclaim that the minimum git version required to run these
commands is 1.5.5.

Documenting this minimum version required here should help people debug
possible issues and help maintainers of this project understand the
impacts of modifying these commands in the future.
2016-07-28 10:51:00 -07:00
Jordan Harband
c874a17479 Merge pull request #1179 from lencioni/improve-upgrade-instructions
[Docs] Improve installation and upgrade instructions
2016-07-28 10:41:31 -07:00
Joe Lencioni
6eef4ce4d2 Use NVM_DIR in installation instructions
As suggested by @ljharb, this might be a little cleaner. I'm not
entirely sure, but in any case, it is consistent with the upgrade
instructions, so that is nice.
2016-07-28 10:36:51 -07:00
Joe Lencioni
54476476ab Use subshells for installation and upgrade instructions
I recently upgraded my copy of nvm and I was disappointed to be dropped
in the .nvm directory at the end of it. I also didn't like having to
copy and paste two separate blocks of code into my terminal, because I
missed the second one the first time around and was left in a slightly
confusing state. So, I decided to make this easier by utilizing
subshells and moving all of the instructions into one code block in this
document. I think this will improve people's experience maintaining this
tool.
2016-07-28 10:36:51 -07:00
Joe Lencioni
87a3a4425d Ensure git describe only matches version tags
`git describe` will match the latest tags, regardless of what it looks
like. We can make this a little safer by adding a `--match` flag to
match tags that look like version tags. This allows the maintainers of
this repo to more safely add other types of tags if they so wish,
without causing people to install or upgrade to those versions.
2016-07-28 10:36:51 -07:00
Joe Lencioni
17a3272b8a Ensure git describe gives latest tag
I recently ran the upgrade instructions and I ended up with the version
I was already on. This happened because `git describe` describes a
commit using the most recent tag reachable from it. Since I already had
a tag checked out, it was describing the tag I had already checked out.

Thankfully, `git describe` accepts an optional commit-ish, which it will
use instead of what we have currently checked out. Testing this in my
terminal now gives me the latest tag on origin, which is what I am
interested in when updating to the latest version.

  ~/.nvm ❯❯❯ git describe --abbrev=0 --tags
  v0.30.1
  ~/.nvm ❯❯❯ git describe --abbrev=0 --tags origin
  v0.31.3

I also added it to the manual install instructions for consistency and
extra safety.
2016-07-28 10:36:51 -07:00
Luke Childs
c08010f610 Fix typo in readme 2016-07-28 17:48:23 +01:00
Jordan Harband
2ee8ec886f Merge pull request #1178 from lukechilds/installation-improvements
Installation improvements
2016-07-28 08:49:28 -07:00
Luke Childs
978f7b4435 Only source nvm, not entire profile 2016-07-27 22:44:51 +01:00
Luke Childs
3417e9d9a3 Add message explaining how to use nvm 2016-07-27 22:39:50 +01:00
Luke Childs
eb4de62bc1 Remove incorrect message 2016-07-27 21:43:13 +01:00
Jordan Harband
8a199e00a2 Merge pull request #1173 from wiserweb/master
[Docs] Specify the lines that will be added by the installation script
2016-07-26 08:30:56 -07:00
wiserweb
6ac7ecf7dc Update README.markdown
Specifies the lines that will be added by the installation script.
2016-07-26 02:31:07 -04:00
Luke Childs
a09f225ec7 Update zsh-nvm upgrade command in readme 2016-07-24 21:13:51 +01:00
Jordan Harband
e0e1c0379a Merge pull request #1163 from sebthom/patch-1
[Fix] fix "find: warning: Unix filenames usually don't contain slashes" warning

Fixes #871.
2016-07-20 10:30:47 -07:00
Sebastian Thomschke
f4d57cc17d Fix for #871 find: warning: Unix filenames usually don't contain slashes 2016-07-20 13:31:47 +02:00
Jordan Harband
56417f88f9 v0.31.3 2016-07-20 00:51:48 -07:00
Jordan Harband
dbb65d98c2 Merge pull request #1070 from ljharb/display_lts_remote
[New] Add remote LTS support
2016-07-20 00:22:29 -07:00
Jordan Harband
fb49bf6f70 completion: add LTS aliases. 2016-07-18 23:40:32 -07:00
Jordan Harband
28822ff81e [Docs] update README for LTS. 2016-07-18 23:39:35 -07:00
Jordan Harband
876d117376 [Tests] add nvm run --lts tests. 2016-07-18 00:35:01 -07:00
Jordan Harband
b2c5616d7a [Tests] avoid accidental command execution in test failure message. 2016-07-17 19:54:26 -07:00
Jordan Harband
58a82a1d31 [Tests] add nvm exec --lts tests. 2016-07-17 19:54:10 -07:00
Jordan Harband
ecbd7d4572 [Tests] use -ex option during tests when possible
Relates to #1130
2016-07-10 19:58:32 -07:00
Jordan Harband
186eb8838d [Tests] make “nvm use iojs” test actually test that thing. 2016-07-07 15:38:34 -07:00
Jordan Harband
803adac676 [Fix] ensure proper checking of the “shwordsplit” zsh option. 2016-07-08 02:11:51 -07:00
Jordan Harband
940f850f8d [Tests] clean up some tests 2016-07-07 01:14:37 -07:00
Luke Childs
54d58f88db Link to zsh-nvm in readme 2016-07-09 09:24:01 +01:00
Jordan Harband
78a008c3c7 [Fix] use Solaris-compatible tail options.
Fixes #1148.
2016-07-06 15:31:25 -07:00
Owen Smith
8c8bf1204c [Fix] install should not exit after successful git clone
Fixes #1146 by grouping the commands that handle the error.

I also removed a subshell wrapper from a similar set of lines right
above. It looks to me like that is no longer necessary.
2016-07-05 22:03:52 -07:00
Jordan Harband
f3ce324e22 Merge pull request #1145 from robotlolita/patch-missing-version-error
`nvm install`: Improve error messages for missing versions
2016-07-05 19:10:45 -07:00
Quildreen Motta
730b253174 Updates tests for the new output messages 2016-07-05 21:40:45 -03:00
(Soreλ\a)
0f26656c2c npm -> nvm, and minor formatting issues 2016-07-05 20:34:08 -03:00
(Soreλ\a)
79d62fb16d Improve error messages for missing versions
`nvm use`, `nvm run` and others check if the version is installed before executing Node, but the error message could be clearer on what steps the user has to take to achieve what they want, this makes that clearer.
2016-07-05 19:55:39 -03:00
Mohit Agarwal
322d81d75f use git options instead of cd in install script 2016-07-06 01:26:06 +05:30
Cezar Augusto
70b8c59722 Add info about 'nvm: command not found'. Ref #576 2016-07-04 02:28:05 -03:00
Jordan Harband
42fedf6bc9 [Tests] add some basic nvm use --lts tests 2016-07-03 08:37:03 -07:00
Jordan Harband
4c010f442e [Tests] add tests for auto-creation of LTS aliases on nvm_ls_remote 2016-07-02 21:21:16 -07:00
Jordan Harband
0b40139caa [Tests] set x option in update mock to better locate failures 2016-07-02 18:42:57 -07:00
Jordan Harband
1bcd2f4743 Merge pull request #898 from PeterDaveHello/patch-1
[refactor] use "case" instead of if/else in install
2016-07-02 13:02:24 -07:00
Peter Dave Hello
d47887ae8f use sh syntax highlight in README.markdown 2016-07-02 14:01:39 +08:00
Peter Dave Hello
07bb79f405 Use case instead of multiple if/else statement. 2016-07-02 14:01:24 +08:00
Peter Dave Hello
9e09c30621 update nodejs version list 2016-07-01 23:39:54 +08:00
Jordan Harband
43c3c23928 [Fix] install script: remove more unnecessary cding.
Fixes #1137.
2016-06-30 13:26:31 -07:00
Jordan Harband
cb4e010de7 [Fix] install script: Don’t attempt to cd twice.
Fixes #1137.
2016-06-30 13:04:45 -07:00
Xavier Cambar
a24ff3e605 Optionally installs Node.js if a version is provided 2016-06-29 09:57:30 +02:00
Jordan Harband
39c119c5db Merge pull request #566 from xcambar/nvm_install_dir
[install script] Refactors NVM_DIR; adds tests
2016-06-28 23:17:27 -07:00
Xavier Cambar
6cee20a071 testing NVM_DIR 2016-06-28 12:36:08 +02:00
Jordan Harband
c4be39b8be [Fix] remove the need for sed -E
Fixes #1126
2016-06-27 21:50:45 -07:00
Jordan Harband
73aa35f508 [Tests] use $NVM_DIR instead of relative paths 2016-06-26 15:52:26 -07:00
Jordan Harband
f0668fd577 [Tests] nvm alias --lts: add tests 2016-06-26 15:11:37 -07:00
Jordan Harband
655830eb58 [Tests] nvm install --lts: add tests 2016-06-26 13:57:01 -07:00
Jordan Harband
e6606458f7 [Tests] add nvm version-remote unit tests. 2016-06-26 13:01:12 -07:00
Jordan Harband
ce60b6c44a [Tests] update test mocks 2016-06-25 17:03:46 -07:00
Jordan Harband
d2744014df [Tests] add some basic nvm ls-remote unit tests. 2016-06-25 17:00:19 -07:00
Jordan Harband
bcb1f0b1c7 nvm ls-remote: skip io.js lookup when LTS is set. 2016-07-17 10:54:24 -07:00
Jordan Harband
c3b16603c0 nvm uninstall: add --lts support 2016-07-17 20:18:05 -07:00
Jordan Harband
e1fdd316b7 [Refactor] create nvm_grep and remove standalone GREP_OPTIONS line. 2016-06-25 13:27:56 -07:00
Jordan Harband
859be3f6a1 nvm run: add --lts/--lts=argon support 2016-05-04 00:29:37 -07:00
Jordan Harband
45627d0a40 nvm exec: add --lts/--lts=argon support. 2016-05-03 23:18:44 -07:00
Jordan Harband
d1e51f361c nvm use: Add --lts/--lts=argon support 2016-05-01 23:41:39 -07:00
Jordan Harband
bf683272ea nvm alias: colorize LTS aliases. 2016-04-30 12:50:59 -07:00
Jordan Harband
c83664960e Automatically create LTS aliases every time we talk to nodejs.org/dist 2016-04-27 15:20:22 -07:00
Jordan Harband
17c9bef4aa nvm alias: add lts/ support. 2016-04-26 23:07:22 -07:00
Jordan Harband
9bd743e0be nvm install: Add support for --lts and --lts=argon 2016-04-25 00:44:24 -07:00
Jordan Harband
44f4817f7d Prevent attempts to nvm install --lts 2016-04-25 00:44:24 -07:00
Jordan Harband
4699657e98 Add --lts=argon etc, so the LTS line can be targeted. 2016-04-25 00:55:35 -07:00
Jordan Harband
1d908d8256 Add --lts support to nvm version-remote 2016-04-24 16:26:32 -07:00
Jordan Harband
584bdd8ba3 Print the LTS version on all versions with that info, but put the non-latest in gray. 2016-04-24 10:55:30 -07:00
Jordan Harband
ae07c3c345 Add support for nvm ls-remote --lts 2016-04-23 23:47:25 -07:00
Jordan Harband
cb326cb19d For now, keep the grep to do proper filtering 2016-04-22 10:25:47 -07:00
Jordan Harband
01c8b04fd5 Format LTS version when present. 2016-04-18 00:42:56 -07:00
Jordan Harband
865d2fe3d6 Include LTS version in nvm_ls_remote output. 2016-04-17 23:39:27 -07:00
Jordan Harband
9d8841a46c Ensure only the version string is printed out in relevant places. 2016-04-18 01:00:55 -07:00
88 changed files with 2073 additions and 503 deletions

1
.gitignore vendored
View File

@@ -7,6 +7,7 @@ alias
test/bak test/bak
.urchin.log .urchin.log
.urchin_stdout .urchin_stdout
test/**/test_output
node_modules/ node_modules/
npm-debug.log npm-debug.log

View File

@@ -9,7 +9,7 @@ Note: `nvm` does not support Windows (see [#284](https://github.com/creationix/n
- [nodist](https://github.com/marcelklehr/nodist) - [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: 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 to use utilities written for Bash in fish shell - [bass](https://github.com/edc/bass) allows you to use utilities written for Bash in fish shell
- [fast-nvm-fish](https://github.com/brigand/fast-nvm-fish) only works with version numbers (not aliases) but doesn't significantly slow your shell startup - [fast-nvm-fish](https://github.com/brigand/fast-nvm-fish) only works with version numbers (not aliases) but doesn't significantly slow your shell startup
- [fin](https://github.com/fisherman/fin) is a pure fish node version manager for fish shell - [fin](https://github.com/fisherman/fin) is a pure fish node version manager for fish shell
- [plugin-nvm](https://github.com/derekstavis/plugin-nvm) plugin for [Oh My Fish](https://github.com/oh-my-fish/oh-my-fish), which makes nvm and its completions available in fish shell - [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
@@ -28,32 +28,52 @@ Note: On OS X, if you have/had a "system" node installed and want to install mod
- If you have an `~/.npmrc` file, make sure it does not contain any `prefix` settings (which is not compatible with nvm) - 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/*` - 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. 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.
### Install script ### Install script
To install or update nvm, you can use the [install script][2] using cURL: To install or update nvm, you can use the [install script][2] using cURL:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.2/install.sh | bash ```sh
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.4/install.sh | bash
```
or Wget: or Wget:
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.31.2/install.sh | bash ```sh
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.31.4/install.sh | bash
```
<sub>The script clones the nvm repository to `~/.nvm` and adds the source line to your profile (`~/.bash_profile`, `~/.zshrc`, `~/.profile`, or `~/.bashrc`).</sub> <sub>The script clones the nvm repository to `~/.nvm` and adds the source line to your profile (`~/.bash_profile`, `~/.zshrc`, `~/.profile`, or `~/.bashrc`).</sub>
You can customize the install source, directory and profile using the `NVM_SOURCE`, `NVM_DIR`, and `PROFILE` variables. ```sh
Eg: `curl ... | NVM_DIR="path/to/nvm" bash` export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
```
You can customize the install source, directory, profile, and version using the `NVM_SOURCE`, `NVM_DIR`, `PROFILE`, and `NODE_VERSION` variables.
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> <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 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.
If the above doesn't fix the problem, open your `.bash_profile` and add the following line of code:
`source ~/.bashrc`
- For more information about this issue and possible workarounds, please [refer here](https://github.com/creationix/nvm/issues/576)
### Verify installation ### Verify installation
To verify that nvm has been installed, do: To verify that nvm has been installed, do:
command -v nvm ```sh
command -v nvm
```
which should output 'nvm' if the installation was successful. Please note that `which nvm` will not work, since `nvm` is a sourced shell function, not an executable binary. which should output 'nvm' if the installation was successful. Please note that `which nvm` will not work, since `nvm` is a sourced shell function, not an executable binary.
@@ -61,51 +81,75 @@ which should output 'nvm' if the installation was successful. Please note that `
For manual install create a folder somewhere in your filesystem with the `nvm.sh` file inside it. I put mine in `~/.nvm`. For manual install create a folder somewhere in your filesystem with the `nvm.sh` file inside it. I put mine in `~/.nvm`.
Or if you have `git` installed, then just clone it, and check out the latest version: Or if you have `git` installed (requires git v1.5.5+):
git clone https://github.com/creationix/nvm.git ~/.nvm && cd ~/.nvm && git checkout `git describe --abbrev=0 --tags` 1. clone this repo
1. check out the latest version
1. activate nvm by sourcing it from your shell
To activate nvm, you need to source it from your shell: ```sh
export NVM_DIR="$HOME/.nvm" && (
. ~/.nvm/nvm.sh git clone https://github.com/creationix/nvm.git "$NVM_DIR"
cd "$NVM_DIR"
git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" origin`
) && . "$NVM_DIR/nvm.sh"
```
Add these lines to your `~/.bashrc`, `~/.profile`, or `~/.zshrc` file to have it automatically sourced upon login: Add these lines to your `~/.bashrc`, `~/.profile`, or `~/.zshrc` file to have it automatically sourced upon login:
(you may have to add to more than one of the above files) (you may have to add to more than one of the above files)
export NVM_DIR="$HOME/.nvm" ```sh
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
```
### Manual upgrade ### Manual upgrade
For manual upgrade with `git`, change to the `$NVM_DIR`, pull down the latest changes, and check out the latest version: For manual upgrade with `git` (requires git v1.5.5+):
cd "$NVM_DIR" && git fetch origin && git checkout `git describe --abbrev=0 --tags` 1. change to the `$NVM_DIR`
1. pull down the latest changes
1. check out the latest version
1. activate the new version
After upgrading, don't forget to activate the new version: ```sh
(
. "$NVM_DIR/nvm.sh" cd "$NVM_DIR"
git fetch origin
git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" origin`
) && . "$NVM_DIR/nvm.sh"
```
## Usage ## Usage
To download, compile, and install the latest v5.0.x release of node, do this: To download, compile, and install the latest release of node, do this:
nvm install 5.0 ```sh
nvm install node
```
And then in any new shell just use the installed version: And then in any new shell just use the installed version:
nvm use 5.0 ```sh
nvm use node
```
Or you can just run it: Or you can just run it:
nvm run 5.0 --version ```sh
nvm run node --version
```
Or, you can run any arbitrary command in a subshell with the desired version of node: Or, you can run any arbitrary command in a subshell with the desired version of node:
nvm exec 4.2 node --version ```sh
nvm exec 4.2 node --version
```
You can also get the path to the executable to where it was installed: You can also get the path to the executable to where it was installed:
nvm which 5.0 ```sh
nvm which 5.0
```
In place of a version pointer like "0.10" or "5.0" or "4.2.1", you can use the following special default aliases with `nvm install`, `nvm use`, `nvm run`, `nvm exec`, `nvm which`, etc: In place of a version pointer like "0.10" or "5.0" or "4.2.1", you can use the following special default aliases with `nvm install`, `nvm use`, `nvm run`, `nvm exec`, `nvm which`, etc:
@@ -114,63 +158,101 @@ In place of a version pointer like "0.10" or "5.0" or "4.2.1", you can use the f
- `stable`: this alias is deprecated, and only truly applies to `node` `v0.12` and earlier. Currently, this is an alias for `node`. - `stable`: this alias is deprecated, and only truly applies to `node` `v0.12` and earlier. Currently, this is an alias for `node`.
- `unstable`: this alias points to `node` `v0.11` - the last "unstable" node release, since post-1.0, all node versions are stable. (in semver, versions communicate breakage, not stability). - `unstable`: this alias points to `node` `v0.11` - the last "unstable" node release, since post-1.0, all node versions are stable. (in semver, versions communicate breakage, not stability).
### Long-term support
Node has a [schedule](https://github.com/nodejs/LTS#lts_schedule) for long-term support (LTS) You can reference LTS versions in aliases and `.nvmrc` files with the notation `lts/*` for the latest LTS, and `lts/argon` for LTS releases from the "argon" line, for example. In addition, the following commands support LTS arguments:
- `nvm install --lts` / `nvm install --lts=argon`
- `nvm uninstall --lts` / `nvm uninstall --lts=argon`
- `nvm use --lts` / `nvm use --lts=argon`
- `nvm exec --lts` / `nvm exec --lts=argon`
- `nvm run --lts` / `nvm run --lts=argon`
- `nvm ls-remote --lts` / `nvm ls-remote --lts=argon`
- `nvm version-remote --lts` / `nvm version-remote --lts=argon`
Any time your local copy of `nvm` connects to https://nodejs.org, it will re-create the appropriate local aliases for all available LTS lines. These aliases (stored under `$NVM_DIR/alias/lts`), are managed by `nvm`, and you should not modify, remove, or create these files - expect your changes to be undone, and expect meddling with these files to cause bugs that will likely not be supported.
### Migrating global packages while installing
If you want to install a new version of Node.js and migrate npm packages from a previous version: If you want to install a new version of Node.js and migrate npm packages from a previous version:
nvm install node --reinstall-packages-from=node ```sh
nvm install node --reinstall-packages-from=node
```
This will first use "nvm version node" to identify the current version you're migrating packages from. Then it resolves the new version to install from the remote server and installs it. Lastly, it runs "nvm reinstall-packages" to reinstall the npm packages from your prior version of Node to the new one. This will first use "nvm version node" to identify the current version you're migrating packages from. Then it resolves the new version to install from the remote server and installs it. Lastly, it runs "nvm reinstall-packages" to reinstall the npm packages from your prior version of Node to the new one.
You can also install and migrate npm packages from specific versions of Node like this: You can also install and migrate npm packages from specific versions of Node like this:
nvm install v5.0 --reinstall-packages-from=4.2 ```sh
nvm install v4.2 --reinstall-packages-from=iojs nvm install 6 --reinstall-packages-from=5
nvm install v4.2 --reinstall-packages-from=iojs
```
### io.js
If you want to install [io.js](https://github.com/iojs/io.js/): If you want to install [io.js](https://github.com/iojs/io.js/):
nvm install iojs ```sh
nvm install iojs
```
If you want to install a new version of io.js and migrate npm packages from a previous version: If you want to install a new version of io.js and migrate npm packages from a previous version:
nvm install iojs --reinstall-packages-from=iojs ```sh
nvm install iojs --reinstall-packages-from=iojs
```
The same guidelines mentioned for migrating npm packages in Node.js are applicable to io.js. The same guidelines mentioned for migrating npm packages in Node.js are applicable to io.js.
### System version of node
If you want to use the system-installed version of node, you can use the special default alias "system": If you want to use the system-installed version of node, you can use the special default alias "system":
nvm use system ```sh
nvm run system --version nvm use system
nvm run system --version
```
### Listing versions
If you want to see what versions are installed: If you want to see what versions are installed:
nvm ls ```sh
nvm ls
```
If you want to see what versions are available to install: If you want to see what versions are available to install:
nvm ls-remote ```sh
nvm ls-remote
```
To restore your PATH, you can deactivate it: To restore your PATH, you can deactivate it:
nvm deactivate ```sh
nvm deactivate
```
To set a default Node version to be used in any new shell, use the alias 'default': To set a default Node version to be used in any new shell, use the alias 'default':
nvm alias default node ```sh
nvm alias default node
```
To use a mirror of the node binaries, set `$NVM_NODEJS_ORG_MIRROR`: To use a mirror of the node binaries, set `$NVM_NODEJS_ORG_MIRROR`:
export NVM_NODEJS_ORG_MIRROR=https://nodejs.org/dist ```sh
nvm install node export NVM_NODEJS_ORG_MIRROR=https://nodejs.org/dist
nvm install node
NVM_NODEJS_ORG_MIRROR=https://nodejs.org/dist nvm install 4.2 NVM_NODEJS_ORG_MIRROR=https://nodejs.org/dist nvm install 4.2
```
To use a mirror of the iojs binaries, set `$NVM_IOJS_ORG_MIRROR`: To use a mirror of the io.js binaries, set `$NVM_IOJS_ORG_MIRROR`:
export NVM_IOJS_ORG_MIRROR=https://iojs.org/dist ```sh
nvm install iojs-v1.0.3 export NVM_IOJS_ORG_MIRROR=https://iojs.org/dist
nvm install iojs-v1.0.3
NVM_IOJS_ORG_MIRROR=https://iojs.org/dist nvm install iojs-v1.0.3 NVM_IOJS_ORG_MIRROR=https://iojs.org/dist nvm install iojs-v1.0.3
```
`nvm use` will not, by default, create a "current" symlink. Set `$NVM_SYMLINK_CURRENT` to "true" to enable this behavior, which is sometimes useful for IDEs. `nvm use` will not, by default, create a "current" symlink. Set `$NVM_SYMLINK_CURRENT` to "true" to enable this behavior, which is sometimes useful for IDEs. Note that using `nvm` in multiple shell tabs with this environment variable enabled can cause race conditions.
### .nvmrc ### .nvmrc
@@ -179,13 +261,19 @@ You can create a `.nvmrc` file containing version number in the project root dir
For example, to make nvm default to the latest 5.9 release for the current directory: For example, to make nvm default to the latest 5.9 release for the current directory:
$ echo "5.9" > .nvmrc ```sh
$ echo "5.9" > .nvmrc
$ echo "lts/*" > .nvmrc # to default to the latest LTS version
```
Then when you run nvm: Then when you run nvm:
$ nvm use ```sh
Found '/path/to/project/.nvmrc' with version <5.9> $ nvm use
Now using node v5.9.1 (npm v3.7.3) Found '/path/to/project/.nvmrc' with version <5.9>
Now using node v5.9.1 (npm v3.7.3)
```
### Deeper Shell Integration ### Deeper Shell Integration
@@ -220,7 +308,7 @@ load-nvmrc
nvm is released under the MIT license. nvm is released under the MIT license.
Copyright (C) 2010-2016 Tim Caswell Copyright (C) 2010-2016 Tim Caswell and Jordan Harband
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
@@ -254,7 +342,9 @@ Nota bene: Avoid running nvm while the tests are running.
To activate, you need to source `bash_completion`: 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`). Put the above sourcing line just below the sourcing line for nvm in your profile (`.bashrc`, `.bash_profile`).
@@ -290,16 +380,16 @@ nvm uninstall:
The following are known to cause issues: The following are known to cause issues:
Inside `~/.npmrc`: Inside `~/.npmrc`:
``` ```sh
prefix='some/path' prefix='some/path'
``` ```
Environment Variables: Environment Variables:
``` ```sh
$NPM_CONFIG_PREFIX $NPM_CONFIG_PREFIX
$PREFIX $PREFIX
``` ```
Shell settings: Shell settings:
``` ```sh
set -e set -e
``` ```
@@ -312,9 +402,9 @@ There is a `-s` flag for `nvm install` which requests nvm download Node source a
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: 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 apk add bash
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.31.2/install.sh | /bin/bash wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.31.4/install.sh | /bin/bash
``` ```
The Node project has some desire but no concrete plans (due to the overheads of building, testing and support) to offer Alpine-compatible binaries. The Node project has some desire but no concrete plans (due to the overheads of building, testing and support) to offer Alpine-compatible binaries.
@@ -334,7 +424,9 @@ https://github.com/creationix/nvm/issues/43
On Arch Linux and other systems using python3 by default, before running *install* you need to: On Arch Linux and other systems using python3 by default, before running *install* you need to:
export PYTHON=python2 ```sh
export PYTHON=python2
```
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: 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:
@@ -343,7 +435,7 @@ After the v0.8.6 release of node, nvm tries to install from binary packages. But
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)) 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))
[1]: https://github.com/creationix/nvm.git [1]: https://github.com/creationix/nvm.git
[2]: https://github.com/creationix/nvm/blob/v0.31.2/install.sh [2]: https://github.com/creationix/nvm/blob/v0.31.4/install.sh
[3]: https://travis-ci.org/creationix/nvm [3]: https://travis-ci.org/creationix/nvm
[Urchin]: https://github.com/scraperwiki/urchin [Urchin]: https://github.com/scraperwiki/urchin
[Fish]: http://fishshell.com [Fish]: http://fishshell.com

View File

@@ -57,9 +57,9 @@ __nvm_aliases ()
declare aliases declare aliases
aliases="" aliases=""
if [ -d $NVM_DIR/alias ]; then if [ -d $NVM_DIR/alias ]; then
aliases="`cd $NVM_DIR/alias && command ls`" aliases="$(cd $NVM_DIR/alias && find $PWD -type f | sed "s:$PWD/::")"
fi fi
echo "${aliases}" echo "${aliases} node stable unstable iojs"
} }
__nvm_alias () __nvm_alias ()

View File

@@ -6,12 +6,12 @@ nvm_has() {
type "$1" > /dev/null 2>&1 type "$1" > /dev/null 2>&1
} }
if [ -z "$NVM_DIR" ]; then nvm_install_dir() {
NVM_DIR="$HOME/.nvm" echo ${NVM_DIR:-"$HOME/.nvm"}
fi }
nvm_latest_version() { nvm_latest_version() {
echo "v0.31.2" echo "v0.31.4"
} }
# #
@@ -40,6 +40,13 @@ nvm_source() {
echo "$NVM_SOURCE_URL" echo "$NVM_SOURCE_URL"
} }
#
# Node.js version to install
#
nvm_node_version() {
echo "$NODE_VERSION"
}
nvm_download() { nvm_download() {
if nvm_has "curl"; then if nvm_has "curl"; then
curl -q $* curl -q $*
@@ -56,45 +63,77 @@ nvm_download() {
} }
install_nvm_from_git() { install_nvm_from_git() {
if [ -d "$NVM_DIR/.git" ]; then local INSTALL_DIR
echo "=> nvm is already installed in $NVM_DIR, trying to update using git" INSTALL_DIR="$(nvm_install_dir)"
if [ -d "$INSTALL_DIR/.git" ]; then
echo "=> nvm is already installed in $INSTALL_DIR, trying to update using git"
printf "\r=> " printf "\r=> "
cd "$NVM_DIR" && (command git fetch 2> /dev/null || { command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" fetch 2> /dev/null || {
echo >&2 "Failed to update nvm, run 'git fetch' in $NVM_DIR yourself." && exit 1 echo >&2 "Failed to update nvm, run 'git fetch' in $INSTALL_DIR yourself."
}) exit 1
}
else else
# Cloning to $NVM_DIR # Cloning to $NVM_DIR
echo "=> Downloading nvm from git to '$NVM_DIR'" echo "=> Downloading nvm from git to '$INSTALL_DIR'"
printf "\r=> " printf "\r=> "
mkdir -p "$NVM_DIR" mkdir -p "$INSTALL_DIR"
command git clone "$(nvm_source git)" "$NVM_DIR" command git clone "$(nvm_source)" "$INSTALL_DIR" || {
echo >&2 "Failed to clone nvm repo. Please report this!"
exit 1
}
fi fi
cd "$NVM_DIR" && command git checkout --quiet "$(nvm_latest_version)" command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" checkout --quiet "$(nvm_latest_version)"
if [ ! -z "$(cd "$NVM_DIR" && git show-ref refs/heads/master)" ]; then if [ ! -z "$(command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" show-ref refs/heads/master)" ]; then
if git branch --quiet 2>/dev/null; then if command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" branch --quiet 2>/dev/null; then
cd "$NVM_DIR" && command git branch --quiet -D master >/dev/null 2>&1 command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" branch --quiet -D master >/dev/null 2>&1
else else
echo >&2 "Your version of git is out of date. Please update it!" echo >&2 "Your version of git is out of date. Please update it!"
cd "$NVM_DIR" && command git branch -D master >/dev/null 2>&1 command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" branch -D master >/dev/null 2>&1
fi fi
fi fi
return return
} }
#
# Automatically install Node.js
#
nvm_install_node() {
local NODE_VERSION
NODE_VERSION="$(nvm_node_version)"
if [ -z "$NODE_VERSION" ]; then
return 0
fi
echo "=> Installing Node.js version $NODE_VERSION"
nvm install "$NODE_VERSION"
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"
else
echo >&2 "Failed to install Node.js $NODE_VERSION"
fi
}
install_nvm_as_script() { install_nvm_as_script() {
local INSTALL_DIR
INSTALL_DIR="$(nvm_install_dir)"
local NVM_SOURCE_LOCAL local NVM_SOURCE_LOCAL
NVM_SOURCE_LOCAL=$(nvm_source script) NVM_SOURCE_LOCAL=$(nvm_source script)
local NVM_EXEC_SOURCE local NVM_EXEC_SOURCE
NVM_EXEC_SOURCE=$(nvm_source script-nvm-exec) NVM_EXEC_SOURCE=$(nvm_source script-nvm-exec)
# Downloading to $NVM_DIR # Downloading to $INSTALL_DIR
mkdir -p "$NVM_DIR" mkdir -p "$INSTALL_DIR"
if [ -f "$NVM_DIR/nvm.sh" ]; then if [ -f "$INSTALL_DIR/nvm.sh" ]; then
echo "=> nvm is already installed in $NVM_DIR, trying to update the script" echo "=> nvm is already installed in $INSTALL_DIR, trying to update the script"
else else
echo "=> Downloading nvm as script to '$NVM_DIR'" echo "=> Downloading nvm as script to '$INSTALL_DIR'"
fi fi
nvm_download -s "$NVM_SOURCE_LOCAL" -o "$NVM_DIR/nvm.sh" || { nvm_download -s "$NVM_SOURCE_LOCAL" -o "$INSTALL_DIR/nvm.sh" || {
echo >&2 "Failed to download '$NVM_SOURCE_LOCAL'" echo >&2 "Failed to download '$NVM_SOURCE_LOCAL'"
return 1 return 1
} }
@@ -228,8 +267,10 @@ nvm_do_install() {
local NVM_PROFILE local NVM_PROFILE
NVM_PROFILE=$(nvm_detect_profile) NVM_PROFILE=$(nvm_detect_profile)
local INSTALL_DIR
INSTALL_DIR="$(nvm_install_dir)"
SOURCE_STR="\nexport NVM_DIR=\"$NVM_DIR\"\n[ -s \"\$NVM_DIR/nvm.sh\" ] && . \"\$NVM_DIR/nvm.sh\" # This loads nvm" SOURCE_STR="\nexport NVM_DIR=\"$INSTALL_DIR\"\n[ -s \"\$NVM_DIR/nvm.sh\" ] && . \"\$NVM_DIR/nvm.sh\" # This loads nvm"
if [ -z "$NVM_PROFILE" ] ; then if [ -z "$NVM_PROFILE" ] ; then
echo "=> Profile not found. Tried $NVM_PROFILE (as defined in \$PROFILE), ~/.bashrc, ~/.bash_profile, ~/.zshrc, and ~/.profile." echo "=> Profile not found. Tried $NVM_PROFILE (as defined in \$PROFILE), ~/.bashrc, ~/.bash_profile, ~/.zshrc, and ~/.profile."
@@ -248,10 +289,17 @@ nvm_do_install() {
fi fi
fi fi
# Source nvm
. "$NVM_DIR/nvm.sh"
nvm_check_global_modules nvm_check_global_modules
echo "=> Close and reopen your terminal to start using nvm" nvm_install_node
nvm_reset nvm_reset
echo "=> Close and reopen your terminal to start using nvm or run the following to use it now:"
printf "$SOURCE_STR"
} }
# #
@@ -261,7 +309,8 @@ nvm_do_install() {
nvm_reset() { nvm_reset() {
unset -f nvm_reset nvm_has nvm_latest_version \ unset -f nvm_reset nvm_has nvm_latest_version \
nvm_source nvm_download install_nvm_as_script install_nvm_from_git \ nvm_source nvm_download install_nvm_as_script install_nvm_from_git \
nvm_detect_profile nvm_check_global_modules nvm_do_install nvm_detect_profile nvm_check_global_modules nvm_do_install \
nvm_install_dir nvm_node_version nvm_install_node
} }
[ "_$NVM_ENV" = "_testing" ] || nvm_do_install [ "_$NVM_ENV" = "_testing" ] || nvm_do_install

481
nvm.sh

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{ {
"name": "nvm", "name": "nvm",
"version": "0.31.2", "version": "0.31.4",
"description": "Node Version Manager - Simple bash script to manage multiple active node.js versions", "description": "Node Version Manager - Simple bash script to manage multiple active node.js versions",
"directories": { "directories": {
"test": "test" "test": "test"

View File

@@ -17,3 +17,49 @@ strip_colors() {
echo "$line" | LC_ALL=C command sed 's/\[[ -?]*[@-~]//g' echo "$line" | LC_ALL=C command sed 's/\[[ -?]*[@-~]//g'
done done
} }
make_echo() {
echo "#!/bin/sh" > "$1"
echo "echo \"${2}\"" > "$1"
chmod a+x "$1"
}
make_fake_node() {
local VERSION
VERSION="${1-}"
[ -n "${VERSION}" ] || return 1
local BIN_PATH
BIN_PATH="$(nvm_version_path "${VERSION}")/bin"
mkdir -p "${BIN_PATH}" || {
echo >&2 'unable to make bin dir'
return 2
}
make_echo "${BIN_PATH}/node" "${VERSION}" || {
echo >&2 'unable to make fake node bin'
return 3
}
}
make_fake_iojs() {
local VERSION
VERSION="${1-}"
[ -n "${VERSION}" ] || return 1
local BIN_PATH
BIN_PATH="$(nvm_version_path "iojs-${VERSION}")/bin"
mkdir -p "${BIN_PATH}" || {
echo >&2 'unable to make bin dir'
return 2
}
make_echo "${BIN_PATH}/node" "${VERSION}" || {
echo >&2 'unable to make fake node bin'
return 3
}
make_echo "${BIN_PATH}/iojs" "${VERSION}" || {
echo >&2 'unable to make fake iojs bin'
return 3
}
}

View File

@@ -5,18 +5,18 @@
die () { echo $@ ; cleanup ; exit 1; } die () { echo $@ ; cleanup ; exit 1; }
cleanup () { cleanup () {
rm -rf ../../../alias/stable rm -rf "$(nvm_alias_path)/stable"
rm -rf ../../../alias/unstable rm -rf "$(nvm_alias_path)/unstable"
rm -rf ../../../alias/node rm -rf "$(nvm_alias_path)/node"
rm -rf ../../../alias/iojs rm -rf "$(nvm_alias_path)/iojs"
rm -rf ../../../v0.8.1 rm -rf "${NVM_DIR}/v0.8.1"
rm -rf ../../../v0.9.1 rm -rf "${NVM_DIR}/v0.9.1"
rm -rf ../../../versions/io.js/v0.2.1 rm -rf "${NVM_DIR}/versions/io.js/v0.2.1"
} }
mkdir ../../../v0.8.1 mkdir "${NVM_DIR}/v0.8.1"
mkdir ../../../v0.9.1 mkdir "${NVM_DIR}/v0.9.1"
mkdir -p ../../../versions/io.js/v0.2.1 mkdir -p "${NVM_DIR}/versions/io.js/v0.2.1"
EXPECTED_STABLE="$(nvm_print_implicit_alias local stable)" EXPECTED_STABLE="$(nvm_print_implicit_alias local stable)"
STABLE_VERSION="$(nvm_version "$EXPECTED_STABLE")" STABLE_VERSION="$(nvm_version "$EXPECTED_STABLE")"

View File

@@ -0,0 +1,16 @@
#!/bin/sh
set -ex
. ../../../../nvm.sh
. ../../../common.sh
LTS_ALIAS_PATH="$(nvm_alias_path)/lts"
die () { echo $@ ; exit 1; }
[ ! -d "${LTS_ALIAS_PATH}" ] || die "'${LTS_ALIAS_PATH}' exists and should not"
nvm alias >/dev/null 2>&1
[ -d "${LTS_ALIAS_PATH}" ] || die "'${LTS_ALIAS_PATH}' does not exist and should"

10
test/fast/Aliases/lts/setup_dir Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/sh
. ../../../../nvm.sh
LTS_ALIAS_PATH="$(nvm_alias_path)/lts"
if [ -d "${LTS_ALIAS_PATH}" ]; then
mv "${LTS_ALIAS_PATH}" "${LTS_ALIAS_PATH}.bak"
rm -rf "${LTS_ALIAS_PATH}"
fi

View File

@@ -0,0 +1,10 @@
#!/bin/sh
. ../../../../nvm.sh
LTS_ALIAS_PATH="$(nvm_alias_path)/lts"
if [ -d "${LTS_ALIAS_PATH}.bak" ]; then
rm -rf "${LTS_ALIAS_PATH}"
mv "${LTS_ALIAS_PATH}.bak" "${LTS_ALIAS_PATH}"
fi

View File

@@ -1,11 +1,11 @@
#!/bin/sh #!/bin/sh
mkdir -p ../../../v0.0.2
mkdir -p ../../../v0.0.20
mkdir -p ../../../versions/node/v0.12.0
. ../../../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. # The result should contain only the appropriate version numbers.
@@ -24,4 +24,3 @@ nvm which 0.12.0 || die "v0.0.20 not found"
NVM_BIN="$(nvm which 0.12.0)" NVM_BIN="$(nvm which 0.12.0)"
[ "_$NVM_BIN" = "_$(nvm_version_path v0.12.0)/bin/node" ] \ [ "_$NVM_BIN" = "_$(nvm_version_path v0.12.0)/bin/node" ] \
|| die "'nvm which 0.12.0' did not contain the correct path: got '$NVM_BIN'" || die "'nvm which 0.12.0' did not contain the correct path: got '$NVM_BIN'"

View File

@@ -1,10 +1,10 @@
#!/bin/sh #!/bin/sh
mkdir ../../../v0.0.2
mkdir ../../../v0.0.20
. ../../../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. # The result should contain only the appropriate version numbers.

View File

@@ -1,11 +1,11 @@
#!/bin/sh #!/bin/sh
mkdir ../../../v0.1.3
mkdir ../../../v0.2.3
mkdir ../../../v0.20.3
. ../../../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. # The result should contain only the appropriate version numbers.

View File

@@ -4,8 +4,8 @@
die () { echo $@ ; exit 1; } die () { echo $@ ; exit 1; }
mkdir ../../../v0.2.3 mkdir "${NVM_DIR}/v0.2.3"
mkdir ../../../v0.3.3 mkdir "${NVM_DIR}/v0.3.3"
EXPECTED_STABLE="$(nvm_print_implicit_alias local stable)" EXPECTED_STABLE="$(nvm_print_implicit_alias local stable)"
STABLE_VERSION="$(nvm_version "$EXPECTED_STABLE")" STABLE_VERSION="$(nvm_version "$EXPECTED_STABLE")"
@@ -19,7 +19,7 @@ nvm ls stable | \grep "$STABLE_VERSION" >/dev/null \
nvm ls unstable | \grep "$UNSTABLE_VERSION" >/dev/null \ nvm ls unstable | \grep "$UNSTABLE_VERSION" >/dev/null \
|| die "expected 'nvm ls unstable' to give $UNSTABLE_VERSION, got $(nvm ls unstable)" || die "expected 'nvm ls unstable' to give $UNSTABLE_VERSION, got $(nvm ls unstable)"
mkdir ../../../v0.1.2 mkdir "${NVM_DIR}/v0.1.2"
nvm alias stable 0.1 nvm alias stable 0.1
nvm ls stable | \grep -v "$STABLE_VERSION" >/dev/null \ nvm ls stable | \grep -v "$STABLE_VERSION" >/dev/null \

View File

@@ -4,12 +4,12 @@ die () { echo $@ ; exit 1; }
. ../../../nvm.sh . ../../../nvm.sh
mkdir -p ../../../v0.0.1 mkdir -p "${NVM_DIR}/v0.0.1"
mkdir -p ../../../v0.0.3 mkdir -p "${NVM_DIR}/v0.0.3"
mkdir -p ../../../v0.0.9 mkdir -p "${NVM_DIR}/v0.0.9"
mkdir -p ../../../v0.3.1 mkdir -p "${NVM_DIR}/v0.3.1"
mkdir -p ../../../v0.3.3 mkdir -p "${NVM_DIR}/v0.3.3"
mkdir -p ../../../v0.3.9 mkdir -p "${NVM_DIR}/v0.3.9"
nvm_has_system_node() { return 0; } nvm_has_system_node() { return 0; }
nvm ls system | grep system 2>&1 > /dev/null nvm ls system | grep system 2>&1 > /dev/null

View File

@@ -2,16 +2,16 @@
. ../../../nvm.sh . ../../../nvm.sh
mkdir ../../../v0.0.1 mkdir "${NVM_DIR}/v0.0.1"
mkdir ../../../v0.0.3 mkdir "${NVM_DIR}/v0.0.3"
mkdir ../../../v0.0.9 mkdir "${NVM_DIR}/v0.0.9"
mkdir ../../../v0.3.1 mkdir "${NVM_DIR}/v0.3.1"
mkdir ../../../v0.3.3 mkdir "${NVM_DIR}/v0.3.3"
mkdir ../../../v0.3.9 mkdir "${NVM_DIR}/v0.3.9"
mkdir -p ../../../versions/node/v0.12.87 mkdir -p "${NVM_DIR}/versions/node/v0.12.87"
mkdir -p ../../../versions/node/v0.12.9 mkdir -p "${NVM_DIR}/versions/node/v0.12.9"
mkdir -p ../../../versions/io.js/v0.1.2 mkdir -p "${NVM_DIR}/versions/io.js/v0.1.2"
mkdir -p ../../../versions/io.js/v0.10.2 mkdir -p "${NVM_DIR}/versions/io.js/v0.10.2"
# The result should contain the version numbers. # The result should contain the version numbers.
nvm ls | grep v0.0.1 >/dev/null && nvm ls | grep v0.0.1 >/dev/null &&

View File

@@ -1,9 +1,9 @@
#!/bin/sh #!/bin/sh
mkdir ../../../v0.1.3
mkdir ../../../v0.2.3
. ../../../nvm.sh . ../../../nvm.sh
mkdir "${NVM_DIR}/v0.1.3"
mkdir "${NVM_DIR}/v0.2.3"
[ -z `nvm ls | grep '^ *\.'` ] [ -z `nvm ls | grep '^ *\.'` ]
# The result should contain only the appropriate version numbers. # The result should contain only the appropriate version numbers.

View File

@@ -1,10 +1,10 @@
#!/bin/sh #!/bin/sh
mkdir ../../../v0.1.3
mkdir ../../../v0.2.3
mkdir -p ../../../versions/node
. ../../../nvm.sh . ../../../nvm.sh
mkdir "${NVM_DIR}/v0.1.3"
mkdir "${NVM_DIR}/v0.2.3"
mkdir -p "${NVM_DIR}/versions/node"
[ -z "$(nvm ls | \grep 'versions')" ] [ -z "$(nvm ls | \grep 'versions')" ]
# The result should contain only the appropriate version numbers. # The result should contain only the appropriate version numbers.

View File

@@ -4,12 +4,12 @@ die () { echo $@ ; exit 1; }
. ../../../nvm.sh . ../../../nvm.sh
mkdir -p ../../../v0.0.1 mkdir -p "${NVM_DIR}/v0.0.1"
mkdir -p ../../../v0.0.3 mkdir -p "${NVM_DIR}/v0.0.3"
mkdir -p ../../../v0.0.9 mkdir -p "${NVM_DIR}/v0.0.9"
mkdir -p ../../../v0.3.1 mkdir -p "${NVM_DIR}/v0.3.1"
mkdir -p ../../../v0.3.3 mkdir -p "${NVM_DIR}/v0.3.3"
mkdir -p ../../../v0.3.9 mkdir -p "${NVM_DIR}/v0.3.9"
nvm_has_system_node() { return 0; } nvm_has_system_node() { return 0; }
nvm ls | grep system 2>&1 > /dev/null nvm ls | grep system 2>&1 > /dev/null

View File

@@ -2,10 +2,10 @@
die () { echo $@ ; exit 1; } die () { echo $@ ; exit 1; }
mkdir -p ../../../versions/node/v0.12.1
mkdir ../../../v0.1.3
. ../../../nvm.sh . ../../../nvm.sh
mkdir -p "${NVM_DIR}/versions/node/v0.12.1"
mkdir "${NVM_DIR}/v0.1.3"
nvm ls 0.12 | grep v0.12.1 || die '"nvm ls" did not list a version in the versions/ directory' nvm ls 0.12 | grep v0.12.1 || die '"nvm ls" did not list a version in the versions/ directory'
nvm ls 0.1 | grep v0.1.3 || die '"nvm ls" did not list a version not in the versions/ directory' nvm ls 0.1 | grep v0.1.3 || die '"nvm ls" did not list a version not in the versions/ directory'

View File

@@ -1,9 +1,9 @@
#!/bin/sh #!/bin/sh
mkdir ../../../v0.1.2
. ../../../nvm.sh . ../../../nvm.sh
mkdir "${NVM_DIR}/v0.1.2"
nvm ls v0.1 | grep v0.1.2 && nvm ls v0.1 | grep v0.1.2 &&
nvm ls v0.1.2 | grep v0.1.2 && nvm ls v0.1.2 | grep v0.1.2 &&
nvm ls v0.1. | grep v0.1.2 && nvm ls v0.1. | grep v0.1.2 &&

View File

@@ -1,5 +1,9 @@
#!/bin/sh #!/bin/sh
set -ex
. ../../nvm.sh . ../../nvm.sh
nvm alias test v0.1.2 nvm alias test v0.1.2
[ "$(cat ../../alias/test)" = "v0.1.2" ]
[ "$(cat "$(nvm_alias_path)/test")" = "v0.1.2" ]

View File

@@ -1,5 +1,7 @@
#!/bin/sh #!/bin/sh
set -ex
die () { echo $@ ; exit 1; } die () { echo $@ ; exit 1; }
. ../../nvm.sh . ../../nvm.sh
@@ -7,4 +9,3 @@ die () { echo $@ ; exit 1; }
nvm deactivate 2>&1 nvm deactivate 2>&1
[ "$(nvm current)" = "system" ] || [ "$(nvm current)" = "none" ] || die '"nvm current" did not report "system" or "none" when deactivated' [ "$(nvm current)" = "system" ] || [ "$(nvm current)" = "none" ] || die '"nvm current" did not report "system" or "none" when deactivated'

View File

@@ -1,5 +1,7 @@
#!/bin/sh #!/bin/sh
set -ex
mkdir -p ../../v0.2.3 mkdir -p ../../v0.2.3
die () { echo $@ ; exit 1; } die () { echo $@ ; exit 1; }
@@ -7,6 +9,7 @@ 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" 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 "$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 "$NODE_PATH" : ".*v0.2.3/.*/lib/node_modules"` = 0 ] || die "NODE_PATH should not contain (npm root -g)"

View File

@@ -1,31 +1,42 @@
#!/bin/sh #!/bin/sh
set -ex
die () { echo $@ ; cleanup ; exit 1; } die () { echo $@ ; cleanup ; exit 1; }
cleanup () { cleanup () {
rm -rf ../../v0.10.4 rm -rf "${NVM_DIR}/v0.10.4"
} }
mkdir ../../v0.10.4
. ../../nvm.sh . ../../nvm.sh
mkdir "${NVM_DIR}/v0.10.4"
nvm deactivate >/dev/null 2>&1 nvm deactivate >/dev/null 2>&1
set +ex # needed for stderr
INSTALL_ERROR_MSG="$(nvm install v0.10.5 --reinstall-packages-from=0.11 2>&1)" INSTALL_ERROR_MSG="$(nvm install v0.10.5 --reinstall-packages-from=0.11 2>&1)"
set -ex
EXPECTED_ERROR_MSG="If --reinstall-packages-from is provided, it must point to an installed version of node." EXPECTED_ERROR_MSG="If --reinstall-packages-from is provided, it must point to an installed version of node."
[ "~$INSTALL_ERROR_MSG" = "~$EXPECTED_ERROR_MSG" ] \ [ "~$INSTALL_ERROR_MSG" = "~$EXPECTED_ERROR_MSG" ] \
|| die ""nvm install --reinstall-packages-from" should fail when given an uninstalled version: expected '$EXPECTED_ERROR_MSG', got '$INSTALL_ERROR_MSG'" || die ""nvm install --reinstall-packages-from" should fail when given an uninstalled version: expected '$EXPECTED_ERROR_MSG', got '$INSTALL_ERROR_MSG'"
set +e # TODO: fix
INSTALL_EXIT_CODE="$(nvm install v0.10.5 --reinstall-packages-from=0.11 >/dev/null 2>&1; echo $?)" INSTALL_EXIT_CODE="$(nvm install v0.10.5 --reinstall-packages-from=0.11 >/dev/null 2>&1; echo $?)"
[ "~$INSTALL_EXIT_CODE" = "~5" ] \ set -e
|| die ""nvm install --reinstall-packages-from" should exit with code 5 when given an uninstalled version, got $INSTALL_EXIT_CODE" [ $INSTALL_EXIT_CODE -eq 5 ] \
|| die ""nvm install --reinstall-packages-from" should exit with code 5 when given an uninstalled version, got ${INSTALL_EXIT_CODE}"
set +ex # needed for stderr
INSTALL_ERROR_MSG="$(nvm install v0.10.5 --reinstall-packages-from=0.10.5 2>&1)" INSTALL_ERROR_MSG="$(nvm install v0.10.5 --reinstall-packages-from=0.10.5 2>&1)"
set -ex
EXPECTED_ERROR_MSG="You can't reinstall global packages from the same version of node you're installing." EXPECTED_ERROR_MSG="You can't reinstall global packages from the same version of node you're installing."
[ "~$INSTALL_ERROR_MSG" = "~$EXPECTED_ERROR_MSG" ] \ [ "~$INSTALL_ERROR_MSG" = "~$EXPECTED_ERROR_MSG" ] \
|| die ""nvm install --reinstall-packages-from" should fail when given the same version: expected '$EXPECTED_ERROR_MSG', got '$INSTALL_ERROR_MSG'" || die ""nvm install --reinstall-packages-from" should fail when given the same version: expected '$EXPECTED_ERROR_MSG', got '$INSTALL_ERROR_MSG'"
set +e # TODO: fix
INSTALL_EXIT_CODE="$(nvm install v0.10.5 --reinstall-packages-from=0.10.5 >/dev/null 2>&1; echo $?)" INSTALL_EXIT_CODE="$(nvm install v0.10.5 --reinstall-packages-from=0.10.5 >/dev/null 2>&1; echo $?)"
[ "~$INSTALL_EXIT_CODE" = "~4" ] \ set -e
[ $INSTALL_EXIT_CODE -eq 4 ] \
|| die ""nvm install --reinstall-packages-from" should exit with code 4 when given the same version, got $INSTALL_EXIT_CODE" || die ""nvm install --reinstall-packages-from" should exit with code 4 when given the same version, got $INSTALL_EXIT_CODE"
cleanup

View File

@@ -1,7 +1,13 @@
#!/bin/sh #!/bin/sh
set -ex
die () { echo $@ ; exit 1; } die () { echo $@ ; exit 1; }
. ../../nvm.sh . ../../nvm.sh
[ "$(nvm install invalid.invalid 2>&1)" = "Version 'invalid.invalid' not found - try \`nvm ls-remote\` to browse available versions." ] || die "nvm installing an invalid version did not print a nice error message"
set +ex # needed for stderr
OUTPUT="$(nvm install invalid.invalid 2>&1)"
set -ex
EXPECTED_OUTPUT="Version 'invalid.invalid' not found - try \`nvm ls-remote\` to browse available versions."
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "nvm installing an invalid version did not print a nice error message"

View File

@@ -1,6 +1,13 @@
#!/bin/sh #!/bin/sh
echo v0.1.2 > ../../alias/test set -ex
ALIAS_PATH="../../alias"
echo v0.1.2 > "${ALIAS_PATH}/test"
. ../../nvm.sh . ../../nvm.sh
nvm unalias test nvm unalias test
! [ -e ../../alias/test ]
! [ -e "${ALIAS_PATH}/test" ]

View File

@@ -1,5 +1,7 @@
#!/bin/sh #!/bin/sh
set -ex
cd ../.. cd ../..
mkdir v0.0.1 mkdir v0.0.1
mkdir src/node-v0.0.1 mkdir src/node-v0.0.1

View File

@@ -1,5 +1,7 @@
#!/bin/sh #!/bin/sh
set -ex
cd ../.. cd ../..
mkdir v0.0.1 mkdir v0.0.1
mkdir src/node-v0.0.1 mkdir src/node-v0.0.1
@@ -8,7 +10,7 @@ sudo touch v0.0.1/sudo
. ./nvm.sh . ./nvm.sh
RETURN_MESSAGE="$(nvm uninstall v0.0.1 2>&1)" RETURN_MESSAGE="$(nvm uninstall v0.0.1 2>&1 || echo)"
CHECK_FOR="Cannot uninstall, incorrect permissions on installation folder" CHECK_FOR="Cannot uninstall, incorrect permissions on installation folder"
test "${RETURN_MESSAGE#*$CHECK_FOR}" != "$RETURN_MESSAGE" || exit 1 [ "${RETURN_MESSAGE#*$CHECK_FOR}" != "$RETURN_MESSAGE" ] || exit 1

View File

@@ -1,12 +1,13 @@
#!/bin/sh #!/bin/sh
fail () { echo $@ ; exit 1; } set -ex
die () { echo $@ ; exit 1; }
. ../../nvm.sh . ../../nvm.sh
type nvm > /dev/null 2>&1 || fail "NVM not loaded" type nvm > /dev/null 2>&1 || die "nvm not loaded"
nvm unload nvm unload
type nvm > /dev/null 2>&1 && fail "NVM not unloaded" || exit 0 ! type nvm > /dev/null 2>&1 || die "nvm not unloaded"

View File

@@ -1,30 +1,39 @@
#!/bin/sh #!/bin/sh
set -ex
die () { echo $@ ; cleanup ; exit 1; } die () { echo $@ ; cleanup ; exit 1; }
cleanup() { cleanup() {
rm -rf ../../alias/foo rm -rf "$(nvm_alias_path)/foo"
} }
. ../../nvm.sh . ../../nvm.sh
echo 'foo' > ../../alias/foo nvm_make_alias foo foo
set +ex # needed for stderr
OUTPUT="$(nvm use foo 2>&1)" OUTPUT="$(nvm use foo 2>&1)"
set -ex
EXPECTED_OUTPUT='The alias "foo" leads to an infinite loop. Aborting.' EXPECTED_OUTPUT='The alias "foo" leads to an infinite loop. Aborting.'
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] \ [ "_${OUTPUT}" = "_${EXPECTED_OUTPUT}" ] \
|| die "'nvm use foo' did not output '$EXPECTED_OUTPUT'; got '$OUTPUT'" || die "'nvm use foo' did not output >${EXPECTED_OUTPUT}<; got >${OUTPUT}<"
set +ex # needed for stderr
EXIT_CODE="$(nvm use foo 2>/dev/null ; echo $?)" EXIT_CODE="$(nvm use foo 2>/dev/null ; echo $?)"
[ "_$EXIT_CODE" = "_8" ] || die "Expected exit code 8; got $EXIT_CODE" set -ex
[ "_$EXIT_CODE" = "_8" ] || die "Expected exit code 8; got ${EXIT_CODE}"
set +ex # needed for stderr
OUTPUT="$(nvm use --silent foo 2>&1)" OUTPUT="$(nvm use --silent foo 2>&1)"
set -ex
EXPECTED_OUTPUT='' EXPECTED_OUTPUT=''
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] \ [ "_${OUTPUT}" = "_${EXPECTED_OUTPUT}" ] \
|| die "'nvm use --silent foo' did not output '$EXPECTED_OUTPUT'; got '$OUTPUT'" || die "'nvm use --silent foo' did not output >${EXPECTED_OUTPUT}<; got >${OUTPUT}<"
set +ex # needed for stderr
EXIT_CODE="$(nvm use --silent foo 2>/dev/null ; echo $?)" EXIT_CODE="$(nvm use --silent foo 2>/dev/null ; echo $?)"
[ "_$EXIT_CODE" = "_8" ] || die "Expected exit code 8 from 'nvm use --silent foo'; got $EXIT_CODE" set -ex
[ $EXIT_CODE -eq 8 ] || die "Expected exit code 8 from 'nvm use --silent foo'; got ${EXIT_CODE}"
cleanup;
cleanup

View File

@@ -1,38 +1,35 @@
#!/bin/sh #!/bin/sh
set -ex
. ../common.sh
die () { echo $@ ; cleanup ; exit 1; } die () { echo $@ ; cleanup ; exit 1; }
VERSION="v3.99.0"
cleanup() { cleanup() {
rm -rf ../../alias/foo unset -f make_echo cleanup
rm -rf "$(nvm_version_path "iojs-${VERSION}")"
} }
. ../../nvm.sh . ../../nvm.sh
echo 'foo' > ../../alias/foo nvm deactivate || die "unable to deactivate; current: >$(nvm current)<"
OUTPUT="$(nvm use foo 2>&1)" make_fake_iojs "${VERSION}" || die "unable to make_fake_iojs ${VERSION}"
EXPECTED_OUTPUT='The alias "foo" leads to an infinite loop. Aborting.'
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] \
|| die "'nvm use foo' did not output '$EXPECTED_OUTPUT'; got '$OUTPUT'"
EXIT_CODE="$(nvm use foo 2>/dev/null ; echo $?)" IOJS_VERSION="$(nvm_version iojs)"
[ "_$EXIT_CODE" = "_8" ] || die "Expected exit code 8; got $EXIT_CODE" [ -n "${IOJS_VERSION}" ] || die 'expected an io.js version; got none'
OUTPUT="$(nvm use --silent foo 2>&1)" EXPECTED_OUTPUT="$(nvm_add_iojs_prefix ${VERSION})"
EXPECTED_OUTPUT='' [ "${IOJS_VERSION}" = "${EXPECTED_OUTPUT}" ] || die "iojs version was not >${EXPECTED_OUTPUT}; got >${IOJS_VERSION}<"
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] \
|| die "'nvm use --silent foo' did not output '$EXPECTED_OUTPUT'; got '$OUTPUT'"
OUTPUT="$(nvm use foo --silent 2>&1)" nvm use --delete-prefix iojs || die '`nvm use iojs` failed'
EXPECTED_OUTPUT=''
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] \
|| die "'nvm use foo --silent' did not output '$EXPECTED_OUTPUT'; got '$OUTPUT'"
EXIT_CODE="$(nvm use --silent foo 2>/dev/null ; echo $?)" CURRENT="$(nvm current)"
[ "_$EXIT_CODE" = "_8" ] || die "Expected exit code 8 from 'nvm use --silent foo'; got $EXIT_CODE" echo "current: ${CURRENT}"
EXIT_CODE="$(nvm use foo --silent 2>/dev/null ; echo $?)" [ "${CURRENT}" = "${IOJS_VERSION}" ] || die "expected >${IOJS_VERSION}<; got >${CURRENT}<"
[ "_$EXIT_CODE" = "_8" ] || die "Expected exit code 8 from 'nvm use foo --silent'; got $EXIT_CODE"
cleanup;
cleanup

View File

@@ -1,22 +1,44 @@
#!/bin/sh #!/bin/sh
die () { echo $@ ; exit 1; } set -ex
cleanup() {
unset -f nvm_has_system_node nvm_print_npm_version
}
die() { echo $@ ; cleanup ; exit 1; }
. ../../nvm.sh . ../../nvm.sh
nvm_has_system_node() { return 0; } nvm_has_system_node() { return 0; }
nvm_print_npm_version() { return ' (npm v1.2.3)'; } nvm_print_npm_version() { command printf ' (npm v1.2.3)'; }
EXPECTED_OUTPUT="Now using system version of node: $(node -v)$(nvm_print_npm_version)" EXPECTED_OUTPUT="Now using system version of node: $(node -v)$(nvm_print_npm_version)"
[ "$(nvm use system 2>&1 | tail -n1)" = "$EXPECTED_OUTPUT" ] || die "Could not use system version of node" set +x # since stderr is needed
OUTPUT="$(nvm use system 2>&1)"
set -x
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "Could not use system version of node. Got >${OUTPUT}<, expected >${EXPECTED_OUTPUT}<"
EXPECTED_OUTPUT="" EXPECTED_OUTPUT=""
[ "$(nvm use --silent system 2>&1 | tail -n1)" = "$EXPECTED_OUTPUT" ] || die "Could not use system version of node or --silent was not silent" set +x # since stderr is needed
OUTPUT="$(nvm use --silent system 2>&1 | tail -1)"
set -x
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "Could not use system version of node or --silent was not silent"
nvm_has_system_node() { return 1; } nvm_has_system_node() { return 1; }
nvm_print_npm_version() { return ''; } nvm_print_npm_version() { command printf ''; }
EXPECTED_OUTPUT="System version of node not found." EXPECTED_OUTPUT="System version of node not found."
[ "$(nvm use system 2>&1 | tail -n1)" = "$EXPECTED_OUTPUT" ] || die "Did not report error, system node not found" set +x # since stderr is needed
OUTPUT="$(nvm use system 2>&1 | tail -1)"
set -x
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "Did not report error, system node not found"
nvm use system 2>&1 > /dev/null || [ $? -eq 127 ] || die "Did not return error code, system node not found" nvm use system 2>&1 > /dev/null || [ $? -eq 127 ] || die "Did not return error code, system node not found"
EXPECTED_OUTPUT="" EXPECTED_OUTPUT=""
[ "$(nvm use --silent system 2>&1 | tail -n1)" = "$EXPECTED_OUTPUT" ] || die "Did not report error, system node not found or --silent was not silent" set +x # since stderr is needed
OUTPUT="$(nvm use --silent system 2>&1 | tail -1)"
set -x
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "Did not report error, system node not found or --silent was not silent"
nvm use --silent system 2>&1 > /dev/null || [ $? -eq 127 ] || die "Did not return error code, system node not found or --silent was not silent" nvm use --silent system 2>&1 > /dev/null || [ $? -eq 127 ] || die "Did not return error code, system node not found or --silent was not silent"
cleanup

View File

@@ -1,33 +1,35 @@
#!/usr/bin/env bash #!/bin/sh
set -ex
export NVM_SYMLINK_CURRENT=true export NVM_SYMLINK_CURRENT=true
. ../../nvm.sh . ../../nvm.sh
rm -rf ../../v0.10.29 rm -rf "${NVM_DIR}/v0.10.29"
mkdir ../../v0.10.29 mkdir "${NVM_DIR}/v0.10.29"
nvm use 0.10.29 nvm use --delete-prefix 0.10.29
rmdir ../../v0.10.29 rmdir "${NVM_DIR}/v0.10.29"
if [ ! -L ../../current ];then if [ ! -L "${NVM_DIR}/current" ];then
echo "Expected 'current' symlink to be created!" echo "Expected 'current' symlink to be created!"
exit 1 exit 1
fi fi
oldLink="$(readlink ../../current)" oldLink="$(readlink "${NVM_DIR}/current")"
if [ "$(basename $oldLink)" != 'v0.10.29' ];then if [ "$(basename "${oldLink}")" != 'v0.10.29' ];then
echo "Expected 'current' to point to v0.10.29 but was $oldLink" echo "Expected 'current' to point to v0.10.29 but was ${oldLink}"
exit 1 exit 1
fi fi
rm -rf ../../v0.11.13 rm -rf "${NVM_DIR}/v0.11.13"
mkdir ../../v0.11.13 mkdir "${NVM_DIR}/v0.11.13"
nvm use 0.11.13 nvm use --delete-prefix 0.11.13
rmdir ../../v0.11.13 rmdir "${NVM_DIR}/v0.11.13"
newLink="$(readlink ../../current)" newLink="$(readlink "${NVM_DIR}/current")"
if [ "$(basename $newLink)" != 'v0.11.13' ];then if [ "$(basename "${newLink}")" != 'v0.11.13' ];then
echo "Expected 'current' to point to v0.11.13 but was $newLink" echo "Expected 'current' to point to v0.11.13 but was $newLink"
exit 1 exit 1
fi fi

View File

@@ -1,4 +1,6 @@
#!/usr/bin/env bash #!/bin/sh
set -ex
. ../../nvm.sh . ../../nvm.sh
@@ -8,17 +10,17 @@ TEST_COUNT=0
TEST_PASSED=0 TEST_PASSED=0
TEST_FAILED=0 TEST_FAILED=0
function registerExpectedSymlink() { registerExpectedSymlink() {
registerResult ${1} registerResult ${1}
} }
function registerExpectedNoSymlink() { registerExpectedNoSymlink() {
[ ${1} -ne 0 ] [ $1 -ne 0 ]
registerResult $? registerResult $?
} }
function registerResult() { registerResult() {
result=${1} result="${1}"
TEST_COUNT=$(($TEST_COUNT + 1)) TEST_COUNT=$(($TEST_COUNT + 1))
@@ -27,19 +29,19 @@ function registerResult() {
|| TEST_FAILED=$(($TEST_FAILED + 1)) || TEST_FAILED=$(($TEST_FAILED + 1))
} }
function cleanup() { cleanup() {
rm -rf ../../${TEST_NODE_VERSION} rm -rf "${NVM_DIR}/${TEST_NODE_VERSION}"
rm -f ../../current rm -f "${NVM_DIR}/current"
} }
function runNvmUse() { runNvmUse() {
mkdir ../../${TEST_NODE_VERSION} mkdir "${NVM_DIR}/${TEST_NODE_VERSION}"
nvm use ${TEST_NODE_VERSION} > /dev/null 2>&1 nvm use --delete-prefix "${TEST_NODE_VERSION}" > /dev/null 2>&1
rmdir ../../${TEST_NODE_VERSION} rmdir "${NVM_DIR}/${TEST_NODE_VERSION}"
} }
function isCurrentSymlinkPresent() { isCurrentSymlinkPresent() {
[ -L ../../current ] [ -L "${NVM_DIR}/current" ]
} }
NVM_SYMLINK_CURRENT=false NVM_SYMLINK_CURRENT=false
@@ -80,5 +82,4 @@ registerExpectedNoSymlink $?
cleanup cleanup
[ ${TEST_FAILED} -ne 0 ] && echo "${TEST_COUNT} tested, ${TEST_PASSED} passed, ${TEST_FAILED} failed" && exit 1 || true [ $TEST_FAILED -ne 0 ] && echo "${TEST_COUNT} tested, ${TEST_PASSED} passed, ${TEST_FAILED} failed" && exit 1 || true

View File

@@ -1,4 +1,7 @@
#!/bin/sh #!/bin/sh
set -ex
. ../../nvm.sh . ../../nvm.sh
nvm nvm

View File

@@ -1,5 +1,7 @@
#!/bin/sh #!/bin/sh
set -ex
set -- yes set -- yes
. ../../nvm.sh . ../../nvm.sh
[ "$1" = yes ] [ "$1" = yes ]

View File

@@ -1,5 +1,11 @@
version date files npm v8 uv zlib openssl modules lts version date files npm v8 uv zlib openssl modules lts
v6.2.2 2016-06-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-msi,win-x86-msi 3.9.5 5.0.71.52 1.9.1 1.2.8 1.0.2h 48 -
v6.2.1 2016-06-02 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-msi,win-x86-msi 3.9.3 5.0.71.52 1.9.1 1.2.8 1.0.2h 48 -
v6.2.0 2016-05-17 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-msi,win-x86-msi 3.8.9 5.0.71.47 1.9.1 1.2.8 1.0.2h 48 -
v6.1.0 2016-05-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-msi,win-x86-msi 3.8.6 5.0.71.35 1.9.0 1.2.8 1.0.2h 48 -
v6.0.0 2016-04-26 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-msi,win-x86-msi 3.8.6 5.0.71.35 1.9.0 1.2.8 1.0.2g 48 - v6.0.0 2016-04-26 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-msi,win-x86-msi 3.8.6 5.0.71.35 1.9.0 1.2.8 1.0.2g 48 -
v5.12.0 2016-06-23 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-msi,win-x86-msi 3.8.6 4.6.85.32 1.8.0 1.2.8 1.0.2h 47 -
v5.11.1 2016-05-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-msi,win-x86-msi 3.8.6 4.6.85.31 1.8.0 1.2.8 1.0.2h 47 -
v5.11.0 2016-04-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-msi,win-x86-msi 3.8.6 4.6.85.31 1.8.0 1.2.8 1.0.2g 47 - v5.11.0 2016-04-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-msi,win-x86-msi 3.8.6 4.6.85.31 1.8.0 1.2.8 1.0.2g 47 -
v5.10.1 2016-04-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-msi,win-x86-msi 3.8.3 4.6.85.31 1.8.0 1.2.8 1.0.2g 47 - v5.10.1 2016-04-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-msi,win-x86-msi 3.8.3 4.6.85.31 1.8.0 1.2.8 1.0.2g 47 -
v5.10.0 2016-04-01 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-msi,win-x86-msi 3.8.3 4.6.85.31 1.8.0 1.2.8 1.0.2g 47 - v5.10.0 2016-04-01 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-msi,win-x86-msi 3.8.3 4.6.85.31 1.8.0 1.2.8 1.0.2g 47 -
@@ -17,6 +23,10 @@ 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-msi,win-x86-msi 3.3.12 4.6.85.31 1.7.5 1.2.8 1.0.2e 47 - v5.1.1 2015-12-03 headers,linux-arm64,linux-armv6l,linux-armv7l,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-msi,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-msi,win-x86-msi 3.3.12 4.6.85.31 1.7.5 1.2.8 1.0.2d 47 - v5.1.0 2015-11-17 headers,linux-arm64,linux-armv6l,linux-armv7l,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-msi,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-msi,win-x86-msi 3.3.6 4.6.85.28 1.7.5 1.2.8 1.0.2d 47 - v5.0.0 2015-10-29 headers,linux-arm64,linux-armv6l,linux-armv7l,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-msi,win-x86-msi 3.3.6 4.6.85.28 1.7.5 1.2.8 1.0.2d 47 -
v4.4.7 2016-06-28 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-msi,win-x86-msi 2.15.8 4.5.103.36 1.8.0 1.2.8 1.0.2h 46 Argon
v4.4.6 2016-06-23 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-msi,win-x86-msi 2.15.5 4.5.103.36 1.8.0 1.2.8 1.0.2h 46 Argon
v4.4.5 2016-05-24 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-msi,win-x86-msi 2.15.5 4.5.103.35 1.8.0 1.2.8 1.0.2h 46 Argon
v4.4.4 2016-05-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-msi,win-x86-msi 2.15.1 4.5.103.35 1.8.0 1.2.8 1.0.2h 46 Argon
v4.4.3 2016-04-12 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-msi,win-x86-msi 2.15.1 4.5.103.35 1.8.0 1.2.8 1.0.2g 46 Argon v4.4.3 2016-04-12 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-msi,win-x86-msi 2.15.1 4.5.103.35 1.8.0 1.2.8 1.0.2g 46 Argon
v4.4.2 2016-04-01 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-msi,win-x86-msi 2.15.0 4.5.103.35 1.8.0 1.2.8 1.0.2g 46 Argon v4.4.2 2016-04-01 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-msi,win-x86-msi 2.15.0 4.5.103.35 1.8.0 1.2.8 1.0.2g 46 Argon
v4.4.1 2016-03-22 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-msi,win-x86-msi 2.14.20 4.5.103.35 1.8.0 1.2.8 1.0.2g 46 Argon v4.4.1 2016-03-22 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-msi,win-x86-msi 2.14.20 4.5.103.35 1.8.0 1.2.8 1.0.2g 46 Argon
@@ -35,6 +45,8 @@ 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-msi,win-x86-msi 2.14.4 4.5.103.33 1.7.4 1.2.8 1.0.2d 46 - v4.1.1 2015-09-23 headers,linux-arm64,linux-armv6l,linux-armv7l,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-msi,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-msi,win-x86-msi 2.14.3 4.5.103.33 1.7.4 1.2.8 1.0.2d 46 - v4.1.0 2015-09-17 headers,linux-arm64,linux-armv6l,linux-armv7l,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-msi,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-msi,win-x86-msi 2.14.2 4.5.103.30 1.7.3 1.2.8 1.0.2d 46 - v4.0.0 2015-09-08 headers,linux-arm64,linux-armv6l,linux-armv7l,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-msi,win-x86-msi 2.14.2 4.5.103.30 1.7.3 1.2.8 1.0.2d 46 -
v0.12.15 2016-06-23 headers,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,osx-x86-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x86-exe,win-x86-msi 2.15.1 3.28.71.19 1.6.1 1.2.8 1.0.1t 14 -
v0.12.14 2016-05-06 headers,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,osx-x86-tar,src,sunos-x64,sunos-x86,win-x64-exe,win-x86-exe,win-x86-msi 2.15.1 3.28.71.19 1.6.1 1.2.8 1.0.1t 14 -
v0.12.13 2016-03-31 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.0 3.28.71.19 1.6.1 1.2.8 1.0.1s 14 - v0.12.13 2016-03-31 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.0 3.28.71.19 1.6.1 1.2.8 1.0.1s 14 -
v0.12.12 2016-03-08 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.14.9 3.28.71.19 1.6.1 1.2.8 1.0.1s 14 - v0.12.12 2016-03-08 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.14.9 3.28.71.19 1.6.1 1.2.8 1.0.1s 14 -
v0.12.11 2016-03-03 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.14.9 3.28.71.19 1.6.1 1.2.8 1.0.1s 14 - v0.12.11 2016-03-03 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.14.9 3.28.71.19 1.6.1 1.2.8 1.0.1s 14 -
@@ -66,6 +78,8 @@ v0.11.3 2013-06-26 linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,osx-x86-tar,src,s
v0.11.2 2013-05-13 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 1.2.21 3.19.0.0 0.11.2 1.2.3 1.0.1e 0x000C - v0.11.2 2013-05-13 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 1.2.21 3.19.0.0 0.11.2 1.2.3 1.0.1e 0x000C -
v0.11.1 2013-04-19 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 1.2.18 3.18.0.0 0.11.1 1.2.3 1.0.1e 0x000C - v0.11.1 2013-04-19 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 1.2.18 3.18.0.0 0.11.1 1.2.3 1.0.1e 0x000C -
v0.11.0 2013-03-28 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 1.2.15 3.17.13.0 0.10.3 1.2.3 1.0.1e 0x000C - v0.11.0 2013-03-28 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 1.2.15 3.17.13.0 0.10.3 1.2.3 1.0.1e 0x000C -
v0.10.46 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.14.5.9 0.10.37 1.2.8 1.0.1t 11 -
v0.10.45 2016-05-06 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.14.5.9 0.10.36 1.2.8 1.0.1t 11 -
v0.10.44 2016-03-31 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.0 3.14.5.9 0.10.36 1.2.8 1.0.1s 11 - v0.10.44 2016-03-31 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.0 3.14.5.9 0.10.36 1.2.8 1.0.1s 11 -
v0.10.43 2016-03-03 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 1.4.29 3.14.5.9 0.10.36 1.2.8 1.0.1s 11 - v0.10.43 2016-03-03 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 1.4.29 3.14.5.9 0.10.36 1.2.8 1.0.1s 11 -
v0.10.42 2016-02-09 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 1.4.29 3.14.5.9 0.10.36 1.2.8 1.0.1r 11 - v0.10.42 2016-02-09 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 1.4.29 3.14.5.9 0.10.36 1.2.8 1.0.1r 11 -

View File

@@ -0,0 +1,41 @@
iojs-v1.0.0
iojs-v1.0.1
iojs-v1.0.2
iojs-v1.0.3
iojs-v1.0.4
iojs-v1.1.0
iojs-v1.2.0
iojs-v1.3.0
iojs-v1.4.1
iojs-v1.4.2
iojs-v1.4.3
iojs-v1.5.0
iojs-v1.5.1
iojs-v1.6.0
iojs-v1.6.1
iojs-v1.6.2
iojs-v1.6.3
iojs-v1.6.4
iojs-v1.7.1
iojs-v1.8.1
iojs-v1.8.2
iojs-v1.8.3
iojs-v1.8.4
iojs-v2.0.0
iojs-v2.0.1
iojs-v2.0.2
iojs-v2.1.0
iojs-v2.2.0
iojs-v2.2.1
iojs-v2.3.0
iojs-v2.3.1
iojs-v2.3.2
iojs-v2.3.3
iojs-v2.3.4
iojs-v2.4.0
iojs-v2.5.0
iojs-v3.0.0
iojs-v3.1.0
iojs-v3.2.0
iojs-v3.3.0
iojs-v3.3.1

View File

@@ -0,0 +1,18 @@
v4.2.0  (LTS: Argon)
v4.2.1  (LTS: Argon)
v4.2.2  (LTS: Argon)
v4.2.3  (LTS: Argon)
v4.2.4  (LTS: Argon)
v4.2.5  (LTS: Argon)
v4.2.6  (LTS: Argon)
v4.3.0  (LTS: Argon)
v4.3.1  (LTS: Argon)
v4.3.2  (LTS: Argon)
v4.4.0  (LTS: Argon)
v4.4.1  (LTS: Argon)
v4.4.2  (LTS: Argon)
v4.4.3  (LTS: Argon)
v4.4.4  (LTS: Argon)
v4.4.5  (LTS: Argon)
v4.4.6  (LTS: Argon)
v4.4.7  (Latest LTS: Argon)

View File

@@ -0,0 +1,278 @@
v0.1.14
v0.1.15
v0.1.16
v0.1.17
v0.1.18
v0.1.19
v0.1.20
v0.1.21
v0.1.22
v0.1.23
v0.1.24
v0.1.25
v0.1.26
v0.1.27
v0.1.28
v0.1.29
v0.1.30
v0.1.31
v0.1.32
v0.1.33
v0.1.90
v0.1.91
v0.1.92
v0.1.93
v0.1.94
v0.1.95
v0.1.96
v0.1.97
v0.1.98
v0.1.99
v0.1.100
v0.1.101
v0.1.102
v0.1.103
v0.1.104
v0.2.0
v0.2.1
v0.2.2
v0.2.3
v0.2.4
v0.2.5
v0.2.6
v0.3.0
v0.3.1
v0.3.2
v0.3.3
v0.3.4
v0.3.5
v0.3.6
v0.3.7
v0.3.8
v0.4.0
v0.4.1
v0.4.2
v0.4.3
v0.4.4
v0.4.5
v0.4.6
v0.4.7
v0.4.8
v0.4.9
v0.4.10
v0.4.11
v0.4.12
v0.5.0
v0.5.1
v0.5.2
v0.5.3
v0.5.4
v0.5.5
v0.5.6
v0.5.7
v0.5.8
v0.5.9
v0.5.10
v0.6.0
v0.6.1
v0.6.2
v0.6.3
v0.6.4
v0.6.5
v0.6.6
v0.6.7
v0.6.8
v0.6.9
v0.6.10
v0.6.11
v0.6.12
v0.6.13
v0.6.14
v0.6.15
v0.6.16
v0.6.17
v0.6.18
v0.6.19
v0.6.20
v0.6.21
v0.7.0
v0.7.1
v0.7.2
v0.7.3
v0.7.4
v0.7.5
v0.7.6
v0.7.7
v0.7.8
v0.7.9
v0.7.10
v0.7.11
v0.7.12
v0.8.0
v0.8.1
v0.8.2
v0.8.3
v0.8.4
v0.8.5
v0.8.6
v0.8.7
v0.8.8
v0.8.9
v0.8.10
v0.8.11
v0.8.12
v0.8.13
v0.8.14
v0.8.15
v0.8.16
v0.8.17
v0.8.18
v0.8.19
v0.8.20
v0.8.21
v0.8.22
v0.8.23
v0.8.24
v0.8.25
v0.8.26
v0.8.27
v0.8.28
v0.9.0
v0.9.1
v0.9.2
v0.9.3
v0.9.4
v0.9.5
v0.9.6
v0.9.7
v0.9.8
v0.9.9
v0.9.10
v0.9.11
v0.9.12
v0.10.0
v0.10.1
v0.10.2
v0.10.3
v0.10.4
v0.10.5
v0.10.6
v0.10.7
v0.10.8
v0.10.9
v0.10.10
v0.10.11
v0.10.12
v0.10.13
v0.10.14
v0.10.15
v0.10.16
v0.10.17
v0.10.18
v0.10.19
v0.10.20
v0.10.21
v0.10.22
v0.10.23
v0.10.24
v0.10.25
v0.10.26
v0.10.27
v0.10.28
v0.10.29
v0.10.30
v0.10.31
v0.10.32
v0.10.33
v0.10.34
v0.10.35
v0.10.36
v0.10.37
v0.10.38
v0.10.39
v0.10.40
v0.10.41
v0.10.42
v0.10.43
v0.10.44
v0.10.45
v0.10.46
v0.11.0
v0.11.1
v0.11.2
v0.11.3
v0.11.4
v0.11.5
v0.11.6
v0.11.7
v0.11.8
v0.11.9
v0.11.10
v0.11.11
v0.11.12
v0.11.13
v0.11.14
v0.11.15
v0.11.16
v0.12.0
v0.12.1
v0.12.2
v0.12.3
v0.12.4
v0.12.5
v0.12.6
v0.12.7
v0.12.8
v0.12.9
v0.12.10
v0.12.11
v0.12.12
v0.12.13
v0.12.14
v0.12.15
v4.0.0
v4.1.0
v4.1.1
v4.1.2
v4.2.0  (LTS: Argon)
v4.2.1  (LTS: Argon)
v4.2.2  (LTS: Argon)
v4.2.3  (LTS: Argon)
v4.2.4  (LTS: Argon)
v4.2.5  (LTS: Argon)
v4.2.6  (LTS: Argon)
v4.3.0  (LTS: Argon)
v4.3.1  (LTS: Argon)
v4.3.2  (LTS: Argon)
v4.4.0  (LTS: Argon)
v4.4.1  (LTS: Argon)
v4.4.2  (LTS: Argon)
v4.4.3  (LTS: Argon)
v4.4.4  (LTS: Argon)
v4.4.5  (LTS: Argon)
v4.4.6  (LTS: Argon)
v4.4.7  (Latest LTS: Argon)
v5.0.0
v5.1.0
v5.1.1
v5.2.0
v5.3.0
v5.4.0
v5.4.1
v5.5.0
v5.6.0
v5.7.0
v5.7.1
v5.8.0
v5.9.0
v5.9.1
v5.10.0
v5.10.1
v5.11.0
v5.11.1
v5.12.0
v6.0.0
v6.1.0
v6.2.0
v6.2.1
v6.2.2

View File

@@ -0,0 +1,319 @@
v0.1.14
v0.1.15
v0.1.16
v0.1.17
v0.1.18
v0.1.19
v0.1.20
v0.1.21
v0.1.22
v0.1.23
v0.1.24
v0.1.25
v0.1.26
v0.1.27
v0.1.28
v0.1.29
v0.1.30
v0.1.31
v0.1.32
v0.1.33
v0.1.90
v0.1.91
v0.1.92
v0.1.93
v0.1.94
v0.1.95
v0.1.96
v0.1.97
v0.1.98
v0.1.99
v0.1.100
v0.1.101
v0.1.102
v0.1.103
v0.1.104
v0.2.0
v0.2.1
v0.2.2
v0.2.3
v0.2.4
v0.2.5
v0.2.6
v0.3.0
v0.3.1
v0.3.2
v0.3.3
v0.3.4
v0.3.5
v0.3.6
v0.3.7
v0.3.8
v0.4.0
v0.4.1
v0.4.2
v0.4.3
v0.4.4
v0.4.5
v0.4.6
v0.4.7
v0.4.8
v0.4.9
v0.4.10
v0.4.11
v0.4.12
v0.5.0
v0.5.1
v0.5.2
v0.5.3
v0.5.4
v0.5.5
v0.5.6
v0.5.7
v0.5.8
v0.5.9
v0.5.10
v0.6.0
v0.6.1
v0.6.2
v0.6.3
v0.6.4
v0.6.5
v0.6.6
v0.6.7
v0.6.8
v0.6.9
v0.6.10
v0.6.11
v0.6.12
v0.6.13
v0.6.14
v0.6.15
v0.6.16
v0.6.17
v0.6.18
v0.6.19
v0.6.20
v0.6.21
v0.7.0
v0.7.1
v0.7.2
v0.7.3
v0.7.4
v0.7.5
v0.7.6
v0.7.7
v0.7.8
v0.7.9
v0.7.10
v0.7.11
v0.7.12
v0.8.0
v0.8.1
v0.8.2
v0.8.3
v0.8.4
v0.8.5
v0.8.6
v0.8.7
v0.8.8
v0.8.9
v0.8.10
v0.8.11
v0.8.12
v0.8.13
v0.8.14
v0.8.15
v0.8.16
v0.8.17
v0.8.18
v0.8.19
v0.8.20
v0.8.21
v0.8.22
v0.8.23
v0.8.24
v0.8.25
v0.8.26
v0.8.27
v0.8.28
v0.9.0
v0.9.1
v0.9.2
v0.9.3
v0.9.4
v0.9.5
v0.9.6
v0.9.7
v0.9.8
v0.9.9
v0.9.10
v0.9.11
v0.9.12
v0.10.0
v0.10.1
v0.10.2
v0.10.3
v0.10.4
v0.10.5
v0.10.6
v0.10.7
v0.10.8
v0.10.9
v0.10.10
v0.10.11
v0.10.12
v0.10.13
v0.10.14
v0.10.15
v0.10.16
v0.10.17
v0.10.18
v0.10.19
v0.10.20
v0.10.21
v0.10.22
v0.10.23
v0.10.24
v0.10.25
v0.10.26
v0.10.27
v0.10.28
v0.10.29
v0.10.30
v0.10.31
v0.10.32
v0.10.33
v0.10.34
v0.10.35
v0.10.36
v0.10.37
v0.10.38
v0.10.39
v0.10.40
v0.10.41
v0.10.42
v0.10.43
v0.10.44
v0.10.45
v0.10.46
v0.11.0
v0.11.1
v0.11.2
v0.11.3
v0.11.4
v0.11.5
v0.11.6
v0.11.7
v0.11.8
v0.11.9
v0.11.10
v0.11.11
v0.11.12
v0.11.13
v0.11.14
v0.11.15
v0.11.16
v0.12.0
v0.12.1
v0.12.2
v0.12.3
v0.12.4
v0.12.5
v0.12.6
v0.12.7
v0.12.8
v0.12.9
v0.12.10
v0.12.11
v0.12.12
v0.12.13
v0.12.14
v0.12.15
iojs-v1.0.0
iojs-v1.0.1
iojs-v1.0.2
iojs-v1.0.3
iojs-v1.0.4
iojs-v1.1.0
iojs-v1.2.0
iojs-v1.3.0
iojs-v1.4.1
iojs-v1.4.2
iojs-v1.4.3
iojs-v1.5.0
iojs-v1.5.1
iojs-v1.6.0
iojs-v1.6.1
iojs-v1.6.2
iojs-v1.6.3
iojs-v1.6.4
iojs-v1.7.1
iojs-v1.8.1
iojs-v1.8.2
iojs-v1.8.3
iojs-v1.8.4
iojs-v2.0.0
iojs-v2.0.1
iojs-v2.0.2
iojs-v2.1.0
iojs-v2.2.0
iojs-v2.2.1
iojs-v2.3.0
iojs-v2.3.1
iojs-v2.3.2
iojs-v2.3.3
iojs-v2.3.4
iojs-v2.4.0
iojs-v2.5.0
iojs-v3.0.0
iojs-v3.1.0
iojs-v3.2.0
iojs-v3.3.0
iojs-v3.3.1
v4.0.0
v4.1.0
v4.1.1
v4.1.2
v4.2.0  (LTS: Argon)
v4.2.1  (LTS: Argon)
v4.2.2  (LTS: Argon)
v4.2.3  (LTS: Argon)
v4.2.4  (LTS: Argon)
v4.2.5  (LTS: Argon)
v4.2.6  (LTS: Argon)
v4.3.0  (LTS: Argon)
v4.3.1  (LTS: Argon)
v4.3.2  (LTS: Argon)
v4.4.0  (LTS: Argon)
v4.4.1  (LTS: Argon)
v4.4.2  (LTS: Argon)
v4.4.3  (LTS: Argon)
v4.4.4  (LTS: Argon)
v4.4.5  (LTS: Argon)
v4.4.6  (LTS: Argon)
v4.4.7  (Latest LTS: Argon)
v5.0.0
v5.1.0
v5.1.1
v5.2.0
v5.3.0
v5.4.0
v5.4.1
v5.5.0
v5.6.0
v5.7.0
v5.7.1
v5.8.0
v5.9.0
v5.9.1
v5.10.0
v5.10.1
v5.11.0
v5.11.1
v5.12.0
v6.0.0
v6.1.0
v6.2.0
v6.2.1
v6.2.2

View File

@@ -0,0 +1,18 @@
v4.2.0 Argon
v4.2.1 Argon
v4.2.2 Argon
v4.2.3 Argon
v4.2.4 Argon
v4.2.5 Argon
v4.2.6 Argon
v4.3.0 Argon
v4.3.1 Argon
v4.3.2 Argon
v4.4.0 Argon
v4.4.1 Argon
v4.4.2 Argon
v4.4.3 Argon
v4.4.4 Argon
v4.4.5 Argon
v4.4.6 Argon
v4.4.7 Argon

View File

@@ -0,0 +1,18 @@
v4.2.0 Argon
v4.2.1 Argon
v4.2.2 Argon
v4.2.3 Argon
v4.2.4 Argon
v4.2.5 Argon
v4.2.6 Argon
v4.3.0 Argon
v4.3.1 Argon
v4.3.2 Argon
v4.4.0 Argon
v4.4.1 Argon
v4.4.2 Argon
v4.4.3 Argon
v4.4.4 Argon
v4.4.5 Argon
v4.4.6 Argon
v4.4.7 Argon

View File

@@ -195,6 +195,8 @@ v0.10.41
v0.10.42 v0.10.42
v0.10.43 v0.10.43
v0.10.44 v0.10.44
v0.10.45
v0.10.46
v0.11.0 v0.11.0
v0.11.1 v0.11.1
v0.11.2 v0.11.2
@@ -226,24 +228,30 @@ v0.12.10
v0.12.11 v0.12.11
v0.12.12 v0.12.12
v0.12.13 v0.12.13
v0.12.14
v0.12.15
v4.0.0 v4.0.0
v4.1.0 v4.1.0
v4.1.1 v4.1.1
v4.1.2 v4.1.2
v4.2.0 v4.2.0 Argon
v4.2.1 v4.2.1 Argon
v4.2.2 v4.2.2 Argon
v4.2.3 v4.2.3 Argon
v4.2.4 v4.2.4 Argon
v4.2.5 v4.2.5 Argon
v4.2.6 v4.2.6 Argon
v4.3.0 v4.3.0 Argon
v4.3.1 v4.3.1 Argon
v4.3.2 v4.3.2 Argon
v4.4.0 v4.4.0 Argon
v4.4.1 v4.4.1 Argon
v4.4.2 v4.4.2 Argon
v4.4.3 v4.4.3 Argon
v4.4.4 Argon
v4.4.5 Argon
v4.4.6 Argon
v4.4.7 Argon
v5.0.0 v5.0.0
v5.1.0 v5.1.0
v5.1.1 v5.1.1
@@ -261,4 +269,10 @@ v5.9.1
v5.10.0 v5.10.0
v5.10.1 v5.10.1
v5.11.0 v5.11.0
v5.11.1
v5.12.0
v6.0.0 v6.0.0
v6.1.0
v6.2.0
v6.2.1
v6.2.2

View File

@@ -0,0 +1,2 @@
lts/argon|v4.4.7
lts/*|lts/argon

View File

@@ -0,0 +1,32 @@
#!/bin/sh
set -ex
die () { echo $@ ; cleanup ; exit 1; }
cleanup() {
unset -f nvm_download nvm_ls_remote nvm_ls_remote_iojs
}
. ../../../nvm.sh
nvm deactivate 2>/dev/null || die 'unable to deactivate'
. ../../common.sh
REMOTE="$PWD/mocks/nvm_ls_remote.txt"
nvm_ls_remote() {
cat "$REMOTE"
}
REMOTE_IOJS="$PWD/mocks/nvm_ls_remote_iojs.txt"
nvm_ls_remote_iojs() {
cat "$REMOTE_IOJS"
}
EXPECTED_OUTPUT_PATH="$PWD/mocks/nvm ls-remote.txt"
OUTPUT="$(nvm ls-remote | sed 's/[ \t]*$//')"
EXPECTED_OUTPUT="$(cat "$EXPECTED_OUTPUT_PATH" | sed 's/[ \t]*$//' )"
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "bare nvm ls-remote did not output expected sorted versions; got $(echo ">$OUTPUT<") expected $(echo ">$EXPECTED_OUTPUT<")"
cleanup

View File

@@ -0,0 +1,43 @@
#!/bin/sh
set -ex
die () { echo $@ ; cleanup ; exit 1; }
cleanup() {
unset -f nvm_remote_version
}
. ../../../nvm.sh
. ../../common.sh
nvm_remote_version() {
echo "NVM_VERSION_ONLY:${NVM_VERSION_ONLY-},NVM_LTS:${NVM_LTS-},PATTERN:${PATTERN-}"
}
OUTPUT="$(nvm version-remote foo)"
EXPECTED_OUTPUT='NVM_VERSION_ONLY:true,NVM_LTS:,PATTERN:foo'
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "\`nvm version-remote foo\` called nvm_remote_version with >${OUTPUT}<, expected >${EXPECTED_OUTPUT}<"
OUTPUT="$(nvm version-remote --lts foo)"
EXPECTED_OUTPUT='NVM_VERSION_ONLY:true,NVM_LTS:*,PATTERN:foo'
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "\`nvm version-remote --lts foo\` called nvm_remote_version with >${OUTPUT}<, expected >${EXPECTED_OUTPUT}<"
OUTPUT="$(nvm version-remote foo --lts)"
EXPECTED_OUTPUT='NVM_VERSION_ONLY:true,NVM_LTS:*,PATTERN:foo'
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "\`nvm version-remote foo --lts\` called nvm_remote_version with >${OUTPUT}<, expected >${EXPECTED_OUTPUT}<"
OUTPUT="$(nvm version-remote --lts=argon foo)"
EXPECTED_OUTPUT='NVM_VERSION_ONLY:true,NVM_LTS:argon,PATTERN:foo'
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "\`nvm version-remote --lts=argon foo\` called nvm_remote_version with >${OUTPUT}<, expected >${EXPECTED_OUTPUT}<"
set +ex # needed for stderr
OUTPUT="$(nvm version-remote --foo bar 2>&1)"
set -ex
EXPECTED_OUTPUT='Unsupported option "--foo".'
EXIT_CODE="$(nvm version-remote --foo bar >/dev/null 2>&1 && echo $? || echo $?)"
[ "${EXIT_CODE}" = 55 ] || die "\`nvm version-remote --foo bar\` did not exit with code 55, got >${EXIT_CODE}<"
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "\`nvm version-remote --foo bar\` errored with >${OUTPUT}<, expected >${EXPECTED_OUTPUT}<"
cleanup

View File

@@ -11,7 +11,9 @@ mkdir -p "$(nvm_version_path v0.1.2)"
OUTPUT="$(nvm_ensure_version_installed foo 2>&1)" OUTPUT="$(nvm_ensure_version_installed foo 2>&1)"
EXIT_CODE=$? EXIT_CODE=$?
EXPECTED_OUTPUT='N/A: version "foo" is not yet installed' EXPECTED_OUTPUT='N/A: version "foo" is not yet installed.
You need to run "nvm install foo" to install it before using it.'
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "expected 'nvm_ensure_version_installed foo' to give $EXPECTED_OUTPUT, got $OUTPUT" [ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "expected 'nvm_ensure_version_installed foo' to give $EXPECTED_OUTPUT, got $OUTPUT"
[ "_$EXIT_CODE" = "_1" ] || die "expected 'nvm_ensure_version_installed foo' to exit with 1, got $EXIT_CODE" [ "_$EXIT_CODE" = "_1" ] || die "expected 'nvm_ensure_version_installed foo' to exit with 1, got $EXIT_CODE"
@@ -23,7 +25,9 @@ EXIT_CODE=$?
# Special case for "iojs" # Special case for "iojs"
OUTPUT="$(nvm_ensure_version_installed iojs 2>&1)" OUTPUT="$(nvm_ensure_version_installed iojs 2>&1)"
EXIT_CODE=$? EXIT_CODE=$?
EXPECTED_OUTPUT='N/A: version "iojs" is not yet installed' EXPECTED_OUTPUT='N/A: version "iojs" is not yet installed.
You need to run "nvm install iojs" to install it before using it.'
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "expected 'nvm_ensure_version_installed iojs' to give $EXPECTED_OUTPUT, got $OUTPUT" [ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "expected 'nvm_ensure_version_installed iojs' to give $EXPECTED_OUTPUT, got $OUTPUT"
[ "_$EXIT_CODE" = "_1" ] || die "expected 'nvm_ensure_version_installed iojs' to exit with 1, got $EXIT_CODE" [ "_$EXIT_CODE" = "_1" ] || die "expected 'nvm_ensure_version_installed iojs' to exit with 1, got $EXIT_CODE"

View File

@@ -32,6 +32,8 @@ setup_mock_arch() {
ln -sf "${MOCKS_DIR}/isainfo_${ARCH}" ./isainfo ln -sf "${MOCKS_DIR}/isainfo_${ARCH}" ./isainfo
if [ "_$OPT" != "_no_pkg_info" ]; then if [ "_$OPT" != "_no_pkg_info" ]; then
ln -sf "${MOCKS_DIR}/pkg_info_${ARCH}" ./pkg_info ln -sf "${MOCKS_DIR}/pkg_info_${ARCH}" ./pkg_info
else
ln -sf "${MOCKS_DIR}/pkg_info_fail" ./pkg_info
fi fi
fi fi

View File

@@ -1,17 +1,17 @@
#!/bin/sh #!/bin/sh
cleanup () { cleanup () {
rm ../../../versions/io.js/v0.1.2/node rm "${NVM_DIR}/versions/io.js/v0.1.2/node"
rm ../../../versions/io.js/v0.1.2/iojs rm "${NVM_DIR}/versions/io.js/v0.1.2/iojs"
rmdir ../../../versions/io.js/v0.1.2 rmdir "${NVM_DIR}/versions/io.js/v0.1.2"
} }
die () { echo $@ ; exit 1; } die () { echo $@ ; exit 1; }
. ../../../nvm.sh . ../../../nvm.sh
mkdir ../../../versions/io.js/v0.1.2 mkdir "${NVM_DIR}/versions/io.js/v0.1.2"
touch ../../../versions/io.js/v0.1.2/node touch "${NVM_DIR}/versions/io.js/v0.1.2/node"
touch ../../../versions/io.js/v0.1.2/iojs touch "${NVM_DIR}/versions/io.js/v0.1.2/iojs"
nvm use iojs-v0.1.2 nvm use iojs-v0.1.2
@@ -28,4 +28,3 @@ if command -v iojs; then
else else
! nvm_has_system_iojs ! nvm_has_system_iojs
fi fi

View File

@@ -1,15 +1,14 @@
#!/bin/sh #!/bin/sh
cleanup () {
rm ../../../v0.1.2/node
rmdir ../../../v0.1.2
}
die () { echo $@ ; exit 1; }
. ../../../nvm.sh . ../../../nvm.sh
mkdir ../../../v0.1.2 cleanup () {
touch ../../../v0.1.2/node rm -rf "${NVM_DIR}/v0.1.2/node"
}
die () { echo $@ ; exit 1; }
mkdir "${NVM_DIR}/v0.1.2"
touch "${NVM_DIR}/v0.1.2/node"
nvm use 0.1.2 nvm use 0.1.2
@@ -26,4 +25,3 @@ if command -v node; then
else else
! nvm_has_system_node ! nvm_has_system_node
fi fi

View File

@@ -8,13 +8,15 @@ cleanup() {
. ../../../nvm.sh . ../../../nvm.sh
MOCKS_DIR="$PWD/mocks"
# sample output at the time the test was written # sample output at the time the test was written
TAB_PATH="$PWD/mocks/nodejs.org-dist-index.tab" TAB_PATH="$MOCKS_DIR/nodejs.org-dist-index.tab"
nvm_download() { nvm_download() {
cat "$TAB_PATH" cat "$TAB_PATH"
} }
EXPECTED_OUTPUT_PATH="$PWD/mocks/nvm_ls_remote.txt" EXPECTED_OUTPUT_PATH="$MOCKS_DIR/nvm_ls_remote.txt"
OUTPUT="$(nvm_ls_remote foo)" OUTPUT="$(nvm_ls_remote foo)"
EXIT_CODE="$(nvm_ls_remote foo >/dev/null 2>&1 ; echo $?)" EXIT_CODE="$(nvm_ls_remote foo >/dev/null 2>&1 ; echo $?)"
@@ -40,7 +42,7 @@ v0.3.8"
# Sanity checks # Sanity checks
OUTPUT="$(nvm_print_implicit_alias remote stable)" OUTPUT="$(nvm_print_implicit_alias remote stable)"
EXPECTED_OUTPUT="6.0" EXPECTED_OUTPUT="6.2"
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm_print_implicit_alias remote stable did not output $EXPECTED_OUTPUT; got $OUTPUT" [ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm_print_implicit_alias remote stable did not output $EXPECTED_OUTPUT; got $OUTPUT"
OUTPUT="$(nvm_print_implicit_alias remote unstable)" OUTPUT="$(nvm_print_implicit_alias remote unstable)"
@@ -48,11 +50,22 @@ EXPECTED_OUTPUT="0.11"
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm_print_implicit_alias remote unstable did not output $EXPECTED_OUTPUT; got $OUTPUT" [ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm_print_implicit_alias remote unstable did not output $EXPECTED_OUTPUT; got $OUTPUT"
OUTPUT="$(nvm_ls_remote stable)" OUTPUT="$(nvm_ls_remote stable)"
EXPECTED_OUTPUT="v6.0.0" EXPECTED_OUTPUT="v6.2.2"
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm_ls_remote stable did not output $EXPECTED_OUTPUT; got $OUTPUT" [ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm_ls_remote stable did not output $EXPECTED_OUTPUT; got $OUTPUT"
OUTPUT="$(nvm_ls_remote unstable)" OUTPUT="$(nvm_ls_remote unstable)"
EXPECTED_OUTPUT="v0.11.16" EXPECTED_OUTPUT="v0.11.16"
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm_ls_remote unstable did not output $EXPECTED_OUTPUT; got $OUTPUT" [ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm_ls_remote unstable did not output $EXPECTED_OUTPUT; got $OUTPUT"
EXPECTED_OUTPUT_PATH="$MOCKS_DIR/nvm_ls_remote LTS.txt"
EXPECTED_OUTPUT="$(cat "$EXPECTED_OUTPUT_PATH")"
OUTPUT="$(NVM_LTS='*' nvm_ls_remote)"
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "\`NVM_LTS='*' nvm_ls_remote\` did not output >$EXPECTED_OUTPUT<; got >$OUTPUT<"
EXPECTED_OUTPUT_PATH="$MOCKS_DIR/nvm_ls_remote LTS argon.txt"
EXPECTED_OUTPUT="$(cat "$EXPECTED_OUTPUT_PATH")"
OUTPUT="$(NVM_LTS=argon nvm_ls_remote)"
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "\`NVM_LTS=argon nvm_ls_remote\` did not output >$EXPECTED_OUTPUT<; got >$OUTPUT<"
cleanup cleanup

View File

@@ -0,0 +1,50 @@
#!/bin/sh
set -ex
die () { echo $@ ; cleanup ; exit 1; }
TEST_PATH="$PWD/test_output"
mkdir -p "$TEST_PATH"
CALL_COUNT_PATH="$TEST_PATH/call_count.txt"
: > "$CALL_COUNT_PATH"
ALIAS_ARGS_PATH="$TEST_PATH/nvm_make_alias_args.txt"
: > "$ALIAS_ARGS_PATH"
cleanup() {
unset -f nvm_download nvm_make_alias
rm -rf "$TEST_PATH"
}
. ../../../nvm.sh
set -ex
MOCKS_DIR="$PWD/mocks"
# sample output at the time the test was written
TAB_PATH="$MOCKS_DIR/nodejs.org-dist-index.tab"
nvm_download() {
cat "$TAB_PATH"
}
nvm_make_alias() {
CALL_COUNT="$(cat "$CALL_COUNT_PATH")"
CALL_COUNT="$((CALL_COUNT + 1))"
echo "$CALL_COUNT" > "$CALL_COUNT_PATH"
echo "${1}|${2}" >> "$ALIAS_ARGS_PATH"
}
nvm_ls_remote >/dev/null || die "nvm_ls_remote_failed?!"
CALL_COUNT="$(cat "$CALL_COUNT_PATH")"
EXPECTED_COUNT=2
[ "$CALL_COUNT" = "$EXPECTED_COUNT" ] || die "nvm_make_alias called $CALL_COUNT times; expected $EXPECTED_COUNT"
ARGS="$(cat "$ALIAS_ARGS_PATH")"
EXPECTED_ARGS_PATH="$MOCKS_DIR/nvm_make_alias LTS alias calls.txt"
EXPECTED_ARGS="$(cat "$EXPECTED_ARGS_PATH")"
[ "${ARGS}" = "${EXPECTED_ARGS}" ] || die "nvm_make_alias called with >${ARGS}<; expected >${EXPECTED_ARGS}<"
cleanup

View File

@@ -2,25 +2,25 @@
die () { echo $@ ; cleanup ; exit 1; } die () { echo $@ ; cleanup ; exit 1; }
cleanup() { cleanup() {
rm -rf ../../../v0.2.3 rm -rf "${NVM_DIR}/v0.2.3"
rm -rf ../../../v0.3.4 rm -rf "${NVM_DIR}/v0.3.4"
rm -rf ../../../v0.4.6 rm -rf "${NVM_DIR}/v0.4.6"
rm -rf ../../../v0.5.7 rm -rf "${NVM_DIR}/v0.5.7"
rm -rf ../../../v0.7.7 rm -rf "${NVM_DIR}/v0.7.7"
rm -rf ../../../versions/io.js/v0.98.0 rm -rf "${NVM_DIR}/versions/io.js/v0.98.0"
rm -rf ../../../versions/node/v1.0.0 rm -rf "${NVM_DIR}/versions/node/v1.0.0"
rm -rf ../../../versions/node/v1.1.0 rm -rf "${NVM_DIR}/versions/node/v1.1.0"
unset -f nvm_ls_remote nvm_ls_remote_iojs unset -f nvm_ls_remote nvm_ls_remote_iojs
} }
. ../../../nvm.sh . ../../../nvm.sh
mkdir ../../../v0.2.3 mkdir "${NVM_DIR}/v0.2.3"
mkdir ../../../v0.3.4 mkdir "${NVM_DIR}/v0.3.4"
mkdir ../../../v0.4.6 mkdir "${NVM_DIR}/v0.4.6"
mkdir ../../../v0.5.7 mkdir "${NVM_DIR}/v0.5.7"
mkdir ../../../v0.7.7 mkdir "${NVM_DIR}/v0.7.7"
mkdir -p ../../../versions/io.js/v0.98.0 mkdir -p "${NVM_DIR}/versions/io.js/v0.98.0"
LATEST_STABLE="$(nvm_print_implicit_alias local stable)" LATEST_STABLE="$(nvm_print_implicit_alias local stable)"
[ "_$LATEST_STABLE" = "_0.4" ] || die "local stable is not latest even minor: expected 0.4, got $LATEST_STABLE" [ "_$LATEST_STABLE" = "_0.4" ] || die "local stable is not latest even minor: expected 0.4, got $LATEST_STABLE"
@@ -35,8 +35,8 @@ LATEST_IOJS="$(nvm_print_implicit_alias local iojs)"
[ "_$LATEST_IOJS" = "_iojs-v0.98" ] || die "local iojs is not latest iojs: expected iojs-v0.98, got $LATEST_IOJS" [ "_$LATEST_IOJS" = "_iojs-v0.98" ] || die "local iojs is not latest iojs: expected iojs-v0.98, got $LATEST_IOJS"
## node post v1.0/io.js merger ## ## node post v1.0/io.js merger ##
mkdir -p ../../../versions/node/v1.0.0 mkdir -p "${NVM_DIR}/versions/node/v1.0.0"
mkdir -p ../../../versions/node/v1.1.0 mkdir -p "${NVM_DIR}/versions/node/v1.1.0"
LATEST_STABLE="$(nvm_print_implicit_alias local stable)" LATEST_STABLE="$(nvm_print_implicit_alias local stable)"
[ "_$LATEST_STABLE" = "_1.1" ] || die "local stable when post-v1.0 exists is not latest: expected 1.1, got $LATEST_STABLE" [ "_$LATEST_STABLE" = "_1.1" ] || die "local stable when post-v1.0 exists is not latest: expected 1.1, got $LATEST_STABLE"
@@ -102,4 +102,3 @@ LATEST_UNSTABLE="$(nvm_print_implicit_alias remote unstable)"
## ** ## ## ** ##
cleanup cleanup

View File

@@ -26,34 +26,34 @@ EXIT_CODE="$(nvm_remote_version iojs-foo >/dev/null 2>&1 ; echo $?)"
nvm_ls_remote() { nvm_ls_remote() {
if ! nvm_is_iojs_version "$1"; then if [ -z "$1" ] || ! nvm_is_iojs_version "$1"; then
echo "test output" echo "test_output"
echo "more test output" echo "more_test_output"
echo "pattern received: _$1_" echo "pattern_received:_$1_"
fi fi
} }
nvm_ls_remote_iojs() { nvm_ls_remote_iojs() {
if [ -z "$1" ] || nvm_is_iojs_version "$1"; then if [ -z "$1" ] || nvm_is_iojs_version "$1"; then
echo "test iojs output" echo "test_iojs_output"
echo "more iojs test output" echo "more_iojs_test_output"
echo "iojs pattern received: _$1_" echo "iojs_pattern_received:_$1_"
fi fi
} }
OUTPUT="$(nvm_remote_version foo)" OUTPUT="$(nvm_remote_version foo)"
EXIT_CODE="$(nvm_remote_version foo >/dev/null 2>&1 ; echo $?)" EXIT_CODE="$(nvm_remote_version foo >/dev/null 2>&1 ; echo $?)"
[ "_$OUTPUT" = "_pattern received: _foo_" ] \ [ "_$OUTPUT" = "_pattern_received:_foo_" ] \
|| die "nvm_remote_version foo did not return last line only of nvm_ls_remote foo; got $OUTPUT" || die "nvm_remote_version foo did not return last line only of nvm_ls_remote foo; got $OUTPUT"
[ "_$EXIT_CODE" = "_0" ] || die "nvm_remote_version foo did not exit with 0, got $EXIT_CODE" [ "_$EXIT_CODE" = "_0" ] || die "nvm_remote_version foo did not exit with 0, got $EXIT_CODE"
OUTPUT="$(nvm_remote_version iojs-foo)" OUTPUT="$(nvm_remote_version iojs-foo)"
EXIT_CODE="$(nvm_remote_version iojs-foo >/dev/null 2>&1 ; echo $?)" EXIT_CODE="$(nvm_remote_version iojs-foo >/dev/null 2>&1 ; echo $?)"
[ "_$OUTPUT" = "_iojs pattern received: _iojs-foo_" ] \ [ "_$OUTPUT" = "_iojs_pattern_received:_iojs-foo_" ] \
|| die "nvm_remote_version iojs-foo did not return last line only of nvm_ls_remote_iojs foo; got $OUTPUT" || die "nvm_remote_version iojs-foo did not return last line only of nvm_ls_remote_iojs foo; got $OUTPUT"
[ "_$EXIT_CODE" = "_0" ] || die "nvm_remote_version iojs-foo did not exit with 0, got $EXIT_CODE" [ "_$EXIT_CODE" = "_0" ] || die "nvm_remote_version iojs-foo did not exit with 0, got $EXIT_CODE"
OUTPUT="$(nvm_remote_version iojs)" OUTPUT="$(nvm_remote_version iojs)"
EXIT_CODE="$(nvm_remote_version iojs >/dev/null 2>&1 ; echo $?)" EXIT_CODE="$(nvm_remote_version iojs >/dev/null 2>&1 ; echo $?)"
[ "_$OUTPUT" = "_iojs pattern received: __" ] \ [ "_$OUTPUT" = "_iojs_pattern_received:__" ] \
|| die "nvm_remote_version iojs did not return last line only of nvm_ls_remote_iojs; got $OUTPUT" || die "nvm_remote_version iojs did not return last line only of nvm_ls_remote_iojs; got $OUTPUT"
[ "_$EXIT_CODE" = "_0" ] || die "nvm_remote_version iojs did not exit with 0, got $EXIT_CODE" [ "_$EXIT_CODE" = "_0" ] || die "nvm_remote_version iojs did not exit with 0, got $EXIT_CODE"

View File

@@ -1,5 +1,7 @@
#!/bin/sh #!/bin/sh
set -ex
( (
cd ../.. cd ../..

View File

@@ -1,5 +1,7 @@
#!/bin/sh #!/bin/sh
set -ex
( (
cd ../.. cd ../..

View File

@@ -1,5 +1,7 @@
#!/bin/sh #!/bin/sh
set -ex
# Remove temporary files # Remove temporary files
( (
cd ../.. cd ../..

View File

@@ -1,5 +1,7 @@
#!/bin/sh #!/bin/sh
set -ex
( (
cd ../.. cd ../..

View File

@@ -0,0 +1,25 @@
#!/bin/sh
cleanup () {
unset -f die cleanup
unset install_dir
}
die () { echo $@ ; cleanup ; exit 1; }
NVM_ENV=testing . ../../install.sh
HOME="__home__"
# NVM_DIR is set
NVM_DIR="some_dir"
install_dir=$(nvm_install_dir)
[ "_$install_dir" = "_$NVM_DIR" ] || die "nvm_install_dir should use \$NVM_DIR if it exists. Current output: $install_dir"
unset NVM_DIR
# NVM_DIR is not set
install_dir=$(nvm_install_dir)
[ "_$install_dir" = "_$HOME/.nvm" ] || die "nvm_install_dir should default to \$HOME/.nvm. Current output: $install_dir"
cleanup

View File

@@ -7,8 +7,8 @@ die () { echo $@ ; exit 1; }
[ "$(nvm install invalid.invalid 2>&1)" = "Version 'invalid.invalid' not found - try \`nvm ls-remote\` to browse available versions." ] || die "nvm installing an invalid version did not print a nice error message" [ "$(nvm install invalid.invalid 2>&1)" = "Version 'invalid.invalid' not found - try \`nvm ls-remote\` to browse available versions." ] || die "nvm installing an invalid version did not print a nice error message"
# Remove the stuff we're clobbering. # Remove the stuff we're clobbering.
[ -e ../../../versions/io.js/v1.0.0 ] && rm -R ../../../versions/io.js/v1.0.0 [ -e "${NVM_DIR}/versions/io.js/v1.0.0" ] && rm -R "${NVM_DIR}/versions/io.js/v1.0.0"
[ -e ../../../versions/io.js/v1.0.1 ] && rm -R ../../../versions/io.js/v1.0.1 [ -e "${NVM_DIR}/versions/io.js/v1.0.1" ] && rm -R "${NVM_DIR}/versions/io.js/v1.0.1"
# Install from binary # Install from binary
nvm install iojs-v1.0.0 nvm install iojs-v1.0.0
@@ -23,4 +23,3 @@ nvm install iojs-v1.0.1
node --version | grep v1.0.1 || die "nvm install on already installed version doesn't use it (node binary)" node --version | grep v1.0.1 || die "nvm install on already installed version doesn't use it (node binary)"
iojs --version | grep v1.0.1 || die "nvm install on already installed version doesn't use it (iojs binary)" iojs --version | grep v1.0.1 || die "nvm install on already installed version doesn't use it (iojs binary)"

View File

@@ -8,12 +8,11 @@ NVM_TEST_VERSION="v1.0.0"
NVM_PREFIXED_TEST_VERSION="iojs-$NVM_TEST_VERSION" NVM_PREFIXED_TEST_VERSION="iojs-$NVM_TEST_VERSION"
# Remove the stuff we're clobbering. # Remove the stuff we're clobbering.
[ -e ../../../$NVM_TEST_VERSION ] && rm -R ../../../$NVM_TEST_VERSION [ -e "${NVM_DIR}/versions/io.js/${NVM_TEST_VERSION}" ] && rm -R "${NVM_DIR}/versions/io.js/${NVM_TEST_VERSION}"
# Install from binary # Install from binary
nvm install $NVM_PREFIXED_TEST_VERSION || die "install $NVM_PREFIXED_TEST_VERSION failed" nvm install $NVM_PREFIXED_TEST_VERSION || die "install $NVM_PREFIXED_TEST_VERSION failed"
# Check # Check
[ -d ../../../versions/io.js/$NVM_TEST_VERSION ] [ -d "${NVM_DIR}/versions/io.js/${NVM_TEST_VERSION}" ]
nvm run $NVM_PREFIXED_TEST_VERSION --version | grep $NVM_TEST_VERSION || die "'nvm run $NVM_PREFIXED_TEST_VERSION --version | grep $NVM_TEST_VERSION' failed" nvm run "${NVM_PREFIXED_TEST_VERSION}" --version | grep "${NVM_TEST_VERSION}" || die "'nvm run ${NVM_PREFIXED_TEST_VERSION} --version | grep ${NVM_TEST_VERSION}' failed"

View File

@@ -5,16 +5,16 @@ die () { echo $@ ; exit 1; }
. ../../nvm.sh . ../../nvm.sh
# Remove the stuff we're clobbering. # Remove the stuff we're clobbering.
[ -e ../../versions/io.js/v1.0.0 ] && rm -R ../../versions/io.js/v1.0.0 [ -e "${NVM_DIR}/versions/io.js/v1.0.0" ] && rm -R "${NVM_DIR}/versions/io.js/v1.0.0"
[ -e ../../versions/io.js/v1.0.1 ] && rm -R ../../versions/io.js/v1.0.1 [ -e "${NVM_DIR}/versions/io.js/v1.0.1" ] && rm -R "${NVM_DIR}/versions/io.js/v1.0.1"
# Install from binary # Install from binary
nvm install iojs-v1.0.0 || die "'nvm install iojs-v1.0.0' failed" nvm install iojs-v1.0.0 || die "'nvm install iojs-v1.0.0' failed"
nvm i iojs-v1.0.1 || die "'nvm i iojs-v1.0.1' failed" nvm i iojs-v1.0.1 || die "'nvm i iojs-v1.0.1' failed"
# Check # Check
[ -d ../../versions/io.js/v1.0.0 ] || die "iojs v1.0.0 didn't exist" [ -d "${NVM_DIR}/versions/io.js/v1.0.0" ] || die "iojs v1.0.0 didn't exist"
[ -d ../../versions/io.js/v1.0.1 ] || die "iojs v1.0.1 didn't exist" [ -d "${NVM_DIR}/versions/io.js/v1.0.1" ] || die "iojs v1.0.1 didn't exist"
# Use the first one # Use the first one
nvm use iojs-1.0.0 || die "'nvm use iojs-1.0.0' failed" nvm use iojs-1.0.0 || die "'nvm use iojs-1.0.0' failed"
@@ -23,4 +23,3 @@ nvm use iojs-1.0.0 || die "'nvm use iojs-1.0.0' failed"
nvm use iojs-1 || die "'nvm use iojs-1' failed" nvm use iojs-1 || die "'nvm use iojs-1' failed"
[ "_$(node --version)" = "_v1.0.1" ] || die "'node --version' was not v1.0.1, got: $(node --version)" [ "_$(node --version)" = "_v1.0.1" ] || die "'node --version' was not v1.0.1, got: $(node --version)"
[ "_$(iojs --version)" = "_v1.0.1" ] || die "'iojs --version' was not v1.0.1, got: $(iojs --version)" [ "_$(iojs --version)" = "_v1.0.1" ] || die "'iojs --version' was not v1.0.1, got: $(iojs --version)"

View File

@@ -5,20 +5,18 @@ die () { echo $@ ; exit 1; }
. ../../nvm.sh . ../../nvm.sh
NVM_TEST_VERSION=v1.0.0 NVM_TEST_VERSION=v1.0.0
NVM_PREFIXED_TEST_VERSION="iojs-$NVM_TEST_VERSION" NVM_PREFIXED_TEST_VERSION="iojs-${NVM_TEST_VERSION}"
VERSION_PATH="../../versions/io.js/$NVM_TEST_VERSION" VERSION_PATH="${NVM_DIR}/versions/io.js/${NVM_TEST_VERSION}"
# Remove the stuff we're clobbering. # Remove the stuff we're clobbering.
[ -e $VERSION_PATH ] && rm -R $VERSION_PATH [ -e "${VERSION_PATH}" ] && rm -R "${VERSION_PATH}"
# Install from binary # Install from binary
echo "$NVM_PREFIXED_TEST_VERSION" > .nvmrc echo "${NVM_PREFIXED_TEST_VERSION}" > .nvmrc
nvm install || die "'nvm install' failed" nvm install || die "'nvm install' failed"
# Check # Check
[ -d $VERSION_PATH ] || die "./$VERSION_PATH did not exist" [ -d "${VERSION_PATH}" ] || die "./${VERSION_PATH} did not exist"
nvm run $NVM_PREFIXED_TEST_VERSION --version | grep $NVM_TEST_VERSION \ nvm run "${NVM_PREFIXED_TEST_VERSION}" --version | grep "${NVM_TEST_VERSION}" \
|| "'nvm run $NVM_PREFIXED_TEST_VERSION --version | grep $NVM_TEST_VERSION' failed" || "'nvm run \'${NVM_PREFIXED_TEST_VERSION}\' --version | grep \'${NVM_TEST_VERSION}\'' failed"

View File

@@ -5,14 +5,14 @@ die () { echo $@ ; exit 1; }
. ../../nvm.sh . ../../nvm.sh
# Remove the stuff we're clobbering. # Remove the stuff we're clobbering.
[ -e ../../versions/io.js/v1.0.0 ] && rm -R ../../versions/io.js/v1.0.0 [ -e "${NVM_DIR}/versions/io.js/v1.0.0" ] && rm -R "${NVM_DIR}/versions/io.js/v1.0.0"
[ -e ../../versions/io.js/v1.0.1 ] && rm -R ../../versions/io.js/v1.0.1 [ -e "${NVM_DIR}/versions/io.js/v1.0.1" ] && rm -R "${NVM_DIR}/versions/io.js/v1.0.1"
# Install from binary # Install from binary
nvm install iojs-v1.0.0 nvm install iojs-v1.0.0
# Check # Check
[ -d ../../versions/io.js/v1.0.0 ] || die "nvm install iojs-v1.0.0 didn't install" [ -d "${NVM_DIR}/versions/io.js/v1.0.0" ] || die "nvm install iojs-v1.0.0 didn't install"
node --version | grep v1.0.0 > /dev/null || die "nvm install didn't use iojs-v1.0.0" node --version | grep v1.0.0 > /dev/null || die "nvm install didn't use iojs-v1.0.0"
@@ -23,10 +23,9 @@ nvm ls iojs-1 | grep iojs-v1.0.0 > /dev/null || die "nvm ls iojs-1 didn't show i
nvm install iojs-v1.0.1 --reinstall-packages-from=iojs-1.0.0 || die "nvm install iojs-v1.0.1 --reinstall-packages-from=iojs-1.0.0 failed" nvm install iojs-v1.0.1 --reinstall-packages-from=iojs-1.0.0 || die "nvm install iojs-v1.0.1 --reinstall-packages-from=iojs-1.0.0 failed"
[ -d ../../versions/io.js/v1.0.1 ] || die "nvm install iojs-v1.0.1 didn't install" [ -d "${NVM_DIR}/versions/io.js/v1.0.1" ] || die "nvm install iojs-v1.0.1 didn't install"
nvm use iojs-1 nvm use iojs-1
node --version | grep v1.0.1 > /dev/null || die "nvm use iojs-1 didn't use v1.0.1" node --version | grep v1.0.1 > /dev/null || die "nvm use iojs-1 didn't use v1.0.1"
npm list --global | grep object-is > /dev/null || die "object-is isn't installed" npm list --global | grep object-is > /dev/null || die "object-is isn't installed"

View File

@@ -5,7 +5,7 @@ die () { echo $@ ; exit 1; }
. ../../nvm.sh . ../../nvm.sh
NVM_VERSION="v1" NVM_VERSION="v1"
NVM_PREFIXED_TEST_VERSION="$(nvm ls-remote "$NVM_VERSION" | tail -n1 | sed 's/^[ ]*//;s/[ ]*$//')" NVM_PREFIXED_TEST_VERSION="$(nvm ls-remote "$NVM_VERSION" | tail -1 | sed 's/^[ ]*//;s/[ ]*$//')"
NVM_TEST_VERSION="$(nvm_strip_iojs_prefix "$NVM_PREFIXED_TEST_VERSION")" NVM_TEST_VERSION="$(nvm_strip_iojs_prefix "$NVM_PREFIXED_TEST_VERSION")"
# Remove the stuff we're clobbering. # Remove the stuff we're clobbering.
@@ -15,6 +15,5 @@ NVM_TEST_VERSION="$(nvm_strip_iojs_prefix "$NVM_PREFIXED_TEST_VERSION")"
nvm install "$NVM_VERSION" || die "nvm install $NVM_VERSION failed" nvm install "$NVM_VERSION" || die "nvm install $NVM_VERSION failed"
# Check # Check
[ -d ../../versions/io.js/$NVM_TEST_VERSION ] [ -d "${NVM_DIR}/versions/io.js/$NVM_TEST_VERSION" ]
nvm run $NVM_PREFIXED_TEST_VERSION --version | grep $NVM_TEST_VERSION || die "'nvm run $NVM_PREFIXED_TEST_VERSION --version | grep $NVM_TEST_VERSION' failed" nvm run $NVM_PREFIXED_TEST_VERSION --version | grep $NVM_TEST_VERSION || die "'nvm run $NVM_PREFIXED_TEST_VERSION --version | grep $NVM_TEST_VERSION' failed"

View File

@@ -0,0 +1,31 @@
#!/bin/sh
set -ex
die () { echo $@ ; exit 1; }
. ../../nvm.sh
nvm unalias default >/dev/null 2>&1 || die 'unable to unalias default'
set +ex # needed for stderr
OUTPUT="$(nvm install --lts 3 2>&1)"
set -ex
EXIT_CODE="$(nvm install --lts 3 >/dev/null 2>&1 && echo $? || echo $?)"
EXPECTED_OUTPUT="Version '3' (with LTS filter) not found - try \`nvm ls-remote --lts\` to browse available versions."
[ "${EXIT_CODE}" = 3 ] || die "\`nvm install --lts 3\` did not exit with 3, got >${EXIT_CODE}<"
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "\`nvm install --lts 3\` output >${OUTPUT}<, expected >${EXPECTED_OUTPUT}<"
set +ex # needed for stderr
OUTPUT="$(nvm install --lts=argon 3 2>&1)"
set -ex
EXIT_CODE="$(nvm install --lts=argon 3 >/dev/null 2>&1 && echo $? || echo $?)"
EXPECTED_OUTPUT="Version '3' (with LTS filter 'argon') not found - try \`nvm ls-remote --lts=argon\` to browse available versions."
[ "${EXIT_CODE}" = 3 ] || die "\`nvm install --lts=argon 3\` did not exit with 3, got >${EXIT_CODE}<"
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "\`nvm install --lts=argon 3\` output >${OUTPUT}<, expected >${EXPECTED_OUTPUT}<"
set +e # TODO: fix
nvm install --lts 4.2.2 || die 'nvm install --lts 4.2.2 failed'
set -e
[ "$(nvm current)" = "v4.2.2" ] || die "v4.2.2 not current, got $(nvm_current)"

View File

@@ -7,8 +7,8 @@ die () { echo $@ ; exit 1; }
[ "$(nvm install invalid.invalid 2>&1)" = "Version 'invalid.invalid' not found - try \`nvm ls-remote\` to browse available versions." ] || die "nvm installing an invalid version did not print a nice error message" [ "$(nvm install invalid.invalid 2>&1)" = "Version 'invalid.invalid' not found - try \`nvm ls-remote\` to browse available versions." ] || die "nvm installing an invalid version did not print a nice error message"
# Remove the stuff we're clobbering. # Remove the stuff we're clobbering.
[ -e ../../v0.9.7 ] && rm -R ../../v0.9.7 [ -e "${NVM_DIR}/v0.9.7" ] && rm -R "${NVM_DIR}/v0.9.7"
[ -e ../../v0.9.12 ] && rm -R ../../v0.9.12 [ -e "${NVM_DIR}/v0.9.12" ] && rm -R "${NVM_DIR}/v0.9.12"
# Install from binary # Install from binary
nvm install 0.9.7 nvm install 0.9.7
@@ -21,4 +21,3 @@ node --version | grep v0.9.7 || die "precondition failed: node doesn't start at
nvm install 0.9.12 nvm install 0.9.12
node --version | grep v0.9.12 || die "nvm install on already installed version doesn't use it" node --version | grep v0.9.12 || die "nvm install on already installed version doesn't use it"

View File

@@ -5,16 +5,16 @@ die () { echo $@ ; exit 1; }
. ../../nvm.sh . ../../nvm.sh
# Remove the stuff we're clobbering. # Remove the stuff we're clobbering.
[ -e ../../v0.9.7 ] && rm -R ../../v0.9.7 [ -e "${NVM_DIR}/v0.9.7" ] && rm -R "${NVM_DIR}/v0.9.7"
[ -e ../../v0.9.12 ] && rm -R ../../v0.9.12 [ -e "${NVM_DIR}/v0.9.12" ] && rm -R "${NVM_DIR}/v0.9.12"
# Install from binary # Install from binary
nvm install 0.9.7 || die "'nvm install 0.9.7' failed" nvm install 0.9.7 || die "'nvm install 0.9.7' failed"
nvm i 0.9.12 || die "'nvm i 0.9.12' failed" nvm i 0.9.12 || die "'nvm i 0.9.12' failed"
# Check # Check
[ -d ../../v0.9.7 ] || die "v0.9.7 didn't exist" [ -d "${NVM_DIR}/v0.9.7" ] || die "v0.9.7 didn't exist"
[ -d ../../v0.9.12 ] || die "v0.9.12 didn't exist" [ -d "${NVM_DIR}/v0.9.12" ] || die "v0.9.12 didn't exist"
# Use the first one # Use the first one
nvm use 0.9.7 || die "'nvm use 0.9.7' failed" nvm use 0.9.7 || die "'nvm use 0.9.7' failed"
@@ -22,4 +22,3 @@ nvm use 0.9.7 || die "'nvm use 0.9.7' failed"
# Use the latest one # Use the latest one
nvm use 0.9 || die "'nvm use 0.9' failed" nvm use 0.9 || die "'nvm use 0.9' failed"
node --version | grep v0.9.12 || die "'node --version' was not v0.9.12, got: $(node --version)" node --version | grep v0.9.12 || die "'node --version' was not v0.9.12, got: $(node --version)"

View File

@@ -5,14 +5,14 @@ die () { echo $@ ; exit 1; }
. ../../nvm.sh . ../../nvm.sh
# Remove the stuff we're clobbering. # Remove the stuff we're clobbering.
[ -e ../../v0.9.7 ] && rm -R ../../v0.9.7 [ -e "${NVM_DIR}/v0.9.7" ] && rm -R "${NVM_DIR}/v0.9.7"
[ -e ../../v0.9.12 ] && rm -R ../../v0.9.12 [ -e "${NVM_DIR}/v0.9.12" ] && rm -R "${NVM_DIR}/v0.9.12"
# Install from binary # Install from binary
nvm install 0.9.7 nvm install 0.9.7
# Check # Check
[ -d ../../v0.9.7 ] || die "nvm install 0.9.7 didn't install" [ -d "${NVM_DIR}/v0.9.7" ] || die "nvm install 0.9.7 didn't install"
nvm use 0.9.7 nvm use 0.9.7
@@ -25,10 +25,9 @@ nvm ls 0.9 | grep v0.9.7 > /dev/null || die "nvm ls 0.9 didn't show v0.9.7"
nvm install 0.9.12 --reinstall-packages-from=0.9 || die "nvm install 0.9.12 --reinstall-packages-from=0.9 failed" nvm install 0.9.12 --reinstall-packages-from=0.9 || die "nvm install 0.9.12 --reinstall-packages-from=0.9 failed"
[ -d ../../v0.9.12 ] || die "nvm install 0.9.12 didn't install" [ -d "${NVM_DIR}/v0.9.12" ] || die "nvm install 0.9.12 didn't install"
nvm use 0.9 nvm use 0.9
node --version | grep v0.9.12 > /dev/null || die "nvm ls 0.9 didn't use v0.9.12" node --version | grep v0.9.12 > /dev/null || die "nvm ls 0.9 didn't use v0.9.12"
npm list --global | grep object-is > /dev/null || die "object-is isn't installed" npm list --global | grep object-is > /dev/null || die "object-is isn't installed"

View File

@@ -3,6 +3,7 @@
. ../../nvm.sh . ../../nvm.sh
nvm deactivate nvm deactivate
nvm uninstall v0.10.7 nvm uninstall v0.10.7
nvm uninstall v4.2.2
if [ -f ".nvmrc" ]; then if [ -f ".nvmrc" ]; then
rm .nvmrc rm .nvmrc

View File

@@ -1 +1,4 @@
# On SmartOS 64bits setups, pkg_info outputs _both_ i386 and x86_64
# architectures as architectures supported by pkg_install.
echo "i386"
echo "x86_64" echo "x86_64"

1
test/mocks/pkg_info_fail Executable file
View File

@@ -0,0 +1 @@
exit 1

View File

@@ -0,0 +1,18 @@
#!/bin/sh
set -ex
die () { echo $@ ; exit 1; }
. ../../../nvm.sh
nvm install --lts || die 'nvm install --lts failed'
NPM_VERSION_LTS="$(npm --version)"
TEST_STRING="foo bar"
nvm use 1.0.0 && [ "$(node --version)" = "v1.0.0" ] || die "\`nvm use\` failed!"
[ "$(nvm exec --lts npm --version | tail -1)" = "$NPM_VERSION_LTS" ] || die "`nvm exec` failed to run with the correct version"
[ "$(nvm exec --lts bash -c "printf '$TEST_STRING'" | tail -1)" = "$TEST_STRING" ] || die "\`nvm exec\` failed to run with a command including whitespace"

View File

@@ -10,6 +10,6 @@ TEST_STRING="foo bar"
nvm use 1.0.0 && [ "$(node --version)" = "v1.0.0" ] || die "\`nvm use\` failed!" nvm use 1.0.0 && [ "$(node --version)" = "v1.0.0" ] || die "\`nvm use\` failed!"
[ "$(nvm exec 0.10 npm --version | tail -1)" = "$NPM_VERSION_TEN" ] || die "`nvm exec` failed to run with the correct version" [ "$(nvm exec 0.10 npm --version | tail -1)" = "$NPM_VERSION_TEN" ] || die "\`nvm exec\` failed to run with the correct version"
[ "$(nvm exec 0.10 bash -c "printf '$TEST_STRING'" | tail -1)" = "$TEST_STRING" ] || die "`nvm exec` failed to run with the command include white-spaces" [ "$(nvm exec 0.10 bash -c "printf '$TEST_STRING'" | tail -1)" = "$TEST_STRING" ] || die "\`nvm exec\` failed to run with a command including whitespace"

View File

@@ -3,6 +3,7 @@
. ../../../nvm.sh . ../../../nvm.sh
nvm install 0.10.7 nvm install 0.10.7
nvm install 1.0.0 nvm install 1.0.0
nvm install --lts
if [ -f ".nvmrc" ]; then if [ -f ".nvmrc" ]; then
mv .nvmrc .nvmrc.bak mv .nvmrc .nvmrc.bak

View File

@@ -4,6 +4,7 @@
nvm deactivate nvm deactivate
nvm uninstall v0.10.7 nvm uninstall v0.10.7
nvm uninstall v1.0.0 nvm uninstall v1.0.0
nvm uninstall --lts
rm .nvmrc rm .nvmrc

View File

@@ -0,0 +1,15 @@
#!/bin/sh
set -ex
die () { echo $@ ; exit 1; }
. ../../../nvm.sh
OUTPUT="$(nvm run --silent --lts --version)"
EXPECTED_OUTPUT="$(nvm_match_version 'lts/*')"
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "\`nvm run --lts\` failed to run with the correct version; expected >${EXPECTED_OUTPUT}<, got >${OUTPUT}<"
OUTPUT="$(nvm run --silent --lts=argon --version)"
EXPECTED_OUTPUT="$(nvm_match_version 'lts/argon')"
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "\`nvm run --lts=argon\` failed to run with the correct version; expected >${EXPECTED_OUTPUT}<, got >${OUTPUT}<"

View File

@@ -5,5 +5,12 @@ die () { echo $@ ; exit 1; }
. ../../../nvm.sh . ../../../nvm.sh
[ "$(nvm run 0.2 --version 2>&1)" = 'N/A: version "v0.2" is not yet installed' ] || die "\`nvm run\` with an uninstalled node version failed to error out correctly" EXPECTED_OUTPUT='N/A: version "v0.2" is not yet installed.
[ "$(nvm run iojs-0.2 --version 2>&1)" = 'N/A: version "iojs-v0.2" is not yet installed' ] || die "\`nvm run\` with an uninstalled iojs version failed to error out correctly"
You need to run "nvm install 0.2" to install it before using it.'
[ "_$(nvm run 0.2 --version 2>&1)" = "_$EXPECTED_OUTPUT" ] || die "\`nvm run\` with an uninstalled node version failed to error out correctly"
EXPECTED_OUTPUT='N/A: version "iojs-v0.2" is not yet installed.
You need to run "nvm install iojs-0.2" to install it before using it.'
[ "_$(nvm run iojs-0.2 --version 2>&1)" = "_$EXPECTED_OUTPUT" ] || die "\`nvm run\` with an uninstalled iojs version failed to error out correctly"

View File

@@ -1,7 +1,10 @@
#!/bin/sh #!/bin/sh
. ../../../nvm.sh . ../../../nvm.sh
nvm install 0.10.7 nvm install 0.10.7
nvm install --lts=argon
nvm install --lts
if [ -f ".nvmrc" ]; then if [ -f ".nvmrc" ]; then
mv .nvmrc .nvmrc.bak mv .nvmrc .nvmrc.bak

View File

@@ -1,8 +1,11 @@
#!/bin/sh #!/bin/sh
. ../../../nvm.sh . ../../../nvm.sh
nvm deactivate nvm deactivate
nvm uninstall v0.10.7 nvm uninstall v0.10.7
nvm uninstall --lts=argon
nvm uninstall --lts
rm .nvmrc rm .nvmrc

View File

@@ -0,0 +1,22 @@
#!/bin/sh
set -ex
die () { echo $@ ; exit 1; }
. ../../../nvm.sh
nvm deactivate >/dev/null 2>&1 || die 'deactivate failed'
nvm use --lts || die 'nvm use --lts failed'
OUTPUT="$(nvm current)"
EXPECTED_OUTPUT="$(nvm_resolve_alias 'lts/*')"
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] \
|| die "'nvm use --lts' + 'nvm current' did not output '$EXPECTED_OUTPUT'; got '$OUTPUT'"
OUTPUT="$(nvm use --silent --lts)"
EXPECTED_OUTPUT=""
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] \
|| die "'nvm use --silent --lts' output was not silenced '$EXPECTED_OUTPUT'; got '$OUTPUT'"

View File

@@ -0,0 +1,22 @@
#!/bin/sh
set -ex
die () { echo $@ ; exit 1; }
. ../../../nvm.sh
nvm deactivate 2>&1 >/dev/null || die 'deactivate failed'
nvm use --lts=testing || die 'nvm use --lts=testing failed'
OUTPUT="$(nvm current)"
EXPECTED_OUTPUT="$(nvm_resolve_alias 'lts/testing')"
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] \
|| die "'nvm use --lts=testing' + 'nvm current' did not output '$EXPECTED_OUTPUT'; got '$OUTPUT'"
OUTPUT="$(nvm use --silent --lts=testing)"
EXPECTED_OUTPUT=""
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] \
|| die "'nvm use --silent --lts=testing' output was not silenced '$EXPECTED_OUTPUT'; got '$OUTPUT'"

View File

@@ -2,9 +2,13 @@
. ../../../nvm.sh . ../../../nvm.sh
mkdir -p ../../../.nvm_use_bak mkdir -p "${NVM_DIR}/.nvm_use_bak"
if [ -d "../../../v*" ]; then if [ -d "${NVM_DIR}/v*" ]; then
mv "../../../v*" ../../../.nvm_use_bak/ mv "${NVM_DIR}/v*" "${NVM_DIR}/.nvm_use_bak/"
fi
mkdir -p "${NVM_DIR}/.nvm_use_lts_alias_bak"
if [ -d "${NVM_DIR}/alias/lts" ]; then
mv "${NVM_DIR}/alias/lts/*" "${NVM_DIR}/.nvm_use_lts_alias_bak/"
fi fi
for VERSION in "0.8.7" "0.9.1" "0.10.1" "0.11.1"; do for VERSION in "0.8.7" "0.9.1" "0.10.1" "0.11.1"; do
@@ -14,3 +18,6 @@ done
for VERSION in "1.0.0" "1.0.1"; do for VERSION in "1.0.0" "1.0.1"; do
nvm install "iojs-v$VERSION" nvm install "iojs-v$VERSION"
done done
nvm_make_alias lts/testing 0.10.1
nvm_make_alias 'lts/*' lts/testing

View File

@@ -10,7 +10,13 @@ for VERSION in "1.0.0" "1.0.1"; do
nvm uninstall "iojs-v$VERSION" nvm uninstall "iojs-v$VERSION"
done done
if [ -d ../../../.nvm_use_bak/* ]; then if [ -d "${NVM_DIR}/.nvm_use_bak/*" ]; then
mv ../../../.nvm_use_bak/* ../../../ mv "${NVM_DIR}/.nvm_use_bak/*" "${NVM_DIR}"
rmdir "${NVM_DIR}/.nvm_use_bak"
fi
if [ -d "${NVM_DIR}/.nvm_use_lts_alias_bak" ]; then
rm -rf "${NVM_DIR}/alias/lts/*"
mv "${NVM_DIR}/.nvm_use_lts_alias_bak/*" "${NVM_DIR}/alias/lts/"
rmdir "${NVM_DIR}/.nvm_use_lts_alias_bak"
fi fi
rmdir ../../../.nvm_use_bak

View File

@@ -1,19 +1,42 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -ex
echo 'Updating test mocks...' echo 'Updating test mocks...'
MOCKS_DIR="$PWD/test/fast/Unit tests/mocks" MOCKS_DIR="$PWD/test/fast/Unit tests/mocks"
echo "creating $MOCKS_DIR" echo "creating $MOCKS_DIR"
mkdir -p MOCKS_DIR mkdir -p "$MOCKS_DIR"
. "$NVM_DIR/nvm.sh" . "$NVM_DIR/nvm.sh" --no-use
nvm deactivate 2> /dev/null
nvm_is_version_installed() {
return 1
}
nvm_make_alias() {
# prevent local alias creation
return 0
}
nvm_ls_remote > "$MOCKS_DIR/nvm_ls_remote.txt" nvm_ls_remote > "$MOCKS_DIR/nvm_ls_remote.txt"
nvm_ls_remote_iojs > "$MOCKS_DIR/nvm_ls_remote_iojs.txt" nvm_ls_remote_iojs > "$MOCKS_DIR/nvm_ls_remote_iojs.txt"
NVM_LTS=* nvm_ls_remote > "$MOCKS_DIR/nvm_ls_remote LTS.txt"
NVM_LTS=argon nvm_ls_remote > "$MOCKS_DIR/nvm_ls_remote LTS argon.txt"
nvm_download -L -s "$NVM_NODEJS_ORG_MIRROR/index.tab" -o - > "$MOCKS_DIR/nodejs.org-dist-index.tab" nvm_download -L -s "$NVM_NODEJS_ORG_MIRROR/index.tab" -o - > "$MOCKS_DIR/nodejs.org-dist-index.tab"
nvm_download -L -s "$NVM_IOJS_ORG_MIRROR/index.tab" -o - > "$MOCKS_DIR/iojs.org-dist-index.tab" nvm_download -L -s "$NVM_IOJS_ORG_MIRROR/index.tab" -o - > "$MOCKS_DIR/iojs.org-dist-index.tab"
nvm ls-remote > "$MOCKS_DIR/nvm ls-remote.txt"
nvm ls-remote --lts > "$MOCKS_DIR/nvm ls-remote lts.txt"
nvm ls-remote node > "$MOCKS_DIR/nvm ls-remote node.txt"
nvm ls-remote iojs > "$MOCKS_DIR/nvm ls-remote iojs.txt"
ALIAS_PATH="$MOCKS_DIR/nvm_make_alias LTS alias calls.txt"
: > "$ALIAS_PATH"
nvm_make_alias() {
# prevent local alias creation, and store arguments
echo "${1}|${2}" >> "$ALIAS_PATH"
}
nvm ls-remote --lts
echo "done! Don't forget to git commit them." echo "done! Don't forget to git commit them."