Compare commits

...

6 Commits

Author SHA1 Message Date
Jordan Harband
ec33e8b720 v0.25.1 2015-05-03 15:31:54 -07:00
Jordan Harband
a4f89c6223 Make sure to ignore ~/.curlrc if it exists. 2015-05-01 02:00:49 -07:00
Jordan Harband
517817f1a3 Actually try to install from source when the error message says "binary failed, trying source". 2015-04-27 14:02:45 -07:00
Jordan Harband
a6f5eff0f3 Use uname -m instead of uname -a.
Fixes #744.
2015-04-28 22:56:43 -07:00
Jordan Harband
0aac462b15 Improve the error message when the binary tarball URL 404s.
Fixes #743
2015-04-27 13:48:22 -07:00
Jordan Harband
bb2fe618cb The install script only runs in bash. 2015-04-27 16:55:21 -07:00
7 changed files with 47 additions and 34 deletions

View File

@@ -10,11 +10,7 @@ install:
script:
- NVM_DIR=$TRAVIS_BUILD_DIR make TEST_SUITE=$TEST_SUITE URCHIN=/tmp/urchin/package/urchin test-$SHELL
env:
- SHELL=sh TEST_SUITE=install_script
- SHELL=dash TEST_SUITE=install_script
- SHELL=bash TEST_SUITE=install_script
- SHELL=zsh TEST_SUITE=install_script
# - SHELL=ksh TEST_SUITE=install_script
- SHELL=sh TEST_SUITE=fast
- SHELL=dash TEST_SUITE=fast
- SHELL=bash TEST_SUITE=fast

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.0/install.sh | bash
curl https://raw.githubusercontent.com/creationix/nvm/v0.25.1/install.sh | bash
or Wget:
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.25.0/install.sh | bash
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.25.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>
@@ -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.0/install.sh
[2]: https://github.com/creationix/nvm/blob/v0.25.1/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 @@ if [ -z "$NVM_DIR" ]; then
fi
nvm_latest_version() {
echo "v0.25.0"
echo "v0.25.1"
}
#
@@ -42,7 +42,7 @@ nvm_source() {
nvm_download() {
if nvm_has "curl"; then
curl $*
curl -q $*
elif nvm_has "wget"; then
# Emulate curl with wget
ARGS=$(echo "$*" | command sed -e 's/--progress-bar /--progress=bar /' \

45
nvm.sh
View File

@@ -20,7 +20,7 @@ nvm_is_alias() {
nvm_get_latest() {
local NVM_LATEST_URL
if nvm_has "curl"; then
NVM_LATEST_URL="$(curl -w "%{url_effective}\n" -L -s -S http://latest.nvm.sh -o /dev/null)"
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 }')"
else
@@ -37,7 +37,7 @@ nvm_get_latest() {
nvm_download() {
if nvm_has "curl"; then
curl $*
curl -q $*
elif nvm_has "wget"; then
# Emulate curl with wget
ARGS=$(echo "$*" | command sed -e 's/--progress-bar /--progress=bar /' \
@@ -870,12 +870,12 @@ nvm_get_os() {
nvm_get_arch() {
local NVM_UNAME
NVM_UNAME="$(uname -a)"
NVM_UNAME="$(uname -m)"
local NVM_ARCH
case "$NVM_UNAME" in
*x86_64*) NVM_ARCH=x64 ;;
*i*86*) NVM_ARCH=x86 ;;
*) NVM_ARCH="$(uname -m)" ;;
x86_64) NVM_ARCH="x64" ;;
i*86) NVM_ARCH="x86" ;;
*) NVM_ARCH="$NVM_UNAME" ;;
esac
echo "$NVM_ARCH"
}
@@ -929,9 +929,16 @@ nvm_install_iojs_binary() {
tmpdir="$NVM_DIR/bin/iojs-${t}"
local tmptarball
tmptarball="$tmpdir/iojs-${t}.tar.gz"
if (
local NVM_INSTALL_ERRORED
command mkdir -p "$tmpdir" && \
nvm_download -L -C - --progress-bar $url -o "$tmptarball" && \
nvm_download -L -C - --progress-bar $url -o "$tmptarball" || \
NVM_INSTALL_ERRORED=true
if grep '404 Not Found' "$tmptarball" >/dev/null; then
NVM_INSTALL_ERRORED=true
echo >&2 "HTTP 404 at URL $url";
fi
if (
[ "$NVM_INSTALL_ERRORED" != true ] && \
echo "WARNING: checksums are currently disabled for io.js" >&2 && \
# nvm_checksum "$tmptarball" $sum && \
command tar -xzf "$tmptarball" -C "$tmpdir" --strip-components 1 && \
@@ -941,7 +948,7 @@ nvm_install_iojs_binary() {
); then
return 0
else
echo "Binary download failed, trying source." >&2
echo >&2 "Binary download failed, trying source." >&2
command rm -rf "$tmptarball" "$tmpdir"
return 1
fi
@@ -983,9 +990,16 @@ nvm_install_node_binary() {
tmpdir="$NVM_DIR/bin/node-${t}"
local tmptarball
tmptarball="$tmpdir/node-${t}.tar.gz"
if (
local NVM_INSTALL_ERRORED
command mkdir -p "$tmpdir" && \
nvm_download -L -C - --progress-bar $url -o "$tmptarball" && \
nvm_download -L -C - --progress-bar $url -o "$tmptarball" || \
NVM_INSTALL_ERRORED=true
if grep '404 Not Found' "$tmptarball" >/dev/null; then
NVM_INSTALL_ERRORED=true
echo >&2 "HTTP 404 at URL $url";
fi
if (
[ "$NVM_INSTALL_ERRORED" != true ] && \
nvm_checksum "$tmptarball" $sum && \
command tar -xzf "$tmptarball" -C "$tmpdir" --strip-components 1 && \
command rm -f "$tmptarball" && \
@@ -994,7 +1008,7 @@ nvm_install_node_binary() {
); then
return 0
else
echo "Binary download failed, trying source." >&2
echo >&2 "Binary download failed, trying source."
command rm -rf "$tmptarball" "$tmpdir"
return 1
fi
@@ -1233,13 +1247,16 @@ nvm() {
elif [ "$NVM_IOJS" != true ] && nvm_install_node_binary "$VERSION" "$REINSTALL_PACKAGES_FROM"; then
NVM_INSTALL_SUCCESS=true
fi
elif [ "$NVM_IOJS" = true ]; then
fi
if [ "$NVM_INSTALL_SUCCESS" != true ]; then
if [ "$NVM_IOJS" = true ]; then
# nvm_install_iojs_source "$VERSION" "$ADDITIONAL_PARAMETERS"
echo "Installing iojs from source is not currently supported" >&2
return 105
elif nvm_install_node_source "$VERSION" "$ADDITIONAL_PARAMETERS"; then
NVM_INSTALL_SUCCESS=true
fi
fi
if [ "$NVM_INSTALL_SUCCESS" = true ] && nvm use "$VERSION"; then
if [ ! -z "$REINSTALL_PACKAGES_FROM" ] \
@@ -1729,7 +1746,7 @@ $NVM_LS_REMOTE_IOJS_OUTPUT" | command grep -v "N/A" | sed '/^$/d')"
nvm_version $2
;;
"--version" )
echo "0.25.0"
echo "0.25.1"
;;
"unload" )
unset -f nvm nvm_print_versions nvm_checksum \

View File

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

View File

@@ -15,7 +15,7 @@ safe_type() {
safe_type nvm_reset || die 'nvm_reset is not available'
# Apply nvm_reset
nvm_reset
nvm_reset || die 'nvm_reset failed'
# The names should be unset
! safe_type nvm_do_install || die 'nvm_do_install is still available'

View File

@@ -10,12 +10,12 @@ cleanup() {
EXPECTED_VERSION="v12.3.456"
URL="https://github.com/creationix/nvm/releases/tag/$EXPECTED_VERSION"
EXPECTED_CURL_ARGS="-w %{url_effective}\n -L -s -S http://latest.nvm.sh -o /dev/null"
EXPECTED_CURL_ARGS="-q -w %{url_effective}\n -L -s -S http://latest.nvm.sh -o /dev/null"
EXPECTED_WGET_ARGS="http://latest.nvm.sh --server-response -O /dev/null"
curl() {
if [ "_$*" != "_$EXPECTED_CURL_ARGS" ]; then
echo 2>& "expected args ($EXPECTED_CURL_ARGS), got ($*)"
echo >&2 "expected args ($EXPECTED_CURL_ARGS), got ($*)"
return 1
else
echo $URL
@@ -23,7 +23,7 @@ curl() {
}
wget() {
if [ "_$*" != "_$EXPECTED_WGET_ARGS" ]; then
echo 2>& "expected args ($EXPECTED_WGET_ARGS), got ($*)"
echo >&2 "expected args ($EXPECTED_WGET_ARGS), got ($*)"
return 1
else
local WGET_CONTENTS
@@ -100,7 +100,7 @@ Saving to: /dev/null
"
"$WGET_CONTENTS" | while read line
do
2>& echo "$line"
>&2 echo "$line"
done
fi
}