Commit 9ec30558 authored by Jeremy Morrell's avatar Jeremy Morrell Committed by GitHub

Switch nodejs install over to using nodebin service (#451)

Switch nodejs install over to using nodebin
parent c0ecab66
......@@ -39,20 +39,19 @@ install_nodejs() {
local version=${1:-6.x}
local dir="$2"
if needs_resolution "$version"; then
echo "Resolving node version $version via semver.io..."
local version=$(curl --silent --get --retry 5 --retry-max-time 15 --data-urlencode "range=${version}" https://semver.herokuapp.com/node/resolve)
echo "Resolving node version $version..."
if ! read number url < <(curl --silent --get --retry 5 --retry-max-time 15 --data-urlencode "range=$version" "https://nodebin.herokai.com/v1/node/$platform/latest.txt"); then
echo "Unable to resolve; does that version exist?" && false
fi
echo "Downloading and installing node $version..."
local download_url="https://s3pository.heroku.com/node/v$version/node-v$version-$os-$cpu.tar.gz"
local code=$(curl "$download_url" --silent --fail --retry 5 --retry-max-time 15 -o /tmp/node.tar.gz --write-out "%{http_code}")
echo "Downloading and installing node $number..."
local code=$(curl "$url" -L --silent --fail --retry 5 --retry-max-time 15 -o /tmp/node.tar.gz --write-out "%{http_code}")
if [ "$code" != "200" ]; then
echo "Unable to download node $version; does it exist?" && false
echo "Unable to download node: $code" && false
fi
tar xzf /tmp/node.tar.gz -C /tmp
rm -rf $dir/*
mv /tmp/node-v$version-$os-$cpu/* $dir
mv /tmp/node-v$number-$os-$cpu/* $dir
chmod +x $dir/bin/*
}
......
......@@ -4,7 +4,7 @@
testNoVersion() {
compile "no-version"
assertCaptured "engines.node (package.json): unspecified"
assertCaptured "Resolving node version 6.x via semver.io"
assertCaptured "Resolving node version 6.x"
assertCaptured "Downloading and installing node 6."
assertCapturedSuccess
}
......@@ -344,8 +344,8 @@ testConcurrencyCustomLimit() {
testInvalidNode() {
compile "invalid-node"
assertCaptured "Downloading and installing node 0.11.333"
assertCaptured "Unable to download node 0.11.333"
assertCaptured "Resolving node version 0.11.333"
assertCaptured "Unable to resolve"
assertCapturedError
}
......@@ -405,7 +405,7 @@ testIoJs() {
testSpecificVersion() {
compile "specific-version"
assertNotCaptured "Resolving node version"
assertCaptured "Resolving node version"
assertCaptured "Downloading and installing node 0.10.29"
assertCaptured "Using default npm version: 1.4.14"
assertCapturedSuccess
......@@ -420,7 +420,7 @@ testStableVersion() {
testUnstableVersion() {
compile "unstable-version"
assertCaptured "Resolving node version 0.11.x via semver.io"
assertCaptured "Resolving node version 0.11.x"
assertCaptured "Downloading and installing node 0.11."
assertCapturedSuccess
}
......@@ -490,7 +490,7 @@ testInfoEmpty() {
testDangerousRangeStar() {
compile "dangerous-range-star"
assertCaptured "Dangerous semver range"
assertCaptured "Resolving node version * via semver.io"
assertCaptured "Resolving node version *"
assertCaptured "Downloading and installing node 8."
assertCapturedError
}
......@@ -498,14 +498,14 @@ testDangerousRangeStar() {
testDangerousRangeGreaterThan() {
compile "dangerous-range-greater-than"
assertCaptured "Dangerous semver range"
assertCaptured "Resolving node version >0.4 via semver.io"
assertCaptured "Resolving node version >0.4"
assertCaptured "Downloading and installing node 8."
assertCapturedError
}
testRangeWithSpace() {
compile "range-with-space"
assertCaptured "Resolving node version >= 0.8.x via semver.io"
assertCaptured "Resolving node version >= 0.8.x"
assertCaptured "Downloading and installing node 8."
assertCapturedSuccess
}
......
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