Also fix `nvm uninstall v1.0.3` so it won't uninstall it if it's the current version.
node versions will still take priority if there's ever a version overlap.
As mentioned in #615 it is possible to configure `>` to not override
existing files by default. `tee` is a standard tool that can be used
shell independent.
Add `io.js` support.
This branch adds support for https://github.com/iojs/io.js / https://iojs.org/
The following features should now work:
- `nvm install iojs` will install the latest `io.js` version. `nvm ls iojs` and `nvm use iojs` will function as you'd expect.
- `nvm install node` will install the latest stable `node` version. `nvm ls node` and `nvm use node` will function as you'd expect.
- In general, a specific `io.js` version can be referenced with the "iojs-" prefix. If `node` were to ever release a `v1.0.0`, `v1.0.0` would refer to `node`, and `iojs-v1.0.0` would refer to `io.js`. In the near future, `node-v1.0.0` will also refer to `node` unambiguously. This applies to all `nvm` commands, including working with aliases and `.nvmrc` files.
- `io.js`, unlike `node`, does not have a SunOS binary. Please open an issue on https://github.com/iojs/io.js if this is actually a problem for anyone, as currently it seems like this won't be for anybody.
**Note**: checksum support upon installation is currently disabled. Relates to https://github.com/iojs/io.js/issues/368.
**Note**: installation of `io.js` directly from source (via the `-s` option) is not yet enabled. This will be added soon.
Relates to https://github.com/iojs/io.js/issues/40https://github.com/iojs/io.js/issues/420Fixes#590
The existence of .bashrc, .bash_profile or .zshrc doesn't prove that the file is the currently utilized startup file or that it is the only file sourced. Because the current code operates under this assumption, the code:
```bash
export NVM_DIR="/Users/<USERNAME>/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
```
is getting appended to the wrong profile for zsh users.
1) `[ -d ~/.nvm ] && rm -rfv ~/.nvm `
2) Install Zsh via https://github.com/robbyrussell/oh-my-zsh
3) Run nvm install script with cURL.
4) Run `which nvm`. Observe it's not in `$PATH`
5) Open a new shell session. Observe the issue persists.
To fix this, the code in this PR checks:
- Is `$PROFILE` set? If so, echo it.
- What is the active shell that is executing this script? (the parent shell)
- If the shell is zsh, echo the zshrc file
- If the shell is bash:
- Is it login or non-login? Echo the neccessary file
- Is it interactive or non interactive? Echo the neccessary
file.
This logic should address the primary bug and also prevent future bugs.
Note: bash by default reads ~/.profile last so it makes sense to write to ~/.bashrc or ~/.bash_profile instead of ~/.profile
See: https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html
Passed Manual Tests:
✅ zsh
✅ bash from within script
✅ bash as default shell
✅ bash -l from within zsh