mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-05-12 07:01:50 +00:00
CR/LF fixed, maybe?
This commit is contained in:
parent
2441b00262
commit
3cd0568336
28
.gitignore
vendored
28
.gitignore
vendored
@ -1,14 +1,14 @@
|
|||||||
HEAD
|
HEAD
|
||||||
src
|
src
|
||||||
v*
|
v*
|
||||||
alias
|
alias
|
||||||
|
|
||||||
# For testing
|
# For testing
|
||||||
test/bak
|
test/bak
|
||||||
.urchin.log
|
.urchin.log
|
||||||
.urchin_stdout
|
.urchin_stdout
|
||||||
|
|
||||||
node_modules/
|
node_modules/
|
||||||
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
src
|
src
|
||||||
v*
|
v*
|
||||||
alias
|
alias
|
||||||
|
|
||||||
|
28
.travis.yml
28
.travis.yml
@ -1,14 +1,14 @@
|
|||||||
language: c # defaults to ruby
|
language: c # defaults to ruby
|
||||||
install:
|
install:
|
||||||
- sudo apt-get install ksh zsh -y
|
- sudo apt-get install ksh zsh -y
|
||||||
before_script:
|
before_script:
|
||||||
- curl -o /tmp/urchin https://raw.githubusercontent.com/scraperwiki/urchin/master/urchin && chmod +x /tmp/urchin
|
- curl -o /tmp/urchin https://raw.githubusercontent.com/scraperwiki/urchin/master/urchin && chmod +x /tmp/urchin
|
||||||
script:
|
script:
|
||||||
- NVM_DIR=$TRAVIS_BUILD_DIR make TEST_SUITE=$TEST_SUITE URCHIN=/tmp/urchin $SHELL
|
- NVM_DIR=$TRAVIS_BUILD_DIR make TEST_SUITE=$TEST_SUITE URCHIN=/tmp/urchin $SHELL
|
||||||
env:
|
env:
|
||||||
- SHELL=sh TEST_SUITE=fast
|
- SHELL=sh TEST_SUITE=fast
|
||||||
- SHELL=dash TEST_SUITE=fast
|
- SHELL=dash TEST_SUITE=fast
|
||||||
- SHELL=bash TEST_SUITE=fast
|
- SHELL=bash TEST_SUITE=fast
|
||||||
- SHELL=zsh TEST_SUITE=fast
|
- SHELL=zsh TEST_SUITE=fast
|
||||||
- SHELL=ksh TEST_SUITE=fast
|
- SHELL=ksh TEST_SUITE=fast
|
||||||
- SHELL=sh TEST_SUITE=slow
|
- SHELL=sh TEST_SUITE=slow
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
Thanks for contributing to `nvm`!
|
Thanks for contributing to `nvm`!
|
||||||
|
|
||||||
We love pull requests, they're our favorite.
|
We love pull requests, they're our favorite.
|
||||||
|
|
||||||
However, before submitting, please review the following:
|
However, before submitting, please review the following:
|
||||||
|
|
||||||
- Please include tests. Changes with tests will be merged very quickly.
|
- Please include tests. Changes with tests will be merged very quickly.
|
||||||
- Please manually confirm that your changes, and all tests, pass in `bash`, `sh`, and `zsh`. We hope to soon automatically run all these tests, but in the meantime, we have to rely on each contributor doing so.
|
- Please manually confirm that your changes, and all tests, pass in `bash`, `sh`, and `zsh`. We hope to soon automatically run all these tests, but in the meantime, we have to rely on each contributor doing so.
|
||||||
- Please maintain consistent whitespace - 2-space indentation, trailing newlines in all files, etc.
|
- Please maintain consistent whitespace - 2-space indentation, trailing newlines in all files, etc.
|
||||||
- Any time you make a change to your PR, please rebase freshly on top of master. Nobody likes merge commits.
|
- Any time you make a change to your PR, please rebase freshly on top of master. Nobody likes merge commits.
|
||||||
|
|
||||||
Even if you don't have all of these items covered, please still feel free to submit a PR! Someone else may be inspired and volunteer to complete it for you.
|
Even if you don't have all of these items covered, please still feel free to submit a PR! Someone else may be inspired and volunteer to complete it for you.
|
||||||
|
|
||||||
Thanks again!
|
Thanks again!
|
||||||
|
|
||||||
|
42
LICENSE.md
42
LICENSE.md
@ -1,21 +1,21 @@
|
|||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2010-2014 Tim Caswell
|
Copyright (c) 2010-2014 Tim Caswell
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
the Software without restriction, including without limitation the rights to
|
the Software without restriction, including without limitation the rights to
|
||||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
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,
|
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
subject to the following conditions:
|
subject to the following conditions:
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
The above copyright notice and this permission notice shall be included in all
|
||||||
copies or substantial portions of the Software.
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
30
Makefile
30
Makefile
@ -1,15 +1,15 @@
|
|||||||
URCHIN=`which urchin`
|
URCHIN=`which urchin`
|
||||||
SHELLS=sh bash dash ksh zsh
|
SHELLS=sh bash dash ksh zsh
|
||||||
TEST_SUITE=fast
|
TEST_SUITE=fast
|
||||||
|
|
||||||
.PHONY: $(SHELLS) test
|
.PHONY: $(SHELLS) test
|
||||||
|
|
||||||
$(SHELLS):
|
$(SHELLS):
|
||||||
@printf '\n\033[0;34m%s\033[0m\n' "Running tests in $@"
|
@printf '\n\033[0;34m%s\033[0m\n' "Running tests in $@"
|
||||||
@$@ $(URCHIN) -f test/$(TEST_SUITE)
|
@$@ $(URCHIN) -f test/$(TEST_SUITE)
|
||||||
|
|
||||||
test: $(SHELLS)
|
test: $(SHELLS)
|
||||||
@$(URCHIN) -f test/slow
|
@$(URCHIN) -f test/slow
|
||||||
|
|
||||||
default: test
|
default: test
|
||||||
|
|
||||||
|
338
README.markdown
338
README.markdown
@ -1,169 +1,169 @@
|
|||||||
# Node Version Manager [][3]
|
# Node Version Manager [][3]
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
First you'll need to make sure your system has a c++ compiler. For OSX, XCode will work, for Ubuntu, the build-essential and libssl-dev packages work.
|
First you'll need to make sure your system has a c++ compiler. For OSX, XCode will work, for Ubuntu, the build-essential and libssl-dev packages work.
|
||||||
|
|
||||||
### Install script
|
### Install script
|
||||||
|
|
||||||
To install you could use the [install script][2] using cURL:
|
To install you could use the [install script][2] using cURL:
|
||||||
|
|
||||||
curl https://raw.githubusercontent.com/creationix/nvm/v0.7.0/install.sh | sh
|
curl https://raw.githubusercontent.com/creationix/nvm/v0.7.0/install.sh | sh
|
||||||
|
|
||||||
or Wget:
|
or Wget:
|
||||||
|
|
||||||
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.7.0/install.sh | sh
|
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.7.0/install.sh | sh
|
||||||
|
|
||||||
<sub>The script clones the nvm repository to `~/.nvm` and adds the source line to your profile (`~/.bash_profile`, `~/.zshrc` or `~/.profile`).</sub>
|
<sub>The script clones the nvm repository to `~/.nvm` and adds the source line to your profile (`~/.bash_profile`, `~/.zshrc` or `~/.profile`).</sub>
|
||||||
|
|
||||||
You can customize the install source, directory and profile using the `NVM_SOURCE`, `NVM_DIR` and `NVM_PROFILE` variables. Eg: `curl ... | NVM_DIR=/usr/local/nvm sh` for a global install.
|
You can customize the install source, directory and profile using the `NVM_SOURCE`, `NVM_DIR` and `NVM_PROFILE` variables. Eg: `curl ... | NVM_DIR=/usr/local/nvm sh` 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>
|
||||||
|
|
||||||
### Manual install
|
### Manual install
|
||||||
|
|
||||||
For manual install create a folder somewhere in your filesystem with the `nvm.sh` file inside it. I put mine in a folder called `nvm`.
|
For manual install create a folder somewhere in your filesystem with the `nvm.sh` file inside it. I put mine in a folder called `nvm`.
|
||||||
|
|
||||||
Or if you have `git` installed, then just clone it:
|
Or if you have `git` installed, then just clone it:
|
||||||
|
|
||||||
git clone https://github.com/creationix/nvm.git ~/.nvm
|
git clone https://github.com/creationix/nvm.git ~/.nvm
|
||||||
|
|
||||||
To activate nvm, you need to source it from your shell:
|
To activate nvm, you need to source it from your shell:
|
||||||
|
|
||||||
source ~/.nvm/nvm.sh
|
source ~/.nvm/nvm.sh
|
||||||
|
|
||||||
I always add this line to my `~/.bashrc`, `~/.profile`, or `~/.zshrc` file to have it automatically sourced upon login.
|
I always add this line to my `~/.bashrc`, `~/.profile`, or `~/.zshrc` file to have it automatically sourced upon login.
|
||||||
Often I also put in a line to use a specific version of node.
|
Often I also put in a line to use a specific version of node.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
You can create an `.nvmrc` file containing version number in the project root directory (or any parent directory).
|
You can create an `.nvmrc` file containing version number in the project root directory (or any parent directory).
|
||||||
`nvm use`, `nvm install`, and `nvm run` will all respect an `.nvmrc` file.
|
`nvm use`, `nvm install`, and `nvm run` will all respect an `.nvmrc` file.
|
||||||
|
|
||||||
To download, compile, and install the latest v0.10.x release of node, do this:
|
To download, compile, and install the latest v0.10.x release of node, do this:
|
||||||
|
|
||||||
nvm install 0.10
|
nvm install 0.10
|
||||||
|
|
||||||
And then in any new shell just use the installed version:
|
And then in any new shell just use the installed version:
|
||||||
|
|
||||||
nvm use 0.10
|
nvm use 0.10
|
||||||
|
|
||||||
Or you can just run it:
|
Or you can just run it:
|
||||||
|
|
||||||
nvm run 0.10 --version
|
nvm run 0.10 --version
|
||||||
|
|
||||||
If you want to see what versions are installed:
|
If you want to see what versions are installed:
|
||||||
|
|
||||||
nvm ls
|
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
|
nvm ls-remote
|
||||||
|
|
||||||
To restore your PATH, you can deactivate it.
|
To restore your PATH, you can deactivate it.
|
||||||
|
|
||||||
nvm deactivate
|
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 0.10
|
nvm alias default 0.10
|
||||||
|
|
||||||
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=http://nodejs.org/dist
|
export NVM_NODEJS_ORG_MIRROR=http://nodejs.org/dist
|
||||||
nvm install 0.10
|
nvm install 0.10
|
||||||
|
|
||||||
NVM_NODEJS_ORG_MIRROR=http://nodejs.org/dist nvm install 0.10
|
NVM_NODEJS_ORG_MIRROR=http://nodejs.org/dist nvm install 0.10
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
nvm is released under the MIT license.
|
nvm is released under the MIT license.
|
||||||
|
|
||||||
|
|
||||||
Copyright (C) 2010-2014 Tim Caswell
|
Copyright (C) 2010-2014 Tim Caswell
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in 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:
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
## Running tests
|
## Running tests
|
||||||
Tests are written in [Urchin]. Install Urchin (and other dependencies) like so:
|
Tests are written in [Urchin]. Install Urchin (and other dependencies) like so:
|
||||||
|
|
||||||
npm install
|
npm install
|
||||||
|
|
||||||
There are slow tests and fast tests. The slow tests do things like install node
|
There are slow tests and fast tests. The slow tests do things like install node
|
||||||
and check that the right versions are used. The fast tests fake this to test
|
and check that the right versions are used. The fast tests fake this to test
|
||||||
things like aliases and uninstalling. From the root of the nvm git repository,
|
things like aliases and uninstalling. From the root of the nvm git repository,
|
||||||
run the fast tests like this.
|
run the fast tests like this.
|
||||||
|
|
||||||
npm run test/fast
|
npm run test/fast
|
||||||
|
|
||||||
Run the slow tests like this.
|
Run the slow tests like this.
|
||||||
|
|
||||||
npm run test/slow
|
npm run test/slow
|
||||||
|
|
||||||
Run all of the tests like this
|
Run all of the tests like this
|
||||||
|
|
||||||
npm test
|
npm test
|
||||||
|
|
||||||
Nota bene: Avoid running nvm while the tests are running.
|
Nota bene: Avoid running nvm while the tests are running.
|
||||||
|
|
||||||
## Bash completion
|
## Bash completion
|
||||||
|
|
||||||
To activate, you need to source `bash_completion`:
|
To activate, you need to source `bash_completion`:
|
||||||
|
|
||||||
[[ -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`).
|
||||||
|
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
nvm
|
nvm
|
||||||
|
|
||||||
$ nvm [tab][tab]
|
$ nvm [tab][tab]
|
||||||
alias copy-packages help list run uninstall version
|
alias copy-packages help list run uninstall version
|
||||||
clear-cache deactivate install ls unalias use
|
clear-cache deactivate install ls unalias use
|
||||||
|
|
||||||
nvm alias
|
nvm alias
|
||||||
|
|
||||||
$ nvm alias [tab][tab]
|
$ nvm alias [tab][tab]
|
||||||
default
|
default
|
||||||
|
|
||||||
$ nvm alias my_alias [tab][tab]
|
$ nvm alias my_alias [tab][tab]
|
||||||
v0.6.21 v0.8.26 v0.10.28
|
v0.6.21 v0.8.26 v0.10.28
|
||||||
|
|
||||||
nvm use
|
nvm use
|
||||||
|
|
||||||
$ nvm use [tab][tab]
|
$ nvm use [tab][tab]
|
||||||
my_alias default v0.6.21 v0.8.26 v0.10.28
|
my_alias default v0.6.21 v0.8.26 v0.10.28
|
||||||
|
|
||||||
nvm uninstall
|
nvm uninstall
|
||||||
|
|
||||||
$ nvm uninstall [tab][tab]
|
$ nvm uninstall [tab][tab]
|
||||||
my_alias default v0.6.21 v0.8.26 v0.10.28
|
my_alias default v0.6.21 v0.8.26 v0.10.28
|
||||||
|
|
||||||
## Problems
|
## Problems
|
||||||
|
|
||||||
If you try to install a node version and the installation fails, be sure to delete the node downloads from src (~/.nvm/src/) or you might get an error when trying to reinstall them again or you might get an error like the following:
|
If you try to install a node version and the installation fails, be sure to delete the node downloads from src (~/.nvm/src/) or you might get an error when trying to reinstall them again or you might get an error like the following:
|
||||||
|
|
||||||
curl: (33) HTTP server doesn't seem to support byte ranges. Cannot resume.
|
curl: (33) HTTP server doesn't seem to support byte ranges. Cannot resume.
|
||||||
|
|
||||||
Where's my 'sudo node'? Checkout this link:
|
Where's my 'sudo node'? Checkout this link:
|
||||||
|
|
||||||
https://github.com/creationix/nvm/issues/43
|
https://github.com/creationix/nvm/issues/43
|
||||||
|
|
||||||
on Arch Linux and other systems using python3 by default, before running *install* you need to
|
on Arch Linux and other systems using python3 by default, before running *install* you need to
|
||||||
|
|
||||||
export PYTHON=python2
|
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:
|
||||||
|
|
||||||
nvm install -s 0.8.6
|
nvm install -s 0.8.6
|
||||||
|
|
||||||
[1]: https://github.com/creationix/nvm.git
|
[1]: https://github.com/creationix/nvm.git
|
||||||
[2]: https://github.com/creationix/nvm/blob/v0.7.0/install.sh
|
[2]: https://github.com/creationix/nvm/blob/v0.7.0/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
|
||||||
|
|
||||||
|
180
bash_completion
180
bash_completion
@ -1,90 +1,90 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# bash completion for Node Version Manager (NVM)
|
# bash completion for Node Version Manager (NVM)
|
||||||
|
|
||||||
__nvm_generate_completion()
|
__nvm_generate_completion()
|
||||||
{
|
{
|
||||||
declare current_word
|
declare current_word
|
||||||
current_word="${COMP_WORDS[COMP_CWORD]}"
|
current_word="${COMP_WORDS[COMP_CWORD]}"
|
||||||
COMPREPLY=($(compgen -W "$1" -- "$current_word"))
|
COMPREPLY=($(compgen -W "$1" -- "$current_word"))
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
__nvm_commands ()
|
__nvm_commands ()
|
||||||
{
|
{
|
||||||
declare current_word
|
declare current_word
|
||||||
declare command
|
declare command
|
||||||
|
|
||||||
current_word="${COMP_WORDS[COMP_CWORD]}"
|
current_word="${COMP_WORDS[COMP_CWORD]}"
|
||||||
|
|
||||||
COMMANDS='\
|
COMMANDS='\
|
||||||
help install uninstall use run\
|
help install uninstall use run\
|
||||||
ls ls-remote list list-remote deactivate\
|
ls ls-remote list list-remote deactivate\
|
||||||
alias unalias copy-packages clear-cache version'
|
alias unalias copy-packages clear-cache version'
|
||||||
|
|
||||||
if [ ${#COMP_WORDS[@]} == 4 ]; then
|
if [ ${#COMP_WORDS[@]} == 4 ]; then
|
||||||
|
|
||||||
command="${COMP_WORDS[COMP_CWORD-2]}"
|
command="${COMP_WORDS[COMP_CWORD-2]}"
|
||||||
case "${command}" in
|
case "${command}" in
|
||||||
alias) __nvm_installed_nodes ;;
|
alias) __nvm_installed_nodes ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
case "${current_word}" in
|
case "${current_word}" in
|
||||||
-*) __nvm_options ;;
|
-*) __nvm_options ;;
|
||||||
*) __nvm_generate_completion "$COMMANDS" ;;
|
*) __nvm_generate_completion "$COMMANDS" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
__nvm_options ()
|
__nvm_options ()
|
||||||
{
|
{
|
||||||
OPTIONS=''
|
OPTIONS=''
|
||||||
__nvm_generate_completion "$OPTIONS"
|
__nvm_generate_completion "$OPTIONS"
|
||||||
}
|
}
|
||||||
|
|
||||||
__nvm_installed_nodes ()
|
__nvm_installed_nodes ()
|
||||||
{
|
{
|
||||||
__nvm_generate_completion "$(nvm_ls) $(__nvm_aliases)"
|
__nvm_generate_completion "$(nvm_ls) $(__nvm_aliases)"
|
||||||
}
|
}
|
||||||
|
|
||||||
__nvm_aliases ()
|
__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 && ls`"
|
aliases="`cd $NVM_DIR/alias && ls`"
|
||||||
fi
|
fi
|
||||||
echo "${aliases}"
|
echo "${aliases}"
|
||||||
}
|
}
|
||||||
|
|
||||||
__nvm_alias ()
|
__nvm_alias ()
|
||||||
{
|
{
|
||||||
__nvm_generate_completion "$(__nvm_aliases)"
|
__nvm_generate_completion "$(__nvm_aliases)"
|
||||||
}
|
}
|
||||||
|
|
||||||
__nvm ()
|
__nvm ()
|
||||||
{
|
{
|
||||||
declare previous_word
|
declare previous_word
|
||||||
previous_word="${COMP_WORDS[COMP_CWORD-1]}"
|
previous_word="${COMP_WORDS[COMP_CWORD-1]}"
|
||||||
|
|
||||||
case "$previous_word" in
|
case "$previous_word" in
|
||||||
use|run|ls|list|uninstall) __nvm_installed_nodes ;;
|
use|run|ls|list|uninstall) __nvm_installed_nodes ;;
|
||||||
alias|unalias) __nvm_alias ;;
|
alias|unalias) __nvm_alias ;;
|
||||||
*) __nvm_commands ;;
|
*) __nvm_commands ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
# complete is a bash builtin, but recent versions of ZSH come with a function
|
# complete is a bash builtin, but recent versions of ZSH come with a function
|
||||||
# called bashcompinit that will create a complete in ZSH. If the user is in
|
# called bashcompinit that will create a complete in ZSH. If the user is in
|
||||||
# ZSH, load and run bashcompinit before calling the complete function.
|
# ZSH, load and run bashcompinit before calling the complete function.
|
||||||
if [[ -n ${ZSH_VERSION-} ]]; then
|
if [[ -n ${ZSH_VERSION-} ]]; then
|
||||||
autoload -U +X bashcompinit && bashcompinit
|
autoload -U +X bashcompinit && bashcompinit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
complete -o default -o nospace -F __nvm nvm
|
complete -o default -o nospace -F __nvm nvm
|
||||||
|
|
||||||
|
260
install.sh
260
install.sh
@ -1,130 +1,130 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
has() {
|
has() {
|
||||||
type "$1" > /dev/null 2>&1
|
type "$1" > /dev/null 2>&1
|
||||||
return $?
|
return $?
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$NVM_DIR" ]; then
|
if [ -z "$NVM_DIR" ]; then
|
||||||
NVM_DIR="$HOME/.nvm"
|
NVM_DIR="$HOME/.nvm"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! has "curl"; then
|
if ! has "curl"; then
|
||||||
if has "wget"; then
|
if has "wget"; then
|
||||||
# Emulate curl with wget
|
# Emulate curl with wget
|
||||||
curl() {
|
curl() {
|
||||||
ARGS="$* "
|
ARGS="$* "
|
||||||
ARGS=${ARGS/-s /-q }
|
ARGS=${ARGS/-s /-q }
|
||||||
ARGS=${ARGS/-o /-O }
|
ARGS=${ARGS/-o /-O }
|
||||||
wget $ARGS
|
wget $ARGS
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
install_from_git() {
|
install_from_git() {
|
||||||
if [ -z "$NVM_SOURCE" ]; then
|
if [ -z "$NVM_SOURCE" ]; then
|
||||||
NVM_SOURCE="https://github.com/creationix/nvm.git"
|
NVM_SOURCE="https://github.com/creationix/nvm.git"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d "$NVM_DIR/.git" ]; then
|
if [ -d "$NVM_DIR/.git" ]; then
|
||||||
echo "=> nvm is already installed in $NVM_DIR, trying to update"
|
echo "=> nvm is already installed in $NVM_DIR, trying to update"
|
||||||
echo -e "\r=> \c"
|
echo -e "\r=> \c"
|
||||||
cd "$NVM_DIR" && git pull 2> /dev/null || {
|
cd "$NVM_DIR" && git pull 2> /dev/null || {
|
||||||
echo >&2 "Failed to update nvm, run 'git pull' in $NVM_DIR yourself.."
|
echo >&2 "Failed to update nvm, run 'git pull' in $NVM_DIR yourself.."
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
# Cloning to $NVM_DIR
|
# Cloning to $NVM_DIR
|
||||||
echo "=> Downloading nvm from git to '$NVM_DIR'"
|
echo "=> Downloading nvm from git to '$NVM_DIR'"
|
||||||
echo -e "\r=> \c"
|
echo -e "\r=> \c"
|
||||||
mkdir -p "$NVM_DIR"
|
mkdir -p "$NVM_DIR"
|
||||||
git clone "$NVM_SOURCE" "$NVM_DIR"
|
git clone "$NVM_SOURCE" "$NVM_DIR"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
install_as_script() {
|
install_as_script() {
|
||||||
if [ -z "$NVM_SOURCE" ]; then
|
if [ -z "$NVM_SOURCE" ]; then
|
||||||
NVM_SOURCE="https://raw.githubusercontent.com/creationix/nvm/master/nvm.sh"
|
NVM_SOURCE="https://raw.githubusercontent.com/creationix/nvm/master/nvm.sh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Downloading to $NVM_DIR
|
# Downloading to $NVM_DIR
|
||||||
mkdir -p "$NVM_DIR"
|
mkdir -p "$NVM_DIR"
|
||||||
if [ -d "$NVM_DIR/nvm.sh" ]; then
|
if [ -d "$NVM_DIR/nvm.sh" ]; then
|
||||||
echo "=> nvm is already installed in $NVM_DIR, trying to update"
|
echo "=> nvm is already installed in $NVM_DIR, trying to update"
|
||||||
else
|
else
|
||||||
echo "=> Downloading nvm as script to '$NVM_DIR'"
|
echo "=> Downloading nvm as script to '$NVM_DIR'"
|
||||||
fi
|
fi
|
||||||
curl -s "$NVM_SOURCE" -o "$NVM_DIR/nvm.sh" || {
|
curl -s "$NVM_SOURCE" -o "$NVM_DIR/nvm.sh" || {
|
||||||
echo >&2 "Failed to download '$NVM_SOURCE'.."
|
echo >&2 "Failed to download '$NVM_SOURCE'.."
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$METHOD" ]; then
|
if [ -z "$METHOD" ]; then
|
||||||
# Autodetect install method
|
# Autodetect install method
|
||||||
if has "git"; then
|
if has "git"; then
|
||||||
install_from_git
|
install_from_git
|
||||||
elif has "curl"; then
|
elif has "curl"; then
|
||||||
install_as_script
|
install_as_script
|
||||||
else
|
else
|
||||||
echo >&2 "You need git, curl or wget to install nvm"
|
echo >&2 "You need git, curl or wget to install nvm"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ "$METHOD" = "git" ]; then
|
if [ "$METHOD" = "git" ]; then
|
||||||
if ! has "git"; then
|
if ! has "git"; then
|
||||||
echo >&2 "You need git to install nvm"
|
echo >&2 "You need git to install nvm"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
install_from_git
|
install_from_git
|
||||||
fi
|
fi
|
||||||
if [ "$METHOD" = "script" ]; then
|
if [ "$METHOD" = "script" ]; then
|
||||||
if ! has "curl"; then
|
if ! has "curl"; then
|
||||||
echo >&2 "You need curl or wget to install nvm"
|
echo >&2 "You need curl or wget to install nvm"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
install_as_script
|
install_as_script
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
|
|
||||||
# Detect profile file if not specified as environment variable (eg: PROFILE=~/.myprofile).
|
# Detect profile file if not specified as environment variable (eg: PROFILE=~/.myprofile).
|
||||||
if [ -z "$PROFILE" ]; then
|
if [ -z "$PROFILE" ]; then
|
||||||
if [ -f "$HOME/.bash_profile" ]; then
|
if [ -f "$HOME/.bash_profile" ]; then
|
||||||
PROFILE="$HOME/.bash_profile"
|
PROFILE="$HOME/.bash_profile"
|
||||||
elif [ -f "$HOME/.zshrc" ]; then
|
elif [ -f "$HOME/.zshrc" ]; then
|
||||||
PROFILE="$HOME/.zshrc"
|
PROFILE="$HOME/.zshrc"
|
||||||
elif [ -f "$HOME/.profile" ]; then
|
elif [ -f "$HOME/.profile" ]; then
|
||||||
PROFILE="$HOME/.profile"
|
PROFILE="$HOME/.profile"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
SOURCE_STR="[ -s \"$NVM_DIR/nvm.sh\" ] && . \"$NVM_DIR/nvm.sh\" # This loads nvm"
|
SOURCE_STR="[ -s \"$NVM_DIR/nvm.sh\" ] && . \"$NVM_DIR/nvm.sh\" # This loads nvm"
|
||||||
|
|
||||||
if [ -z "$PROFILE" ] || [ ! -f "$PROFILE" ] ; then
|
if [ -z "$PROFILE" ] || [ ! -f "$PROFILE" ] ; then
|
||||||
if [ -z $PROFILE ]; then
|
if [ -z $PROFILE ]; then
|
||||||
echo "=> Profile not found. Tried ~/.bash_profile ~/.zshrc and ~/.profile."
|
echo "=> Profile not found. Tried ~/.bash_profile ~/.zshrc and ~/.profile."
|
||||||
echo "=> Create one of them and run this script again"
|
echo "=> Create one of them and run this script again"
|
||||||
else
|
else
|
||||||
echo "=> Profile $PROFILE not found"
|
echo "=> Profile $PROFILE not found"
|
||||||
echo "=> Create it (touch $PROFILE) and run this script again"
|
echo "=> Create it (touch $PROFILE) and run this script again"
|
||||||
fi
|
fi
|
||||||
echo " OR"
|
echo " OR"
|
||||||
echo "=> Append the following line to the correct file yourself:"
|
echo "=> Append the following line to the correct file yourself:"
|
||||||
echo
|
echo
|
||||||
echo " $SOURCE_STR"
|
echo " $SOURCE_STR"
|
||||||
echo
|
echo
|
||||||
else
|
else
|
||||||
if ! grep -qc 'nvm.sh' $PROFILE; then
|
if ! grep -qc 'nvm.sh' $PROFILE; then
|
||||||
echo "=> Appending source string to $PROFILE"
|
echo "=> Appending source string to $PROFILE"
|
||||||
echo "" >> "$PROFILE"
|
echo "" >> "$PROFILE"
|
||||||
echo $SOURCE_STR >> "$PROFILE"
|
echo $SOURCE_STR >> "$PROFILE"
|
||||||
else
|
else
|
||||||
echo "=> Source string already in $PROFILE"
|
echo "=> Source string already in $PROFILE"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "=> Close and reopen your terminal to start using nvm"
|
echo "=> Close and reopen your terminal to start using nvm"
|
||||||
|
|
||||||
|
28
nvm-exec
28
nvm-exec
@ -1,14 +1,14 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
DIR="$(command cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
DIR="$(command cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
source "$DIR/nvm.sh"
|
source "$DIR/nvm.sh"
|
||||||
|
|
||||||
if [ -n "$NODE_VERSION" ]; then
|
if [ -n "$NODE_VERSION" ]; then
|
||||||
nvm use $NODE_VERSION || (echo "NODE_VERSION not set" && exit 127)
|
nvm use $NODE_VERSION || (echo "NODE_VERSION not set" && exit 127)
|
||||||
else
|
else
|
||||||
nvm use || (echo "No .nvmrc file found" && exit 127)
|
nvm use || (echo "No .nvmrc file found" && exit 127)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec $@
|
exec $@
|
||||||
|
|
||||||
|
637
nvm.sh
637
nvm.sh
@ -1,637 +0,0 @@
|
|||||||
# Node Version Manager
|
|
||||||
# Implemented as a bash function
|
|
||||||
# To use source this file from your bash profile
|
|
||||||
#
|
|
||||||
# Implemented by Tim Caswell <tim@creationix.com>
|
|
||||||
# with much bash help from Matthew Ranney
|
|
||||||
|
|
||||||
NVM_SCRIPT_SOURCE="$_"
|
|
||||||
|
|
||||||
nvm_has() {
|
|
||||||
type "$1" > /dev/null 2>&1
|
|
||||||
return $?
|
|
||||||
}
|
|
||||||
|
|
||||||
# Make zsh glob matching behave same as bash
|
|
||||||
# This fixes the "zsh: no matches found" errors
|
|
||||||
if nvm_has "unsetopt"; then
|
|
||||||
unsetopt nomatch 2>/dev/null
|
|
||||||
NVM_CD_FLAGS="-q"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Auto detect the NVM_DIR when not set
|
|
||||||
if [ -z "$NVM_DIR" ]; then
|
|
||||||
if [ -n "$BASH_SOURCE" ]; then
|
|
||||||
NVM_SCRIPT_SOURCE="${BASH_SOURCE[0]}"
|
|
||||||
fi
|
|
||||||
export NVM_DIR=$(cd $NVM_CD_FLAGS $(dirname "${NVM_SCRIPT_SOURCE:-$0}") > /dev/null && pwd)
|
|
||||||
fi
|
|
||||||
unset NVM_SCRIPT_SOURCE 2> /dev/null
|
|
||||||
|
|
||||||
|
|
||||||
# Setup mirror location if not already set
|
|
||||||
if [ -z "$NVM_NODEJS_ORG_MIRROR" ]; then
|
|
||||||
export NVM_NODEJS_ORG_MIRROR="http://nodejs.org/dist"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Traverse up in directory tree to find containing folder
|
|
||||||
nvm_find_up() {
|
|
||||||
local path
|
|
||||||
path=$PWD
|
|
||||||
while [ "$path" != "" ] && [ ! -f "$path/$1" ]; do
|
|
||||||
path=${path%/*}
|
|
||||||
done
|
|
||||||
echo "$path"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
nvm_find_nvmrc() {
|
|
||||||
local dir="$(nvm_find_up '.nvmrc')"
|
|
||||||
if [ -e "$dir/.nvmrc" ]; then
|
|
||||||
echo "$dir/.nvmrc"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Obtain nvm version from rc file
|
|
||||||
nvm_rc_version() {
|
|
||||||
local NVMRC_PATH="$(nvm_find_nvmrc)"
|
|
||||||
if [ -e "$NVMRC_PATH" ]; then
|
|
||||||
NVM_RC_VERSION=`cat "$NVMRC_PATH" | head -n 1`
|
|
||||||
echo "Found '$NVMRC_PATH' with version <$NVM_RC_VERSION>"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Expand a version using the version cache
|
|
||||||
nvm_version() {
|
|
||||||
local PATTERN=$1
|
|
||||||
local VERSION
|
|
||||||
# The default version is the current one
|
|
||||||
if [ -z "$PATTERN" ]; then
|
|
||||||
PATTERN='current'
|
|
||||||
fi
|
|
||||||
|
|
||||||
VERSION=`nvm_ls $PATTERN | tail -n1`
|
|
||||||
echo "$VERSION"
|
|
||||||
|
|
||||||
if [ "$VERSION" = 'N/A' ]; then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
nvm_remote_version() {
|
|
||||||
local PATTERN=$1
|
|
||||||
local VERSION
|
|
||||||
VERSION=`nvm_ls_remote $PATTERN | tail -n1`
|
|
||||||
echo "$VERSION"
|
|
||||||
|
|
||||||
if [ "$VERSION" = 'N/A' ]; then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
nvm_normalize_version() {
|
|
||||||
echo "$1" | sed -e 's/^v//' | awk -F. '{ printf("%d%03d%03d\n", $1,$2,$3); }'
|
|
||||||
}
|
|
||||||
|
|
||||||
nvm_format_version() {
|
|
||||||
echo "$1" | sed -e 's/^\([0-9]\)/v\1/g'
|
|
||||||
}
|
|
||||||
|
|
||||||
nvm_strip_path() {
|
|
||||||
echo "$1" | sed -e "s#$NVM_DIR/[^/]*$2[^:]*:##g" -e "s#:$NVM_DIR/[^/]*$2[^:]*##g" -e "s#$NVM_DIR/[^/]*$2[^:]*##g"
|
|
||||||
}
|
|
||||||
|
|
||||||
nvm_prepend_path() {
|
|
||||||
if [ -z "$1" ]; then
|
|
||||||
echo "$2"
|
|
||||||
else
|
|
||||||
echo "$2:$1"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
nvm_binary_available() {
|
|
||||||
# binaries started with node 0.8.6
|
|
||||||
local MINIMAL="0.8.6"
|
|
||||||
local VERSION=$1
|
|
||||||
[ $(nvm_normalize_version $VERSION) -ge $(nvm_normalize_version $MINIMAL) ]
|
|
||||||
}
|
|
||||||
|
|
||||||
nvm_ls() {
|
|
||||||
local PATTERN=$1
|
|
||||||
local VERSIONS=''
|
|
||||||
if [ "$PATTERN" = 'current' ]; then
|
|
||||||
echo `node -v 2>/dev/null`
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f "$NVM_DIR/alias/$PATTERN" ]; then
|
|
||||||
nvm_version `cat $NVM_DIR/alias/$PATTERN`
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
# If it looks like an explicit version, don't do anything funny
|
|
||||||
if [ `expr "$PATTERN" : "v[[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*$"` != 0 ]; then
|
|
||||||
VERSIONS="$PATTERN"
|
|
||||||
else
|
|
||||||
VERSIONS=`find "$NVM_DIR/" -maxdepth 1 -type d -name "$(nvm_format_version $PATTERN)*" -exec basename '{}' ';' \
|
|
||||||
| sort -t. -u -k 1.2,1n -k 2,2n -k 3,3n`
|
|
||||||
fi
|
|
||||||
if [ -z "$VERSIONS" ]; then
|
|
||||||
echo "N/A"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
echo "$VERSIONS"
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
nvm_ls_remote() {
|
|
||||||
local PATTERN=$1
|
|
||||||
local VERSIONS
|
|
||||||
local GREP_OPTIONS=''
|
|
||||||
if [ -n "$PATTERN" ]; then
|
|
||||||
PATTERN=`nvm_format_version "$PATTERN"`
|
|
||||||
else
|
|
||||||
PATTERN=".*"
|
|
||||||
fi
|
|
||||||
VERSIONS=`curl -s $NVM_NODEJS_ORG_MIRROR/ \
|
|
||||||
| \egrep -o 'v[0-9]+\.[0-9]+\.[0-9]+' \
|
|
||||||
| \grep -w "${PATTERN}" \
|
|
||||||
| sort -t. -u -k 1.2,1n -k 2,2n -k 3,3n`
|
|
||||||
if [ -z "$VERSIONS" ]; then
|
|
||||||
echo "N/A"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
echo "$VERSIONS"
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
nvm_checksum() {
|
|
||||||
if nvm_has "shasum"; then
|
|
||||||
checksum=$(shasum $1 | awk '{print $1}')
|
|
||||||
elif nvm_has "sha1"; then
|
|
||||||
checksum=$(sha1 -q $1)
|
|
||||||
else
|
|
||||||
checksum=$(sha1sum $1 | awk '{print $1}')
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$checksum" = "$2" ]; then
|
|
||||||
return
|
|
||||||
elif [ -z "$2" ]; then
|
|
||||||
echo 'Checksums empty' #missing in raspberry pi binary
|
|
||||||
return
|
|
||||||
else
|
|
||||||
echo 'Checksums do not match.'
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
nvm_print_versions() {
|
|
||||||
local VERSION
|
|
||||||
local FORMAT
|
|
||||||
local CURRENT=`nvm_version current`
|
|
||||||
echo "$1" | while read VERSION; do
|
|
||||||
if [ "$VERSION" = "$CURRENT" ]; then
|
|
||||||
FORMAT='\033[0;32m-> %9s\033[0m'
|
|
||||||
elif [ -d "$NVM_DIR/$VERSION" ]; then
|
|
||||||
FORMAT='\033[0;34m%12s\033[0m'
|
|
||||||
else
|
|
||||||
FORMAT='%12s'
|
|
||||||
fi
|
|
||||||
printf "$FORMAT\n" $VERSION
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
nvm() {
|
|
||||||
if [ $# -lt 1 ]; then
|
|
||||||
nvm help
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Try to figure out the os and arch for binary fetching
|
|
||||||
local uname="$(uname -a)"
|
|
||||||
local os=
|
|
||||||
local arch="$(uname -m)"
|
|
||||||
local GREP_OPTIONS=''
|
|
||||||
case "$uname" in
|
|
||||||
Linux\ *) os=linux ;;
|
|
||||||
Darwin\ *) os=darwin ;;
|
|
||||||
SunOS\ *) os=sunos ;;
|
|
||||||
FreeBSD\ *) os=freebsd ;;
|
|
||||||
esac
|
|
||||||
case "$uname" in
|
|
||||||
*x86_64*) arch=x64 ;;
|
|
||||||
*i*86*) arch=x86 ;;
|
|
||||||
*armv6l*) arch=arm-pi ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# initialize local variables
|
|
||||||
local VERSION
|
|
||||||
local ADDITIONAL_PARAMETERS
|
|
||||||
local ALIAS
|
|
||||||
|
|
||||||
case $1 in
|
|
||||||
"help" )
|
|
||||||
echo
|
|
||||||
echo "Node Version Manager"
|
|
||||||
echo
|
|
||||||
echo "Usage:"
|
|
||||||
echo " nvm help Show this message"
|
|
||||||
echo " nvm --version Print out the latest released version of nvm"
|
|
||||||
echo " nvm install [-s] <version> Download and install a <version>, [-s] from source. Uses .nvmrc if available"
|
|
||||||
echo " nvm uninstall <version> Uninstall a version"
|
|
||||||
echo " nvm use <version> Modify PATH to use <version>. Uses .nvmrc if available"
|
|
||||||
echo " nvm run <version> [<args>] Run <version> with <args> as arguments. Uses .nvmrc if available for <version>"
|
|
||||||
echo " nvm current Display currently activated version"
|
|
||||||
echo " nvm ls List installed versions"
|
|
||||||
echo " nvm ls <version> List versions matching a given description"
|
|
||||||
echo " nvm ls-remote List remote versions available for install"
|
|
||||||
echo " nvm deactivate Undo effects of NVM on current shell"
|
|
||||||
echo " nvm alias [<pattern>] Show all aliases beginning with <pattern>"
|
|
||||||
echo " nvm alias <name> <version> Set an alias named <name> pointing to <version>"
|
|
||||||
echo " nvm unalias <name> Deletes the alias named <name>"
|
|
||||||
echo " nvm copy-packages <version> Install global NPM packages contained in <version> to current version"
|
|
||||||
echo
|
|
||||||
echo "Example:"
|
|
||||||
echo " nvm install v0.10.24 Install a specific version number"
|
|
||||||
echo " nvm use 0.10 Use the latest available 0.10.x release"
|
|
||||||
echo " nvm run 0.10.24 myApp.js Run myApp.js using node v0.10.24"
|
|
||||||
echo " nvm alias default 0.10.24 Set default node version on a shell"
|
|
||||||
echo
|
|
||||||
echo "Note:"
|
|
||||||
echo " to remove, delete or uninstall nvm - just remove ~/.nvm, ~/.npm and ~/.bower folders"
|
|
||||||
echo
|
|
||||||
;;
|
|
||||||
|
|
||||||
"install" )
|
|
||||||
# initialize local variables
|
|
||||||
local binavail
|
|
||||||
local t
|
|
||||||
local url
|
|
||||||
local sum
|
|
||||||
local tarball
|
|
||||||
local nobinary
|
|
||||||
local version_not_provided=0
|
|
||||||
local provided_version
|
|
||||||
|
|
||||||
if ! nvm_has "curl"; then
|
|
||||||
echo 'NVM Needs curl to proceed.' >&2;
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $# -lt 2 ]; then
|
|
||||||
version_not_provided=1
|
|
||||||
nvm_rc_version
|
|
||||||
if [ -z "$NVM_RC_VERSION" ]; then
|
|
||||||
nvm help
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
shift
|
|
||||||
|
|
||||||
nobinary=0
|
|
||||||
if [ "$1" = "-s" ]; then
|
|
||||||
nobinary=1
|
|
||||||
shift
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$os" = "freebsd" ]; then
|
|
||||||
nobinary=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
provided_version=$1
|
|
||||||
if [ -z "$provided_version" ]; then
|
|
||||||
if [ $version_not_provided -ne 1 ]; then
|
|
||||||
nvm_rc_version
|
|
||||||
fi
|
|
||||||
provided_version="$NVM_RC_VERSION"
|
|
||||||
fi
|
|
||||||
[ -d "$NVM_DIR/$provided_version" ] && echo "$provided_version is already installed." && return
|
|
||||||
|
|
||||||
VERSION=`nvm_remote_version $provided_version`
|
|
||||||
ADDITIONAL_PARAMETERS=''
|
|
||||||
|
|
||||||
shift
|
|
||||||
|
|
||||||
while [ $# -ne 0 ]
|
|
||||||
do
|
|
||||||
ADDITIONAL_PARAMETERS="$ADDITIONAL_PARAMETERS $1"
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ -d "$NVM_DIR/$VERSION" ]; then
|
|
||||||
echo "$VERSION is already installed."
|
|
||||||
nvm use "$VERSION"
|
|
||||||
return $?
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$VERSION" = "N/A" ]; then
|
|
||||||
echo "Version '$provided_version' not found - try \`nvm ls-remote\` to browse available versions."
|
|
||||||
return 3
|
|
||||||
fi
|
|
||||||
|
|
||||||
# skip binary install if no binary option specified.
|
|
||||||
if [ $nobinary -ne 1 ]; then
|
|
||||||
# shortcut - try the binary if possible.
|
|
||||||
if [ -n "$os" ]; then
|
|
||||||
if nvm_binary_available "$VERSION"; then
|
|
||||||
t="$VERSION-$os-$arch"
|
|
||||||
url="$NVM_NODEJS_ORG_MIRROR/$VERSION/node-${t}.tar.gz"
|
|
||||||
sum=`curl -s $NVM_NODEJS_ORG_MIRROR/$VERSION/SHASUMS.txt | \grep node-${t}.tar.gz | awk '{print $1}'`
|
|
||||||
local tmpdir="$NVM_DIR/bin/node-${t}"
|
|
||||||
local tmptarball="$tmpdir/node-${t}.tar.gz"
|
|
||||||
if (
|
|
||||||
mkdir -p "$tmpdir" && \
|
|
||||||
curl -L -C - --progress-bar $url -o "$tmptarball" && \
|
|
||||||
nvm_checksum "$tmptarball" $sum && \
|
|
||||||
tar -xzf "$tmptarball" -C "$tmpdir" --strip-components 1 && \
|
|
||||||
rm -f "$tmptarball" && \
|
|
||||||
mv "$tmpdir" "$NVM_DIR/$VERSION"
|
|
||||||
)
|
|
||||||
then
|
|
||||||
nvm use $VERSION
|
|
||||||
return;
|
|
||||||
else
|
|
||||||
echo "Binary download failed, trying source." >&2
|
|
||||||
rm -rf "$tmptarball" "$tmpdir"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Additional options while compiling: $ADDITIONAL_PARAMETERS"
|
|
||||||
|
|
||||||
tarball=''
|
|
||||||
sum=''
|
|
||||||
make='make'
|
|
||||||
if [ "$os" = "freebsd" ]; then
|
|
||||||
make='gmake'
|
|
||||||
MAKE_CXX="CXX=c++"
|
|
||||||
fi
|
|
||||||
local tmpdir="$NVM_DIR/src"
|
|
||||||
local tmptarball="$tmpdir/node-$VERSION.tar.gz"
|
|
||||||
if [ "`curl -Is "$NVM_NODEJS_ORG_MIRROR/$VERSION/node-$VERSION.tar.gz" | \grep '200 OK'`" != '' ]; then
|
|
||||||
tarball="$NVM_NODEJS_ORG_MIRROR/$VERSION/node-$VERSION.tar.gz"
|
|
||||||
sum=`curl -s $NVM_NODEJS_ORG_MIRROR/$VERSION/SHASUMS.txt | \grep node-$VERSION.tar.gz | awk '{print $1}'`
|
|
||||||
elif [ "`curl -Is "$NVM_NODEJS_ORG_MIRROR/node-$VERSION.tar.gz" | \grep '200 OK'`" != '' ]; then
|
|
||||||
tarball="$NVM_NODEJS_ORG_MIRROR/node-$VERSION.tar.gz"
|
|
||||||
fi
|
|
||||||
if (
|
|
||||||
[ -n "$tarball" ] && \
|
|
||||||
mkdir -p "$tmpdir" && \
|
|
||||||
curl -L --progress-bar $tarball -o "$tmptarball" && \
|
|
||||||
nvm_checksum "$tmptarball" $sum && \
|
|
||||||
tar -xzf "$tmptarball" -C "$tmpdir" && \
|
|
||||||
cd "$tmpdir/node-$VERSION" && \
|
|
||||||
./configure --prefix="$NVM_DIR/$VERSION" $ADDITIONAL_PARAMETERS && \
|
|
||||||
$make $MAKE_CXX && \
|
|
||||||
rm -f "$NVM_DIR/$VERSION" 2>/dev/null && \
|
|
||||||
$make $MAKE_CXX install
|
|
||||||
)
|
|
||||||
then
|
|
||||||
nvm use $VERSION
|
|
||||||
if ! nvm_has "npm" ; then
|
|
||||||
echo "Installing npm..."
|
|
||||||
if [ "`expr "$VERSION" : '\(^v0\.1\.\)'`" != '' ]; then
|
|
||||||
echo "npm requires node v0.2.3 or higher"
|
|
||||||
elif [ "`expr "$VERSION" : '\(^v0\.2\.\)'`" != '' ]; then
|
|
||||||
if [ "`expr "$VERSION" : '\(^v0\.2\.[0-2]$\)'`" != '' ]; then
|
|
||||||
echo "npm requires node v0.2.3 or higher"
|
|
||||||
else
|
|
||||||
curl https://npmjs.org/install.sh | clean=yes npm_install=0.2.19 sh
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
curl https://npmjs.org/install.sh | clean=yes sh
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "nvm: install $VERSION failed!"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
"uninstall" )
|
|
||||||
[ $# -ne 2 ] && nvm help && return
|
|
||||||
PATTERN=`nvm_format_version $2`
|
|
||||||
if [ "$PATTERN" = `nvm_version` ]; then
|
|
||||||
echo "nvm: Cannot uninstall currently-active node version, $PATTERN."
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
VERSION=`nvm_version $PATTERN`
|
|
||||||
if [ ! -d $NVM_DIR/$VERSION ]; then
|
|
||||||
echo "$VERSION version is not installed..."
|
|
||||||
return;
|
|
||||||
fi
|
|
||||||
|
|
||||||
t="$VERSION-$os-$arch"
|
|
||||||
|
|
||||||
# Delete all files related to target version.
|
|
||||||
rm -rf "$NVM_DIR/src/node-$VERSION" \
|
|
||||||
"$NVM_DIR/src/node-$VERSION.tar.gz" \
|
|
||||||
"$NVM_DIR/bin/node-${t}" \
|
|
||||||
"$NVM_DIR/bin/node-${t}.tar.gz" \
|
|
||||||
"$NVM_DIR/$VERSION" 2>/dev/null
|
|
||||||
echo "Uninstalled node $VERSION"
|
|
||||||
|
|
||||||
# Rm any aliases that point to uninstalled version.
|
|
||||||
for ALIAS in `\grep -l $VERSION $NVM_DIR/alias/* 2>/dev/null`
|
|
||||||
do
|
|
||||||
nvm unalias `basename $ALIAS`
|
|
||||||
done
|
|
||||||
|
|
||||||
;;
|
|
||||||
"deactivate" )
|
|
||||||
if [ `expr "$PATH" : ".*$NVM_DIR/.*/bin.*"` != 0 ] ; then
|
|
||||||
export PATH=`nvm_strip_path "$PATH" "/bin"`
|
|
||||||
hash -r
|
|
||||||
echo "$NVM_DIR/*/bin removed from \$PATH"
|
|
||||||
else
|
|
||||||
echo "Could not find $NVM_DIR/*/bin in \$PATH"
|
|
||||||
fi
|
|
||||||
if [ `expr "$MANPATH" : ".*$NVM_DIR/.*/share/man.*"` != 0 ] ; then
|
|
||||||
export MANPATH=`nvm_strip_path "$MANPATH" "/share/man"`
|
|
||||||
echo "$NVM_DIR/*/share/man removed from \$MANPATH"
|
|
||||||
else
|
|
||||||
echo "Could not find $NVM_DIR/*/share/man in \$MANPATH"
|
|
||||||
fi
|
|
||||||
if [ `expr "$NODE_PATH" : ".*$NVM_DIR/.*/lib/node_modules.*"` != 0 ] ; then
|
|
||||||
export NODE_PATH=`nvm_strip_path "$NODE_PATH" "/lib/node_modules"`
|
|
||||||
echo "$NVM_DIR/*/lib/node_modules removed from \$NODE_PATH"
|
|
||||||
else
|
|
||||||
echo "Could not find $NVM_DIR/*/lib/node_modules in \$NODE_PATH"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
"use" )
|
|
||||||
if [ $# -eq 0 ]; then
|
|
||||||
nvm help
|
|
||||||
return 127
|
|
||||||
fi
|
|
||||||
if [ $# -eq 1 ]; then
|
|
||||||
nvm_rc_version
|
|
||||||
if [ -n "$NVM_RC_VERSION" ]; then
|
|
||||||
VERSION=`nvm_version $NVM_RC_VERSION`
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
VERSION=`nvm_version $2`
|
|
||||||
fi
|
|
||||||
if [ -z "$VERSION" ]; then
|
|
||||||
nvm help
|
|
||||||
return 127
|
|
||||||
fi
|
|
||||||
if [ -z "$VERSION" ]; then
|
|
||||||
VERSION=`nvm_version $2`
|
|
||||||
fi
|
|
||||||
if [ ! -d "$NVM_DIR/$VERSION" ]; then
|
|
||||||
echo "$VERSION version is not installed yet"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
# Strip other version from PATH
|
|
||||||
PATH=`nvm_strip_path "$PATH" "/bin"`
|
|
||||||
# Prepend current version
|
|
||||||
PATH=`nvm_prepend_path "$PATH" "$NVM_DIR/$VERSION/bin"`
|
|
||||||
if [ -z "$MANPATH" ]; then
|
|
||||||
MANPATH=$(manpath)
|
|
||||||
fi
|
|
||||||
# Strip other version from MANPATH
|
|
||||||
MANPATH=`nvm_strip_path "$MANPATH" "/share/man"`
|
|
||||||
# Prepend current version
|
|
||||||
MANPATH=`nvm_prepend_path "$MANPATH" "$NVM_DIR/$VERSION/share/man"`
|
|
||||||
# Strip other version from NODE_PATH
|
|
||||||
NODE_PATH=`nvm_strip_path "$NODE_PATH" "/lib/node_modules"`
|
|
||||||
# Prepend current version
|
|
||||||
NODE_PATH=`nvm_prepend_path "$NODE_PATH" "$NVM_DIR/$VERSION/lib/node_modules"`
|
|
||||||
export PATH
|
|
||||||
hash -r
|
|
||||||
export MANPATH
|
|
||||||
export NODE_PATH
|
|
||||||
export NVM_PATH="$NVM_DIR/$VERSION/lib/node"
|
|
||||||
export NVM_BIN="$NVM_DIR/$VERSION/bin"
|
|
||||||
echo "Now using node $VERSION"
|
|
||||||
;;
|
|
||||||
"run" )
|
|
||||||
local provided_version
|
|
||||||
local has_checked_nvmrc=0
|
|
||||||
# run given version of node
|
|
||||||
shift
|
|
||||||
if [ $# -lt 1 ]; then
|
|
||||||
nvm_rc_version && has_checked_nvmrc=1
|
|
||||||
if [ -n "$NVM_RC_VERSION" ]; then
|
|
||||||
VERSION=`nvm_version $NVM_RC_VERSION`
|
|
||||||
else
|
|
||||||
VERSION='N/A'
|
|
||||||
fi
|
|
||||||
if [ $VERSION = "N/A" ]; then
|
|
||||||
nvm help
|
|
||||||
return 127
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
provided_version=$1
|
|
||||||
if [ -n "$provided_version" ]; then
|
|
||||||
VERSION=`nvm_version $provided_version`
|
|
||||||
if [ $VERSION = "N/A" ]; then
|
|
||||||
provided_version=''
|
|
||||||
if [ $has_checked_nvmrc -ne 1 ]; then
|
|
||||||
nvm_rc_version && has_checked_nvmrc=1
|
|
||||||
fi
|
|
||||||
VERSION=`nvm_version $NVM_RC_VERSION`
|
|
||||||
else
|
|
||||||
shift
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -d "$NVM_DIR/$VERSION" ]; then
|
|
||||||
echo "$VERSION version is not installed yet"
|
|
||||||
return;
|
|
||||||
fi
|
|
||||||
RUN_NODE_PATH=`nvm_strip_path "$NODE_PATH" "/lib/node_modules"`
|
|
||||||
RUN_NODE_PATH=`nvm_prepend_path "$NODE_PATH" "$NVM_DIR/$VERSION/lib/node_modules"`
|
|
||||||
echo "Running node $VERSION"
|
|
||||||
NODE_PATH=$RUN_NODE_PATH $NVM_DIR/$VERSION/bin/node "$@"
|
|
||||||
;;
|
|
||||||
"ls" | "list" )
|
|
||||||
nvm_print_versions "`nvm_ls $2`"
|
|
||||||
if [ $# -eq 1 ]; then
|
|
||||||
nvm alias
|
|
||||||
fi
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
"ls-remote" | "list-remote" )
|
|
||||||
nvm_print_versions "`nvm_ls_remote $2`"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
"current" )
|
|
||||||
nvm_version current
|
|
||||||
;;
|
|
||||||
"alias" )
|
|
||||||
mkdir -p $NVM_DIR/alias
|
|
||||||
if [ $# -le 2 ]; then
|
|
||||||
local DEST
|
|
||||||
for ALIAS in $NVM_DIR/alias/$2*; do
|
|
||||||
if [ -e "$ALIAS" ]; then
|
|
||||||
DEST=`cat $ALIAS`
|
|
||||||
VERSION=`nvm_version $DEST`
|
|
||||||
if [ "$DEST" = "$VERSION" ]; then
|
|
||||||
echo "$(basename $ALIAS) -> $DEST"
|
|
||||||
else
|
|
||||||
echo "$(basename $ALIAS) -> $DEST (-> $VERSION)"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
if [ -z "$3" ]; then
|
|
||||||
rm -f $NVM_DIR/alias/$2
|
|
||||||
echo "$2 -> *poof*"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
mkdir -p $NVM_DIR/alias
|
|
||||||
VERSION=`nvm_version $3`
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "! WARNING: Version '$3' does not exist." >&2
|
|
||||||
fi
|
|
||||||
echo $3 > "$NVM_DIR/alias/$2"
|
|
||||||
if [ ! "$3" = "$VERSION" ]; then
|
|
||||||
echo "$2 -> $3 (-> $VERSION)"
|
|
||||||
else
|
|
||||||
echo "$2 -> $3"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
"unalias" )
|
|
||||||
mkdir -p $NVM_DIR/alias
|
|
||||||
[ $# -ne 2 ] && nvm help && return 127
|
|
||||||
[ ! -f "$NVM_DIR/alias/$2" ] && echo "Alias $2 doesn't exist!" && return
|
|
||||||
rm -f $NVM_DIR/alias/$2
|
|
||||||
echo "Deleted alias $2"
|
|
||||||
;;
|
|
||||||
"copy-packages" )
|
|
||||||
if [ $# -ne 2 ]; then
|
|
||||||
nvm help
|
|
||||||
return 127
|
|
||||||
fi
|
|
||||||
VERSION=`nvm_version $2`
|
|
||||||
local ROOT=`(nvm use $VERSION && npm -g root)`
|
|
||||||
local ROOTDEPTH=$((`echo $ROOT | sed 's/[^\/]//g'|wc -m` -1))
|
|
||||||
|
|
||||||
# declare local INSTALLS first, otherwise it doesn't work in zsh
|
|
||||||
local INSTALLS
|
|
||||||
INSTALLS=`nvm use $VERSION > /dev/null && npm -g -p ll | \grep "$ROOT\/[^/]\+$" | cut -d '/' -f $(($ROOTDEPTH + 2)) | cut -d ":" -f 2 | \grep -v npm | tr "\n" " "`
|
|
||||||
|
|
||||||
npm install -g ${INSTALLS[@]}
|
|
||||||
;;
|
|
||||||
"clear-cache" )
|
|
||||||
rm -f $NVM_DIR/v* 2>/dev/null
|
|
||||||
echo "Cache cleared."
|
|
||||||
;;
|
|
||||||
"version" )
|
|
||||||
nvm_version $2
|
|
||||||
;;
|
|
||||||
"--version" )
|
|
||||||
echo "0.7.0"
|
|
||||||
;;
|
|
||||||
* )
|
|
||||||
nvm help
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
nvm ls default >/dev/null && nvm use default >/dev/null || true
|
|
||||||
|
|
66
package.json
66
package.json
@ -1,33 +1,33 @@
|
|||||||
{
|
{
|
||||||
"name": "nvm",
|
"name": "nvm",
|
||||||
"version": "0.7.0",
|
"version": "0.7.0",
|
||||||
"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"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "urchin test",
|
"test": "urchin test",
|
||||||
"test/fast": "urchin -f test/fast",
|
"test/fast": "urchin -f test/fast",
|
||||||
"test/slow": "urchin -f test/slow"
|
"test/slow": "urchin -f test/slow"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git://github.com/creationix/nvm.git"
|
"url": "git://github.com/creationix/nvm.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"nvm",
|
"nvm",
|
||||||
"node",
|
"node",
|
||||||
"version",
|
"version",
|
||||||
"manager"
|
"manager"
|
||||||
],
|
],
|
||||||
"author": "Tim Caswell <tim@creationix.com>",
|
"author": "Tim Caswell <tim@creationix.com>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/creationix/nvm/issues"
|
"url": "https://github.com/creationix/nvm/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/creationix/nvm",
|
"homepage": "https://github.com/creationix/nvm",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"urchin": "~0.0.2"
|
"urchin": "~0.0.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
. ../../../nvm.sh
|
. ../../../nvm.sh
|
||||||
[ $(nvm alias test1 | wc -l) = '2' ]
|
[ $(nvm alias test1 | wc -l) = '2' ]
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
. ../../../nvm.sh
|
. ../../../nvm.sh
|
||||||
[ $(nvm alias | wc -l) = '10' ]
|
[ $(nvm alias | wc -l) = '10' ]
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
for i in $(seq 1 10)
|
for i in $(seq 1 10)
|
||||||
do
|
do
|
||||||
echo v0.0.$i > ../../../alias/test$i
|
echo v0.0.$i > ../../../alias/test$i
|
||||||
done
|
done
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
mkdir ../../../v0.1.3
|
mkdir ../../../v0.1.3
|
||||||
mkdir ../../../v0.2.3
|
mkdir ../../../v0.2.3
|
||||||
|
|
||||||
. ../../../nvm.sh
|
. ../../../nvm.sh
|
||||||
|
|
||||||
# The result should contain only the appropriate version numbers.
|
# The result should contain only the appropriate version numbers.
|
||||||
nvm ls 0.2 | grep v0.2.3 &&
|
nvm ls 0.2 | grep v0.2.3 &&
|
||||||
nvm ls 0.1 | grep -v v0.2.3 &&
|
nvm ls 0.1 | grep -v v0.2.3 &&
|
||||||
nvm ls 0.1 | grep v0.1.3 &&
|
nvm ls 0.1 | grep v0.1.3 &&
|
||||||
nvm ls v0.2 | grep v0.2.3
|
nvm ls v0.2 | grep v0.2.3
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
. ../../../nvm.sh
|
. ../../../nvm.sh
|
||||||
|
|
||||||
mkdir ../../../v0.0.1
|
mkdir ../../../v0.0.1
|
||||||
mkdir ../../../v0.0.3
|
mkdir ../../../v0.0.3
|
||||||
mkdir ../../../v0.0.9
|
mkdir ../../../v0.0.9
|
||||||
mkdir ../../../v0.3.1
|
mkdir ../../../v0.3.1
|
||||||
mkdir ../../../v0.3.3
|
mkdir ../../../v0.3.3
|
||||||
mkdir ../../../v0.3.9
|
mkdir ../../../v0.3.9
|
||||||
|
|
||||||
# The result should contain the version numbers.
|
# The result should contain the version numbers.
|
||||||
nvm ls | grep v0.0.1 &&
|
nvm ls | grep v0.0.1 &&
|
||||||
nvm ls | grep v0.0.3 &&
|
nvm ls | grep v0.0.3 &&
|
||||||
nvm ls | grep v0.0.9 &&
|
nvm ls | grep v0.0.9 &&
|
||||||
nvm ls | grep v0.3.1 &&
|
nvm ls | grep v0.3.1 &&
|
||||||
nvm ls | grep v0.3.3 &&
|
nvm ls | grep v0.3.3 &&
|
||||||
nvm ls | grep v0.3.9
|
nvm ls | grep v0.3.9
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
. ../../nvm.sh
|
. ../../nvm.sh
|
||||||
nvm alias test v0.1.2
|
nvm alias test v0.1.2
|
||||||
[ "$(cat ../../alias/test)" = "v0.1.2" ]
|
[ "$(cat ../../alias/test)" = "v0.1.2" ]
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
die () { echo $@ ; exit 1; }
|
die () { echo $@ ; exit 1; }
|
||||||
|
|
||||||
. ../../nvm.sh
|
. ../../nvm.sh
|
||||||
[ "$(nvm current)" = "$(node -v)" ] || die "Failed to find current version"
|
[ "$(nvm current)" = "$(node -v)" ] || die "Failed to find current version"
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
mkdir -p ../../v0.2.3
|
mkdir -p ../../v0.2.3
|
||||||
|
|
||||||
die () { echo $@ ; exit 1; }
|
die () { echo $@ ; exit 1; }
|
||||||
|
|
||||||
[ `expr $PATH : ".*v0.2.3/.*/bin"` = 0 ] || echo "WARNING: Unexpectedly found v0.2.3 already active" >&2
|
[ `expr $PATH : ".*v0.2.3/.*/bin"` = 0 ] || echo "WARNING: Unexpectedly found v0.2.3 already active" >&2
|
||||||
|
|
||||||
. ../../nvm.sh
|
. ../../nvm.sh
|
||||||
nvm use v0.2.3 &&
|
nvm use v0.2.3 &&
|
||||||
[ `expr $PATH : ".*v0.2.3/.*/bin"` != 0 ] && [ `expr $NODE_PATH : ".*v0.2.3/.*/lib/node_modules"` != 0 ] || die "Failed to activate v0.2.3"
|
[ `expr $PATH : ".*v0.2.3/.*/bin"` != 0 ] && [ `expr $NODE_PATH : ".*v0.2.3/.*/lib/node_modules"` != 0 ] || die "Failed to activate v0.2.3"
|
||||||
|
|
||||||
nvm deactivate &&
|
nvm deactivate &&
|
||||||
[ `expr $PATH : ".*v0.2.3/.*/bin"` = 0 ] && [ `expr $NODE_PATH : ".*v0.2.3/.*/lib/node_modules"` = 0 ] || die "Failed to deactivate v0.2.3"
|
[ `expr $PATH : ".*v0.2.3/.*/bin"` = 0 ] && [ `expr $NODE_PATH : ".*v0.2.3/.*/lib/node_modules"` = 0 ] || die "Failed to deactivate v0.2.3"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
die () { echo $@ ; exit 1; }
|
die () { echo $@ ; exit 1; }
|
||||||
|
|
||||||
. ../../nvm.sh
|
. ../../nvm.sh
|
||||||
[ "$(nvm install invalid.invalid)" = "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)" = "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"
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
echo v0.1.2 > ../../alias/test
|
echo v0.1.2 > ../../alias/test
|
||||||
. ../../nvm.sh
|
. ../../nvm.sh
|
||||||
nvm unalias test
|
nvm unalias test
|
||||||
! [ -e ../../alias/test ]
|
! [ -e ../../alias/test ]
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
cd ../..
|
cd ../..
|
||||||
mkdir v0.0.1
|
mkdir v0.0.1
|
||||||
mkdir src/node-v0.0.1
|
mkdir src/node-v0.0.1
|
||||||
|
|
||||||
. ./nvm.sh
|
. ./nvm.sh
|
||||||
nvm uninstall v0.0.1
|
nvm uninstall v0.0.1
|
||||||
|
|
||||||
[ ! -d 'v0.0.1' ] && [ ! -d 'src/node-v0.0.1' ]
|
[ ! -d 'v0.0.1' ] && [ ! -d 'src/node-v0.0.1' ]
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
. ../../nvm.sh
|
. ../../nvm.sh
|
||||||
nvm
|
nvm
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
die () { echo $@ ; exit 1; }
|
die () { echo $@ ; exit 1; }
|
||||||
|
|
||||||
. ../../../nvm.sh
|
. ../../../nvm.sh
|
||||||
|
|
||||||
TEST_PATH=/usr/bin:/usr/local/bin
|
TEST_PATH=/usr/bin:/usr/local/bin
|
||||||
|
|
||||||
NEW_PATH=`nvm_prepend_path "$TEST_PATH" "$NVM_DIR/v0.2.5/bin"`
|
NEW_PATH=`nvm_prepend_path "$TEST_PATH" "$NVM_DIR/v0.2.5/bin"`
|
||||||
|
|
||||||
[ "$NEW_PATH" = "$NVM_DIR/v0.2.5/bin:/usr/bin:/usr/local/bin" ] || die "Not correctly prepended: $NEW_PATH "
|
[ "$NEW_PATH" = "$NVM_DIR/v0.2.5/bin:/usr/bin:/usr/local/bin" ] || die "Not correctly prepended: $NEW_PATH "
|
||||||
|
|
||||||
|
|
||||||
EMPTY_PATH=
|
EMPTY_PATH=
|
||||||
|
|
||||||
NEW_PATH=`nvm_prepend_path "$EMPTY_PATH" "$NVM_DIR/v0.2.5/bin"`
|
NEW_PATH=`nvm_prepend_path "$EMPTY_PATH" "$NVM_DIR/v0.2.5/bin"`
|
||||||
|
|
||||||
[ "$NEW_PATH" = "$NVM_DIR/v0.2.5/bin" ] || die "Not correctly prepended: $NEW_PATH "
|
[ "$NEW_PATH" = "$NVM_DIR/v0.2.5/bin" ] || die "Not correctly prepended: $NEW_PATH "
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
die () { echo $@ ; exit 1; }
|
die () { echo $@ ; exit 1; }
|
||||||
|
|
||||||
. ../../../nvm.sh
|
. ../../../nvm.sh
|
||||||
|
|
||||||
TEST_PATH=$NVM_DIR/v0.10.5/bin:/usr/bin:$NVM_DIR/v0.11.5/bin:$NVM_DIR/v0.9.5/bin:/usr/local/bin:$NVM_DIR/v0.2.5/bin
|
TEST_PATH=$NVM_DIR/v0.10.5/bin:/usr/bin:$NVM_DIR/v0.11.5/bin:$NVM_DIR/v0.9.5/bin:/usr/local/bin:$NVM_DIR/v0.2.5/bin
|
||||||
|
|
||||||
STRIPPED_PATH=`nvm_strip_path "$TEST_PATH" "/bin"`
|
STRIPPED_PATH=`nvm_strip_path "$TEST_PATH" "/bin"`
|
||||||
|
|
||||||
[ "$STRIPPED_PATH" = "/usr/bin:/usr/local/bin" ] || die "Not correctly stripped: $STRIPPED_PATH "
|
[ "$STRIPPED_PATH" = "/usr/bin:/usr/local/bin" ] || die "Not correctly stripped: $STRIPPED_PATH "
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
(
|
(
|
||||||
cd ../..
|
cd ../..
|
||||||
|
|
||||||
# Back up
|
# Back up
|
||||||
|
|
||||||
type setopt >/dev/null 2>&1 && setopt NULL_GLOB
|
type setopt >/dev/null 2>&1 && setopt NULL_GLOB
|
||||||
type shopt >/dev/null 2>&1 && shopt -s nullglob
|
type shopt >/dev/null 2>&1 && shopt -s nullglob
|
||||||
rm -Rf v* src alias
|
rm -Rf v* src alias
|
||||||
mkdir src alias
|
mkdir src alias
|
||||||
)
|
)
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
(
|
(
|
||||||
cd ../..
|
cd ../..
|
||||||
|
|
||||||
# Back up
|
# Back up
|
||||||
|
|
||||||
mkdir -p bak
|
mkdir -p bak
|
||||||
for SRC in v* src alias; do
|
for SRC in v* src alias; do
|
||||||
[ -e "$SRC" ] && mv "$SRC" bak
|
[ -e "$SRC" ] && mv "$SRC" bak
|
||||||
done
|
done
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# Remove temporary files
|
# Remove temporary files
|
||||||
(
|
(
|
||||||
cd ../..
|
cd ../..
|
||||||
|
|
||||||
type setopt >/dev/null 2>&1 && setopt NULL_GLOB
|
type setopt >/dev/null 2>&1 && setopt NULL_GLOB
|
||||||
type shopt >/dev/null 2>&1 && shopt -s nullglob
|
type shopt >/dev/null 2>&1 && shopt -s nullglob
|
||||||
rm -fR v* src alias
|
rm -fR v* src alias
|
||||||
)
|
)
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
(
|
(
|
||||||
cd ../..
|
cd ../..
|
||||||
|
|
||||||
# Restore
|
# Restore
|
||||||
if [ -d bak ]
|
if [ -d bak ]
|
||||||
then
|
then
|
||||||
mv bak/* . > /dev/null 2>&1 || sleep 0s
|
mv bak/* . > /dev/null 2>&1 || sleep 0s
|
||||||
rmdir bak
|
rmdir bak
|
||||||
fi
|
fi
|
||||||
mkdir -p src alias
|
mkdir -p src alias
|
||||||
)
|
)
|
||||||
|
@ -1,24 +1,24 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
die () { echo $@ ; exit 1; }
|
die () { echo $@ ; exit 1; }
|
||||||
|
|
||||||
. ../../../nvm.sh
|
. ../../../nvm.sh
|
||||||
|
|
||||||
[ "$(nvm install invalid.invalid)" = "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)" = "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 ../../../v0.9.7 ] && rm -R ../../../v0.9.7
|
||||||
[ -e ../../../v0.9.12 ] && rm -R ../../../v0.9.12
|
[ -e ../../../v0.9.12 ] && rm -R ../../../v0.9.12
|
||||||
|
|
||||||
# Install from binary
|
# Install from binary
|
||||||
nvm install 0.9.7
|
nvm install 0.9.7
|
||||||
nvm install 0.9.12
|
nvm install 0.9.12
|
||||||
|
|
||||||
nvm use 0.9.7
|
nvm use 0.9.7
|
||||||
|
|
||||||
node --version | grep v0.9.7 || die "precondition failed: node doesn't start at 0.9.7"
|
node --version | grep v0.9.7 || die "precondition failed: node doesn't start at 0.9.7"
|
||||||
|
|
||||||
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"
|
||||||
|
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
. ../../../nvm.sh
|
. ../../../nvm.sh
|
||||||
|
|
||||||
NVM_TEST_VERSION=v0.10.7
|
NVM_TEST_VERSION=v0.10.7
|
||||||
|
|
||||||
# Remove the stuff we're clobbering.
|
# Remove the stuff we're clobbering.
|
||||||
[ -e ../../../$NVM_TEST_VERSION ] && rm -R ../../../$NVM_TEST_VERSION
|
[ -e ../../../$NVM_TEST_VERSION ] && rm -R ../../../$NVM_TEST_VERSION
|
||||||
|
|
||||||
# Install from binary
|
# Install from binary
|
||||||
nvm install $NVM_TEST_VERSION
|
nvm install $NVM_TEST_VERSION
|
||||||
|
|
||||||
# Check
|
# Check
|
||||||
[ -d ../../../$NVM_TEST_VERSION ]
|
[ -d ../../../$NVM_TEST_VERSION ]
|
||||||
nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION
|
nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION
|
||||||
|
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
. ../../../nvm.sh
|
. ../../../nvm.sh
|
||||||
|
|
||||||
NVM_TEST_VERSION=v0.10.7
|
NVM_TEST_VERSION=v0.10.7
|
||||||
|
|
||||||
# Remove the stuff we're clobbering.
|
# Remove the stuff we're clobbering.
|
||||||
[ -e ../../../$NVM_TEST_VERSION ] && rm -R ../../../$NVM_TEST_VERSION
|
[ -e ../../../$NVM_TEST_VERSION ] && rm -R ../../../$NVM_TEST_VERSION
|
||||||
|
|
||||||
# Install from source
|
# Install from source
|
||||||
nvm install -s $NVM_TEST_VERSION
|
nvm install -s $NVM_TEST_VERSION
|
||||||
|
|
||||||
# Check
|
# Check
|
||||||
[ -d ../../../$NVM_TEST_VERSION ]
|
[ -d ../../../$NVM_TEST_VERSION ]
|
||||||
nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION
|
nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION
|
||||||
|
|
||||||
|
@ -1,24 +1,24 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
. ../../../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 ../../../v0.9.7 ] && rm -R ../../../v0.9.7
|
||||||
[ -e ../../../v0.9.12 ] && rm -R ../../../v0.9.12
|
[ -e ../../../v0.9.12 ] && rm -R ../../../v0.9.12
|
||||||
|
|
||||||
# Install from binary
|
# Install from binary
|
||||||
nvm install 0.9.7
|
nvm install 0.9.7
|
||||||
nvm install 0.9.12
|
nvm install 0.9.12
|
||||||
|
|
||||||
# Check
|
# Check
|
||||||
[ -d ../../../v0.9.7 ]
|
[ -d ../../../v0.9.7 ]
|
||||||
[ -d ../../../v0.9.12 ]
|
[ -d ../../../v0.9.12 ]
|
||||||
|
|
||||||
# Use the first one
|
# Use the first one
|
||||||
nvm use 0.9.7
|
nvm use 0.9.7
|
||||||
|
|
||||||
# Use the latest one
|
# Use the latest one
|
||||||
nvm use 0.9
|
nvm use 0.9
|
||||||
node --version | grep v0.9.12
|
node --version | grep v0.9.12
|
||||||
|
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
. ../../../nvm.sh
|
. ../../../nvm.sh
|
||||||
|
|
||||||
NVM_TEST_VERSION=v0.10.7
|
NVM_TEST_VERSION=v0.10.7
|
||||||
|
|
||||||
# Remove the stuff we're clobbering.
|
# Remove the stuff we're clobbering.
|
||||||
[ -e ../../../$NVM_TEST_VERSION ] && rm -R ../../../$NVM_TEST_VERSION
|
[ -e ../../../$NVM_TEST_VERSION ] && rm -R ../../../$NVM_TEST_VERSION
|
||||||
|
|
||||||
# Install from binary
|
# Install from binary
|
||||||
cat "$NVM_TEST_VERSION" > .nvmrc
|
cat "$NVM_TEST_VERSION" > .nvmrc
|
||||||
|
|
||||||
nvm install
|
nvm install
|
||||||
|
|
||||||
# Check
|
# Check
|
||||||
[ -d ../../../$NVM_TEST_VERSION ]
|
[ -d ../../../$NVM_TEST_VERSION ]
|
||||||
nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION
|
nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
. ../../../nvm.sh
|
. ../../../nvm.sh
|
||||||
|
|
||||||
NVM_TEST_VERSION=v0.10.7
|
NVM_TEST_VERSION=v0.10.7
|
||||||
|
|
||||||
# Remove the stuff we're clobbering.
|
# Remove the stuff we're clobbering.
|
||||||
[ -e ../../../$NVM_TEST_VERSION ] && rm -R ../../../$NVM_TEST_VERSION
|
[ -e ../../../$NVM_TEST_VERSION ] && rm -R ../../../$NVM_TEST_VERSION
|
||||||
|
|
||||||
# Install from binary
|
# Install from binary
|
||||||
cat "$NVM_TEST_VERSION" > .nvmrc
|
cat "$NVM_TEST_VERSION" > .nvmrc
|
||||||
|
|
||||||
nvm install -s
|
nvm install -s
|
||||||
|
|
||||||
# Check
|
# Check
|
||||||
[ -d ../../../$NVM_TEST_VERSION ]
|
[ -d ../../../$NVM_TEST_VERSION ]
|
||||||
nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION
|
nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
if [ -f ".nvmrc" ]; then
|
if [ -f ".nvmrc" ]; then
|
||||||
mv .nvmrc .nvmrc.bak
|
mv .nvmrc .nvmrc.bak
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
. ../../../nvm.sh
|
. ../../../nvm.sh
|
||||||
nvm uninstall v0.10.7
|
nvm uninstall v0.10.7
|
||||||
|
|
||||||
if [ -f ".nvmrc" ]; then
|
if [ -f ".nvmrc" ]; then
|
||||||
rm .nvmrc
|
rm .nvmrc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f ".nvmrc.bak" ]; then
|
if [ -f ".nvmrc.bak" ]; then
|
||||||
mv .nvmrc.bak .nvmrc
|
mv .nvmrc.bak .nvmrc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
|
||||||
die () { echo $@ ; exit 1; }
|
die () { echo $@ ; exit 1; }
|
||||||
|
|
||||||
. ../../../nvm.sh
|
. ../../../nvm.sh
|
||||||
|
|
||||||
[ "$(nvm run 0.10.7 --version | tail -1)" = "v0.10.7" ] || die "`nvm run` failed to run with the correct version"
|
[ "$(nvm run 0.10.7 --version | tail -1)" = "v0.10.7" ] || die "`nvm run` failed to run with the correct version"
|
||||||
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
|
||||||
die () { echo $@ ; exit 1; }
|
die () { echo $@ ; exit 1; }
|
||||||
|
|
||||||
. ../../../nvm.sh
|
. ../../../nvm.sh
|
||||||
|
|
||||||
echo "0.10.7" > .nvmrc
|
echo "0.10.7" > .nvmrc
|
||||||
|
|
||||||
[ "$(nvm run --version | tail -1)" = "v0.10.7" ] || die "\`nvm run\` failed to run with the .nvmrc version"
|
[ "$(nvm run --version | tail -1)" = "v0.10.7" ] || die "\`nvm run\` failed to run with the .nvmrc version"
|
||||||
|
|
||||||
[ "$(nvm run --version | head -1)" = "Found '$PWD/.nvmrc' with version <0.10.7>" ] || die "\`nvm run\` failed to print out the \"found in .nvmrc\" message"
|
[ "$(nvm run --version | head -1)" = "Found '$PWD/.nvmrc' with version <0.10.7>" ] || die "\`nvm run\` failed to print out the \"found in .nvmrc\" message"
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
. ../../../nvm.sh
|
. ../../../nvm.sh
|
||||||
nvm install 0.10.7
|
nvm install 0.10.7
|
||||||
|
|
||||||
if [ -f ".nvmrc" ]; then
|
if [ -f ".nvmrc" ]; then
|
||||||
mv .nvmrc .nvmrc.bak
|
mv .nvmrc .nvmrc.bak
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
. ../../../nvm.sh
|
. ../../../nvm.sh
|
||||||
nvm uninstall v0.10.7
|
nvm uninstall v0.10.7
|
||||||
|
|
||||||
rm .nvmrc
|
rm .nvmrc
|
||||||
|
|
||||||
if [ -f ".nvmrc.bak" ]; then
|
if [ -f ".nvmrc.bak" ]; then
|
||||||
mv .nvmrc.bak .nvmrc
|
mv .nvmrc.bak .nvmrc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user