Compare commits

..

4 Commits

Author SHA1 Message Date
Jordan Harband
26ee4aafc0 v0.26.1 2015-08-22 20:54:31 -07:00
Jordan Harband
8746d63041 Ensure after node v4.0 is released, stable will simply refer to the latest node. 2015-08-22 09:45:49 -07:00
Jordan Harband
b7e2d7d24d Oops, the string passed to awk isn't the same as a shell command.
Fixes #808.
2015-08-16 18:08:50 -07:00
Jordan Harband
58ffa407c2 Prefixing more commands with command to bypass aliases.
Related to #805 and #804.
2015-08-15 23:56:32 -07:00
5 changed files with 64 additions and 22 deletions

View File

@@ -15,11 +15,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 -o- https://raw.githubusercontent.com/creationix/nvm/v0.26.0/install.sh | bash
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.26.1/install.sh | bash
or Wget:
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.26.0/install.sh | bash
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.26.1/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>
@@ -236,7 +236,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.26.0/install.sh
[2]: https://github.com/creationix/nvm/blob/v0.26.1/install.sh
[3]: https://travis-ci.org/creationix/nvm
[Urchin]: https://github.com/scraperwiki/urchin
[Fish]: http://fishshell.com

View File

@@ -13,7 +13,7 @@ if [ -z "$NVM_DIR" ]; then
fi
nvm_latest_version() {
echo "v0.26.0"
echo "v0.26.1"
}
#

34
nvm.sh
View File

@@ -24,7 +24,7 @@ nvm_get_latest() {
if nvm_has "curl"; then
NVM_LATEST_URL="$(curl -q -w "%{url_effective}\n" -L -s -S http://latest.nvm.sh -o /dev/null)"
elif nvm_has "wget"; then
NVM_LATEST_URL="$(wget http://latest.nvm.sh --server-response -O /dev/null 2>&1 | awk '/^ Location: /{DEST=$2} END{ print DEST }')"
NVM_LATEST_URL="$(wget http://latest.nvm.sh --server-response -O /dev/null 2>&1 | command awk '/^ Location: /{DEST=$2} END{ print DEST }')"
else
>&2 echo 'nvm needs curl or wget to proceed.'
return 1
@@ -33,7 +33,7 @@ nvm_get_latest() {
>&2 echo "http://latest.nvm.sh did not redirect to the latest release on Github"
return 2
else
echo "$NVM_LATEST_URL" | awk -F'/' '{print $NF}'
echo "$NVM_LATEST_URL" | command awk -F'/' '{print $NF}'
fi
}
@@ -238,7 +238,7 @@ nvm_version() {
PATTERN="stable"
;;
esac
VERSION="$(nvm_ls "$PATTERN" | tail -n1)"
VERSION="$(nvm_ls "$PATTERN" | command tail -n1)"
if [ -z "$VERSION" ] || [ "_$VERSION" = "_N/A" ]; then
echo "N/A"
return 3;
@@ -254,14 +254,14 @@ nvm_remote_version() {
if nvm_validate_implicit_alias "$PATTERN" 2> /dev/null ; then
case "_$PATTERN" in
"_$(nvm_iojs_prefix)")
VERSION="$(nvm_ls_remote_iojs | tail -n1)"
VERSION="$(nvm_ls_remote_iojs | command tail -n1)"
;;
*)
VERSION="$(nvm_ls_remote "$PATTERN")"
;;
esac
else
VERSION="$(nvm_remote_versions "$PATTERN" | tail -n1)"
VERSION="$(nvm_remote_versions "$PATTERN" | command tail -n1)"
fi
echo "$VERSION"
if [ "_$VERSION" = '_N/A' ]; then
@@ -441,7 +441,7 @@ nvm_resolve_alias() {
fi
if [ -n "$ALIAS_TEMP" ] \
&& printf "$SEEN_ALIASES" | command grep -e "^$ALIAS_TEMP$" > /dev/null; then
&& command printf "$SEEN_ALIASES" | command grep -e "^$ALIAS_TEMP$" > /dev/null; then
ALIAS="∞"
break
fi
@@ -665,7 +665,7 @@ nvm_ls_remote() {
local GREP_OPTIONS
GREP_OPTIONS=''
if nvm_validate_implicit_alias "$PATTERN" 2> /dev/null ; then
PATTERN="$(nvm_ls_remote "$(nvm_print_implicit_alias remote "$PATTERN")" | tail -n1)"
PATTERN="$(nvm_ls_remote "$(nvm_print_implicit_alias remote "$PATTERN")" | command tail -n1)"
elif [ -n "$PATTERN" ]; then
PATTERN="$(nvm_ensure_version_prefix "$PATTERN")"
else
@@ -674,7 +674,7 @@ nvm_ls_remote() {
VERSIONS=`nvm_download -L -s $NVM_NODEJS_ORG_MIRROR/ -o - \
| \egrep -o 'v[0-9]+\.[0-9]+\.[0-9]+' \
| command grep -w "${PATTERN}" \
| sort -t. -u -k 1.2,1n -k 2,2n -k 3,3n`
| command sort -t. -u -k 1.2,1n -k 2,2n -k 3,3n`
if [ -z "$VERSIONS" ]; then
echo "N/A"
return 3
@@ -757,7 +757,7 @@ nvm_print_versions() {
else
FORMAT='%15s'
fi
printf "$FORMAT\n" $VERSION
command printf "$FORMAT\n" $VERSION
done
}
@@ -814,7 +814,7 @@ nvm_print_implicit_alias() {
fi
local NVM_IOJS_VERSION
NVM_IOJS_VERSION="$($NVM_COMMAND | sed "s/^"$NVM_IMPLICIT"-//" | command grep -e '^v' | cut -c2- | cut -d . -f 1,2 | uniq | tail -1)"
NVM_IOJS_VERSION="$($NVM_COMMAND | sed "s/^"$NVM_IMPLICIT"-//" | command grep -e '^v' | command cut -c2- | command cut -d . -f 1,2 | uniq | command tail -1)"
local EXIT_CODE
EXIT_CODE="$?"
@@ -841,7 +841,7 @@ nvm_print_implicit_alias() {
setopt shwordsplit
fi
LAST_TWO=$($NVM_COMMAND | command grep -e '^v' | cut -c2- | cut -d . -f 1,2 | uniq)
LAST_TWO=$($NVM_COMMAND | command grep -e '^v' | command cut -c2- | command cut -d . -f 1,2 | uniq)
if [ $ZHS_HAS_SHWORDSPLIT_UNSET -eq 1 ] && nvm_has "unsetopt"; then
unsetopt shwordsplit
@@ -852,6 +852,7 @@ nvm_print_implicit_alias() {
local STABLE
local UNSTABLE
local MOD
local NORMALIZED_VERSION
ZHS_HAS_SHWORDSPLIT_UNSET=1
if nvm_has "setopt"; then
@@ -859,12 +860,17 @@ nvm_print_implicit_alias() {
setopt shwordsplit
fi
for MINOR in $LAST_TWO; do
MOD=$(expr "$(nvm_normalize_version "$MINOR")" \/ 1000000 \% 2)
NORMALIZED_VERSION="$(nvm_normalize_version "$MINOR")"
if [ "_0${NORMALIZED_VERSION#?}" != "_$NORMALIZED_VERSION" ]; then
STABLE="$MINOR"
else
MOD=$(expr "$NORMALIZED_VERSION" \/ 1000000 \% 2)
if [ $MOD -eq 0 ]; then
STABLE="$MINOR"
elif [ $MOD -eq 1 ]; then
UNSTABLE="$MINOR"
fi
fi
done
if [ $ZHS_HAS_SHWORDSPLIT_UNSET -eq 1 ] && nvm_has "unsetopt"; then
unsetopt shwordsplit
@@ -1693,7 +1699,7 @@ nvm() {
local NVM_OUTPUT
NVM_OUTPUT="$(echo "$NVM_LS_REMOTE_OUTPUT
$NVM_LS_REMOTE_IOJS_OUTPUT" | command grep -v "N/A" | sed '/^$/d')"
$NVM_LS_REMOTE_IOJS_OUTPUT" | command grep -v "N/A" | command sed '/^$/d')"
if [ -n "$NVM_OUTPUT" ]; then
nvm_print_versions "$NVM_OUTPUT"
return $NVM_LS_REMOTE_EXIT_CODE || $NVM_LS_REMOTE_IOJS_EXIT_CODE
@@ -1869,7 +1875,7 @@ $NVM_LS_REMOTE_IOJS_OUTPUT" | command grep -v "N/A" | sed '/^$/d')"
nvm_remote_version "$2"
;;
"--version" )
echo "0.26.0"
echo "0.26.1"
;;
"unload" )
unset -f nvm nvm_print_versions nvm_checksum \

View File

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

View File

@@ -8,6 +8,8 @@ cleanup() {
rm -rf ../../../v0.5.7
rm -rf ../../../v0.7.7
rm -rf ../../../versions/io.js/v0.98.0
rm -rf ../../../versions/node/v1.0.0
rm -rf ../../../versions/node/v1.1.0
unset -f nvm_ls_remote nvm_ls_remote_iojs
}
@@ -32,6 +34,17 @@ LATEST_UNSTABLE="$(nvm_print_implicit_alias local unstable)"
LATEST_IOJS="$(nvm_print_implicit_alias local iojs)"
[ "_$LATEST_IOJS" = "_iojs-v0.98" ] || die "local iojs is not latest iojs: expected iojs-v0.98, got $LATEST_IOJS"
## node post v1.0/io.js merger ##
mkdir -p ../../../versions/node/v1.0.0
mkdir -p ../../../versions/node/v1.1.0
LATEST_STABLE="$(nvm_print_implicit_alias local stable)"
[ "_$LATEST_STABLE" = "_1.1" ] || die "local stable when post-v1.0 exists is not latest: expected 1.1, got $LATEST_STABLE"
LATEST_UNSTABLE="$(nvm_print_implicit_alias local unstable)"
[ "_$LATEST_UNSTABLE" = "_0.7" ] || die "local unstable is not latest pre-v1.0 odd minor: expected 0.7, got $LATEST_UNSTABLE"
## ** ##
nvm_ls_remote() {
echo "v0.4.3"
echo "v0.5.4"
@@ -65,5 +78,28 @@ LATEST_UNSTABLE="$(nvm_print_implicit_alias remote unstable)"
LATEST_IOJS="$(nvm_print_implicit_alias remote iojs)"
[ "_$LATEST_IOJS" = "_iojs-v0.99" ] || die "remote iojs is not latest: expected iojs-v0.99, got $LATEST_IOJS"
## node post v1.0/io.js merger ##
nvm_ls_remote() {
echo "v0.4.3"
echo "v0.5.4"
echo "v0.6.6"
echo "v0.7.7"
echo "v0.9.7"
echo "v0.4.3"
echo "v0.5.4"
echo "v0.6.6"
echo "v0.7.7"
echo "v0.9.7"
echo "v1.0.0"
echo "v1.1.0"
}
LATEST_STABLE="$(nvm_print_implicit_alias remote stable)"
[ "_$LATEST_STABLE" = "_1.1" ] || die "remote stable when post-v1.0 exists is not latest: expected 1.1, got $LATEST_STABLE"
LATEST_UNSTABLE="$(nvm_print_implicit_alias remote unstable)"
[ "_$LATEST_UNSTABLE" = "_0.9" ] || die "remote unstable is not latest odd pre-v1.0 minor: expected 0.9, got $LATEST_UNSTABLE"
## ** ##
cleanup