-
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1000ch
committed
Jan 11, 2016
1 parent
413475c
commit 32fc32a
Showing
2 changed files
with
153 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,160 +1,213 @@ | ||
# nodebrew | ||
|
||
[![Build Status](https://travis-ci.org/hokaccha/nodebrew.png?branch=master)](https://travis-ci.org/hokaccha/nodebrew) | ||
[![Build Status](https://travis-ci.org/hokaccha/nodebrew.svg?branch=master)](https://travis-ci.org/hokaccha/nodebrew) | ||
|
||
Node.js version manager. | ||
|
||
## Install | ||
|
||
One liner curl install. | ||
Install with curl. | ||
|
||
$ curl -L git.io/nodebrew | perl - setup | ||
```bash | ||
$ curl -L git.io/nodebrew | perl - setup | ||
``` | ||
|
||
Or, download and setup. | ||
|
||
$ wget git.io/nodebrew | ||
$ perl nodebrew setup | ||
```bash | ||
$ wget git.io/nodebrew | ||
$ perl nodebrew setup | ||
``` | ||
|
||
Add `PATH` setting your shell config file (`.bashrc` or `.zshrc)`. | ||
Add `PATH` setting your shell config file (`.bashrc` or `.zshrc`). | ||
|
||
export PATH=$HOME/.nodebrew/current/bin:$PATH | ||
``` | ||
export PATH=$HOME/.nodebrew/current/bin:$PATH | ||
``` | ||
|
||
Reload config. | ||
|
||
$ source ~/.bashrc | ||
```bash | ||
$ source ~/.bashrc | ||
``` | ||
|
||
Confirm. | ||
|
||
$ nodebrew help | ||
```bash | ||
$ nodebrew help | ||
``` | ||
|
||
## ENV | ||
`NODEBREW_ROOT` (which indicates nodebrew's home directory) is configurable. | ||
If you want to install nodebrew manually, please configure such as follows. | ||
|
||
`NODEBREW_ROOT` environment variable can change nodebrew's home directory. | ||
The default is `$HOME/.nodebrew`. | ||
``` | ||
export NODEBREW_ROOT=/path/to/.nodebrew | ||
``` | ||
|
||
export NODEBREW_ROOT=/path/to/.nodebrew | ||
The default value is `$HOME/.nodebrew`. | ||
|
||
## Example | ||
## Usage | ||
|
||
Install. | ||
### `nodebrew install-binary <version>` | ||
|
||
$ nodebrew install-binary v0.10.29 | ||
install ... | ||
Install Node.js. | ||
|
||
# or | ||
$ nodebrew install-binary latest # latest version | ||
$ nodebrew install-binary stable # stable version | ||
$ nodebrew install-binary v0.10.x # v0.10 latest | ||
$ nodebrew install-binary 0.10.29 # without `v` | ||
```bash | ||
$ nodebrew install-binary v0.10.29 | ||
install ... | ||
|
||
Switch use version. | ||
# or | ||
$ nodebrew install-binary latest # latest version | ||
$ nodebrew install-binary stable # stable version | ||
$ nodebrew install-binary v0.10.x # v0.10 latest | ||
$ nodebrew install-binary 0.10.29 # without `v` | ||
$ nodebrew install-binary io@v1.0.0 # io.js | ||
``` | ||
|
||
$ nodebrew use v0.10.29 | ||
$ node -v | ||
v0.10.29 | ||
### `nodebrew install <version>` | ||
|
||
# or | ||
$ nodebrew use latest # latest version | ||
$ nodebrew use stable # stable version | ||
$ nodebrew use v0.6.x # v0.6 latest | ||
$ nodebrew use 0.10.29 # without `v` | ||
We recommend you to use `install-binary` command to install. | ||
If you want to compile from source, you can use `install` command. | ||
|
||
View all installed versions: `list` or `ls`. | ||
```bash | ||
$ nodebrew install v0.10.29 | ||
``` | ||
|
||
$ nodebrew ls | ||
v0.8.28 | ||
v0.10.29 | ||
Pass configure options to Node.js. | ||
|
||
current: v0.10.29 | ||
```bash | ||
$ nodebrew install v0.11.14 --v8-options=--harmony | ||
``` | ||
|
||
Remote version view. | ||
### `nodebrew use <version>` | ||
|
||
$ nodebrew ls-remote | ||
v0.0.1 v0.0.2 v0.0.3 v0.0.4 v0.0.5 v0.0.6 | ||
... | ||
Switch a version to use. | ||
|
||
Remote and local version view. | ||
```bash | ||
$ nodebrew use v0.10.29 | ||
$ node -v | ||
v0.10.29 | ||
|
||
$ nodebrew ls-all | ||
Remote: | ||
v0.0.1 v0.0.2 v0.0.3 v0.0.4 v0.0.5 v0.0.6 | ||
... | ||
# or | ||
$ nodebrew use latest # latest version | ||
$ nodebrew use stable # stable version | ||
$ nodebrew use v0.6.x # v0.6 latest | ||
$ nodebrew use 0.10.29 # without `v` | ||
``` | ||
|
||
Local: | ||
v0.8.28 | ||
v0.10.29 | ||
### `nodebrew ls` or `nodebrew list` | ||
|
||
current: v0.10.29 | ||
List all installed versions. | ||
|
||
Set alias. | ||
```bash | ||
$ nodebrew ls | ||
v0.8.28 | ||
v0.10.29 | ||
|
||
$ nodebrew alias default v0.8.28 | ||
default -> v0.8.28 | ||
current: v0.10.29 | ||
``` | ||
|
||
$ nodebrew use default | ||
use v0.8.28 | ||
### `nodebrew ls-remote` | ||
|
||
$ nodebrew unalias default | ||
remove default | ||
List remote versions. | ||
|
||
Uninstall. | ||
```bash | ||
$ nodebrew ls-remote | ||
v0.0.1 v0.0.2 v0.0.3 v0.0.4 v0.0.5 v0.0.6 | ||
... | ||
``` | ||
|
||
$ nodebrew uninstall v0.10.29 | ||
v0.10.29 uninstalled | ||
### `nodebrew ls-all` | ||
|
||
Update nodebrew. | ||
List installed and remote versions. | ||
|
||
$ nodebrew selfupdate | ||
```bash | ||
$ nodebrew ls-all | ||
Remote: | ||
v0.0.1 v0.0.2 v0.0.3 v0.0.4 v0.0.5 v0.0.6 | ||
... | ||
|
||
Execute other version temporary. | ||
Local: | ||
v0.8.28 | ||
v0.10.29 | ||
|
||
$ nodebrew exec v0.10.29 -- node app.js | ||
current: v0.10.29 | ||
``` | ||
|
||
## Install from source | ||
### `nodebrew alias` | ||
|
||
We recommend to use the `install-binary` command to install. | ||
If you want to compile from source, you can use `install` command. | ||
Set alias. | ||
|
||
$ nodebrew install v0.10.29 | ||
```bash | ||
$ nodebrew alias default v0.8.28 | ||
default -> v0.8.28 | ||
|
||
Pass configure options to Node.js. | ||
$ nodebrew use default | ||
use v0.8.28 | ||
|
||
$ nodebrew install v0.11.14 --v8-options=--harmony | ||
$ nodebrew unalias default | ||
remove default | ||
``` | ||
|
||
## io.js | ||
### `nodebrew uninstall <version>` | ||
|
||
$ nodebrew install-binary io@v1.0.0 | ||
$ nodebrew use io@v1.0.0 | ||
$ nodebrew ls | ||
v0.10.33 | ||
io@v1.0.0 | ||
Uninstall Node.js. | ||
|
||
current: io@v1.0.0 | ||
```bash | ||
$ nodebrew uninstall v0.10.29 | ||
v0.10.29 uninstalled | ||
``` | ||
|
||
## Commands | ||
### `nodebrew selfupdate` | ||
|
||
$ nodebrew help Show this message | ||
$ nodebrew install <version> Download and install a <version> (compile from source) | ||
$ nodebrew install-binary <version> Download and install a <version> (binary file) | ||
$ nodebrew uninstall <version> Uninstall a version | ||
$ nodebrew use <version> Use <version> | ||
$ nodebrew list List installed versions | ||
$ nodebrew ls Alias for `list` | ||
$ nodebrew ls-remote List remote versions | ||
$ nodebrew ls-all List remote and installed versions | ||
$ nodebrew alias <key> <version> Set alias to version | ||
$ nodebrew unalias <key> Remove alias | ||
$ nodebrew clean <version> | all Remove source file | ||
$ nodebrew selfupdate Update nodebrew | ||
$ nodebrew migrate-package <version> Install global NPM packages contained in <version> to current version | ||
$ nodebrew exec <version> -- <command> Execute <command> specified <version> | ||
Update nodebrew itself. | ||
|
||
```bash | ||
$ nodebrew selfupdate | ||
``` | ||
|
||
### `nodebrew exec <version>` | ||
|
||
Execute other version temporary. | ||
|
||
```bash | ||
$ nodebrew exec v0.10.29 -- node app.js | ||
``` | ||
|
||
## All commands | ||
|
||
```bash | ||
$ nodebrew help Show this message | ||
$ nodebrew install <version> Download and install <version> (compile from source) | ||
$ nodebrew install-binary <version> Download and install <version> (binary file) | ||
$ nodebrew uninstall <version> Uninstall <version> | ||
$ nodebrew use <version> Use <version> | ||
$ nodebrew list List installed versions | ||
$ nodebrew ls Alias for `list` | ||
$ nodebrew ls-remote List remote versions | ||
$ nodebrew ls-all List remote and installed versions | ||
$ nodebrew alias <key> <value> Set alias | ||
$ nodebrew unalias <key> Remove alias | ||
$ nodebrew clean <version> | all Remove source file | ||
$ nodebrew selfupdate Update nodebrew | ||
$ nodebrew migrate-package <version> Install global NPM packages contained in <version> to current version | ||
$ nodebrew exec <version> -- <command> Execute <command> using specified <version> | ||
``` | ||
|
||
## Development | ||
|
||
Install module for testing. | ||
Install dependencies for testing. | ||
|
||
$ carton install | ||
```bash | ||
$ carton install | ||
``` | ||
|
||
Run test. | ||
|
||
$ carton exec -- prove -lvr | ||
```bash | ||
$ carton exec -- prove -lvr | ||
``` | ||
|
||
## License | ||
|
||
MIT © [Kazuhito Hokamura](https://github.com/hokaccha) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters