Compare commits

...

18 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
7 changed files with 50 additions and 30 deletions

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)
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
- [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
@@ -30,24 +30,29 @@ Note: On OS X, if you have/had a "system" node installed and want to install mod
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_update` to update.
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
To install or update nvm, you can use the [install script][2] using cURL:
```sh
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.3/install.sh | bash
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.4/install.sh | bash
```
or Wget:
```sh
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.31.3/install.sh | bash
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>
```sh
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.
@@ -76,16 +81,18 @@ 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`.
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+):
1. clone this repo
1. check out the latest version
1. activate nvm by sourcing it from your shell
```sh
git clone https://github.com/creationix/nvm.git ~/.nvm && cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`
```
To activate nvm, you need to source it from your shell:
```sh
. ~/.nvm/nvm.sh
export NVM_DIR="$HOME/.nvm" && (
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:
@@ -98,16 +105,19 @@ export NVM_DIR="$HOME/.nvm"
### 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+):
1. change to the `$NVM_DIR`
1. pull down the latest changes
1. check out the latest version
1. activate the new version
```sh
cd "$NVM_DIR" && git fetch origin && git checkout `git describe --abbrev=0 --tags`
```
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
@@ -394,7 +404,7 @@ If installing nvm on Alpine Linux *is* still what you want or need to do, you sh
```sh
apk add bash
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.31.3/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.
@@ -425,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))
[1]: https://github.com/creationix/nvm.git
[2]: https://github.com/creationix/nvm/blob/v0.31.3/install.sh
[2]: https://github.com/creationix/nvm/blob/v0.31.4/install.sh
[3]: https://travis-ci.org/creationix/nvm
[Urchin]: https://github.com/scraperwiki/urchin
[Fish]: http://fishshell.com

View File

@@ -11,7 +11,7 @@ nvm_install_dir() {
}
nvm_latest_version() {
echo "v0.31.3"
echo "v0.31.4"
}
#
@@ -40,7 +40,7 @@ nvm_source() {
echo "$NVM_SOURCE_URL"
}
#
#
# Node.js version to install
#
nvm_node_version() {
@@ -103,7 +103,6 @@ nvm_install_node() {
NODE_VERSION="$(nvm_node_version)"
if [ -z "$NODE_VERSION" ]; then
echo "=> You can now install Node.js by running \`nvm install\`"
return 0
fi
@@ -290,14 +289,17 @@ nvm_do_install() {
fi
fi
# Sourcing $PROFILE to take into account the new environment
. "$NVM_PROFILE"
# Source nvm
. "$NVM_DIR/nvm.sh"
nvm_check_global_modules
nvm_install_node
nvm_reset
echo "=> Close and reopen your terminal to start using nvm or run the following to use it now:"
printf "$SOURCE_STR"
}
#

6
nvm.sh
View File

@@ -814,7 +814,7 @@ nvm_ls() {
SEARCH_PATTERN="$(echo "${PATTERN}" | sed "s#\.#\\\.#g;")"
fi
if [ -n "$NVM_DIRS_TO_SEARCH1$NVM_DIRS_TO_SEARCH2$NVM_DIRS_TO_SEARCH3" ]; then
VERSIONS="$(command find "$NVM_DIRS_TO_SEARCH1"/* "$NVM_DIRS_TO_SEARCH2"/* "$NVM_DIRS_TO_SEARCH3"/* -name . -o -type d -prune -o -name "$PATTERN*" \
VERSIONS="$(command find "$NVM_DIRS_TO_SEARCH1"/* "$NVM_DIRS_TO_SEARCH2"/* "$NVM_DIRS_TO_SEARCH3"/* -name . -o -type d -prune -o -path "$PATTERN*" \
| command sed "
s#${NVM_VERSION_DIR_IOJS}/#versions/${NVM_IOJS_PREFIX}/#;
s#^${NVM_DIR}/##;
@@ -1235,6 +1235,8 @@ nvm_get_arch() {
EXIT_CODE=$?
if [ $EXIT_CODE -ne 0 ]; then
HOST_ARCH=$(isainfo -n)
else
HOST_ARCH=$(echo "$HOST_ARCH" | tail -1)
fi
else
HOST_ARCH="$(command uname -m)"
@@ -2764,7 +2766,7 @@ $NVM_LS_REMOTE_POST_MERGED_OUTPUT" | nvm_grep -v "N/A" | command sed '/^$/d')"
NVM_VERSION_ONLY=true NVM_LTS="${NVM_LTS-}" nvm_remote_version "${PATTERN:-node}"
;;
"--version" )
nvm_echo '0.31.3'
nvm_echo '0.31.4'
;;
"unload" )
unset -f nvm nvm_print_versions nvm_checksum \

View File

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

View File

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

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"

1
test/mocks/pkg_info_fail Executable file
View File

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