Compare commits

...

9 Commits

Author SHA1 Message Date
Jordan Harband
a539cba11e v0.25.3 2015-05-22 15:18:46 -07:00
Jordan Harband
472ba5fc46 Make sure sourcing nvm.sh on shells that don't support source options doesn't exit nonzero.
Fixes #721
2015-05-22 00:15:43 -07:00
Jordan Harband
96c96ec714 v0.25.2 2015-05-19 14:05:43 -07:00
Jordan Harband
475b8bd6b4 Update semver 2015-05-17 21:12:03 -07:00
Jordan Harband
5e805905ca Add undocumented nvm debug to print out helpful debugging info. 2015-05-14 14:56:26 -07:00
Jordan Harband
2dec01da9c nvm reinstall-packages: On systems where npm ls -g --depth=0 does not include npm for some reason, make sure to filter out (empty). 2015-05-08 14:24:51 -07:00
Jordan Harband
63672641a5 Add wrapping curly braces to ensure that the entire scripts are downloaded.
If the closing curly brace isn't present, the script will error out.
2015-05-11 01:46:18 -07:00
Jordan Harband
94bba31de3 Make sure that nvm reinstall-packages system has the right std output. 2015-05-08 14:15:42 -07:00
Jordan Harband
f70530ef18 Fix installation instructions. 2015-05-07 10:43:47 -07:00
5 changed files with 41 additions and 10 deletions

View File

@@ -16,11 +16,11 @@ Note: `nvm` does not support [Fish] either (see [#303](https://github.com/creati
To install you could use the [install script][2] using cURL:
curl https://raw.githubusercontent.com/creationix/nvm/v0.25.1/install.sh | bash
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.25.3/install.sh | bash
or Wget:
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.25.1/install.sh | bash
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.25.3/install.sh | bash
<sub>The script clones the nvm repository to `~/.nvm` and adds the source line to your profile (`~/.bash_profile`, `~/.zshrc` or `~/.profile`).</sub>
@@ -220,7 +220,7 @@ After the v0.8.6 release of node, nvm tries to install from binary packages. But
nvm install -s 0.8.6
[1]: https://github.com/creationix/nvm.git
[2]: https://github.com/creationix/nvm/blob/v0.25.1/install.sh
[2]: https://github.com/creationix/nvm/blob/v0.25.3/install.sh
[3]: https://travis-ci.org/creationix/nvm
[Urchin]: https://github.com/scraperwiki/urchin
[Fish]: http://fishshell.com

View File

@@ -2,6 +2,8 @@
set -e
{ # this ensures the entire script is downloaded #
nvm_has() {
type "$1" > /dev/null 2>&1
}
@@ -11,7 +13,7 @@ if [ -z "$NVM_DIR" ]; then
fi
nvm_latest_version() {
echo "v0.25.1"
echo "v0.25.3"
}
#
@@ -241,3 +243,5 @@ nvm_reset() {
}
[ "_$NVM_ENV" = "_testing" ] || nvm_do_install
} # this ensures the entire script is downloaded #

24
nvm.sh
View File

@@ -6,6 +6,8 @@
# Implemented by Tim Caswell <tim@creationix.com>
# with much bash help from Matthew Ranney
{ # this ensures the entire script is downloaded #
NVM_SCRIPT_SOURCE="$_"
nvm_has() {
@@ -1139,6 +1141,17 @@ nvm() {
echo
;;
"debug" )
echo >&2 "\$SHELL: $SHELL"
echo >&2 "\$NVM_DIR: $(echo $NVM_DIR | sed "s#$HOME#\$HOME#g")"
for NVM_DEBUG_COMMAND in 'nvm current' 'which node' 'which iojs' 'which npm' 'npm config get prefix' 'npm root -g'
do
local NVM_DEBUG_OUTPUT="$($NVM_DEBUG_COMMAND | sed "s#$NVM_DIR#\$NVM_DIR#g")"
echo >&2 "$NVM_DEBUG_COMMAND: ${NVM_DEBUG_OUTPUT}"
done
return 42
;;
"install" | "i" )
local nobinary
local version_not_provided
@@ -1712,20 +1725,21 @@ $NVM_LS_REMOTE_IOJS_OUTPUT" | command grep -v "N/A" | sed '/^$/d')"
fi
local NPMLIST
local VERSION
if [ "_$PROVIDED_VERSION" = "_system" ]; then
if ! nvm_has_system_node && ! nvm_has_system_iojs; then
echo 'No system version of node or io.js detected.' >&2
return 3
fi
VERSION="system"
NPMLIST=$(nvm deactivate > /dev/null && npm list -g --depth=0 | command tail -n +2)
else
local VERSION
VERSION="$(nvm_version "$PROVIDED_VERSION")"
NPMLIST=$(nvm use "$VERSION" > /dev/null && npm list -g --depth=0 | command tail -n +2)
fi
local INSTALLS
INSTALLS=$(echo "$NPMLIST" | command sed -e '/ -> / d' -e 's/^.* \(.*\)@.*/\1/' -e '/^npm$/ d' | command xargs)
INSTALLS=$(echo "$NPMLIST" | command sed -e '/ -> / d' -e '/\(empty\)/ d' -e 's/^.* \(.*\)@.*/\1/' -e '/^npm$/ d' | command xargs)
echo "Copying global packages from $VERSION..."
echo "$INSTALLS" | command xargs npm install -g --quiet
@@ -1746,7 +1760,7 @@ $NVM_LS_REMOTE_IOJS_OUTPUT" | command grep -v "N/A" | sed '/^$/d')"
nvm_version $2
;;
"--version" )
echo "0.25.1"
echo "0.25.3"
;;
"unload" )
unset -f nvm nvm_print_versions nvm_checksum \
@@ -1770,7 +1784,7 @@ nvm_supports_source_options() {
[ "_$(echo 'echo $1' | . /dev/stdin yes 2> /dev/null)" = "_yes" ]
}
VERSION="$(nvm_alias default 2>/dev/null)"
VERSION="$(nvm_alias default 2>/dev/null || echo)"
if nvm_supports_source_options && [ "_$1" = "_--install" ]; then
if [ -n "$VERSION" ]; then
nvm install "$VERSION" >/dev/null
@@ -1782,3 +1796,5 @@ elif [ -n "$VERSION" ]; then
elif nvm_rc_version >/dev/null 2>&1; then
nvm use >/dev/null
fi
} # this ensures the entire script is downloaded #

View File

@@ -1,6 +1,6 @@
{
"name": "nvm",
"version": "0.25.1",
"version": "0.25.3",
"description": "Node Version Manager - Simple bash script to manage multiple active node.js versions",
"directories": {
"test": "test"
@@ -31,7 +31,7 @@
"homepage": "https://github.com/creationix/nvm",
"devDependencies": {
"replace": "^0.3.0",
"semver": "^4.3.3",
"semver": "^4.3.4",
"urchin": "^0.0.5"
}
}

View File

@@ -0,0 +1,11 @@
#!/bin/sh
die () { echo $@ ; exit 1; }
touch ../../alias/default
rm ../../alias/default || die 'removal of default alias failed'
nvm_alias default && die '"nvm_alias default" did not fail'
set -e # necessary to fail internally with a nonzero code
. ../../nvm.sh || die 'sourcing returned nonzero exit code'