Commit 5f24b288 authored by Jeremy Morrell's avatar Jeremy Morrell Committed by Jeremy Morrell

Switch iojs over to using nodebin

parent c1b8023c
...@@ -60,16 +60,18 @@ install_iojs() { ...@@ -60,16 +60,18 @@ install_iojs() {
local version="$1" local version="$1"
local dir="$2" local dir="$2"
if needs_resolution "$version"; then echo "Resolving iojs version ${version:-(latest stable)}..."
echo "Resolving iojs version ${version:-(latest stable)} via semver.io..." if ! read number url < <(curl --silent --get --retry 5 --retry-max-time 15 --data-urlencode "range=$version" "https://nodebin.herokai.com/v1/iojs/$platform/latest.txt"); then
version=$(curl --silent --get --retry 5 --retry-max-time 15 --data-urlencode "range=${version}" https://semver.herokuapp.com/iojs/resolve) echo "Unable to resolve; does that version exist?" && false
fi fi
echo "Downloading and installing iojs $version..." echo "Downloading and installing iojs $number..."
local download_url="https://iojs.org/dist/v$version/iojs-v$version-$os-$cpu.tar.gz" local code=$(curl "$url" --silent --fail --retry 5 --retry-max-time 15 -o /tmp/iojs.tar.gz --write-out "%{http_code}")
curl "$download_url" --silent --fail --retry 5 --retry-max-time 15 -o /tmp/node.tar.gz || (echo "Unable to download iojs $version; does it exist?" && false) if [ "$code" != "200" ]; then
tar xzf /tmp/node.tar.gz -C /tmp echo "Unable to download iojs: $code" && false
mv /tmp/iojs-v$version-$os-$cpu/* $dir fi
tar xzf /tmp/iojs.tar.gz -C /tmp
mv /tmp/iojs-v$number-$os-$cpu/* $dir
chmod +x $dir/bin/* chmod +x $dir/bin/*
} }
......
...@@ -343,8 +343,9 @@ testInvalidNode() { ...@@ -343,8 +343,9 @@ testInvalidNode() {
testInvalidIo() { testInvalidIo() {
compile "invalid-io" compile "invalid-io"
assertCaptured "Resolving iojs version 2.0.99"
assertCaptured "Downloading and installing iojs 2.0.99" assertCaptured "Downloading and installing iojs 2.0.99"
assertCaptured "Unable to download iojs 2.0.99" assertCaptured "Unable to resolve"
assertCapturedError assertCapturedError
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment