[Docs] [Tests] Add escape sequences; add test for aliased `.`

Yannick Ihmels 2018-01-13 21:25:30 +01:00 committed by Jordan Harband
parent d34bb3247d
commit 7ca8acc98d
No known key found for this signature in database
GPG Key ID: 64A196AEE0916D55
2 changed files with 28 additions and 5 deletions

View File

@ -54,7 +54,7 @@ wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh |
```sh ```sh
export NVM_DIR="$HOME/.nvm" export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads 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. You can customize the install source, directory, profile, and version using the `NVM_SOURCE`, `NVM_DIR`, `PROFILE`, and `NODE_VERSION` variables.
@ -148,7 +148,7 @@ export NVM_DIR="$HOME/.nvm" && (
git clone https://github.com/creationix/nvm.git "$NVM_DIR" git clone https://github.com/creationix/nvm.git "$NVM_DIR"
cd "$NVM_DIR" cd "$NVM_DIR"
git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" origin` git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" origin`
) && . "$NVM_DIR/nvm.sh" ) && \. "$NVM_DIR/nvm.sh"
``` ```
Now add these lines to your `~/.bashrc`, `~/.profile`, or `~/.zshrc` file to have it automatically sourced upon login: Now add these lines to your `~/.bashrc`, `~/.profile`, or `~/.zshrc` file to have it automatically sourced upon login:
@ -156,7 +156,7 @@ Now add these lines to your `~/.bashrc`, `~/.profile`, or `~/.zshrc` file to hav
```sh ```sh
export NVM_DIR="$HOME/.nvm" export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
``` ```
### Manual upgrade ### Manual upgrade
@ -173,7 +173,7 @@ For manual upgrade with `git` (requires git v1.7.10+):
cd "$NVM_DIR" cd "$NVM_DIR"
git fetch origin git fetch origin
git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" origin` git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" origin`
) && . "$NVM_DIR/nvm.sh" ) && \. "$NVM_DIR/nvm.sh"
``` ```
## Usage ## Usage
@ -426,7 +426,7 @@ 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 ```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`).

View File

@ -0,0 +1,23 @@
#!/bin/sh
setup () {
shopt -s expand_aliases
alias .=':'
NVM_ENV=testing \. ../../install.sh > /dev/null
}
cleanup () {
unset -f setup cleanup die
unalias .
shopt -u expand_aliases
}
die () { echo "$@"; exit 1; }
setup
nvm_do_install > /dev/null 2>&1
command -v nvm || die 'nvm could not be loaded'
cleanup