Skip to content

Commit e0b9a96

Browse files
edef1cisaacs
authored andcommitted
let us all join the io.js revolution!
fixes #64. when a given version is requested, https://iojs.org/dist and http://nodejs.org/dist are checked for that version, in that order. `latest` always refers to io.js, because checking for node 1.0 is a bit of a waste of user time. `stable` always refers to node.js, because there is no stable release of io.js yet, and we have no way of determining that programmatically yet anyway, pending nodejs/build#22. the two-repository fallback hackery can also disappear once nodejs/node#420 is fixed.
1 parent 29a7c04 commit e0b9a96

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

nave.sh

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ nave_fetch () {
215215

216216
local url
217217
local urls=(
218+
"https://iojs.org/dist/v$version/iojs-v$version.tar.gz"
218219
"http://nodejs.org/dist/v$version/node-v$version.tar.gz"
219220
"http://nodejs.org/dist/node-v$version.tar.gz"
220221
"http://nodejs.org/dist/node-$version.tar.gz"
@@ -255,25 +256,27 @@ build () {
255256
esac
256257
if [ $binavail -eq 1 ]; then
257258
local t="$version-$os-$arch"
258-
local url="http://nodejs.org/dist/v$version/node-v${t}.tar.gz"
259259
local tgz="$NAVE_SRC/$t.tgz"
260-
get -#Lf "$url" > "$tgz"
261-
if [ $? -ne 0 ]; then
262-
# binary download failed. oh well. cleanup, and proceed.
263-
rm "$tgz"
264-
echo "Binary download failed, trying source." >&2
265-
else
266-
# unpack straight into the build target.
267-
$tar xzf "$tgz" -C "$2" --strip-components 1
260+
for url in "https://iojs.org/dist/v$version/iojs-v${t}.tar.gz" \
261+
"http://nodejs.org/dist/v$version/node-v${t}.tar.gz"; do
262+
get -#Lf "$url" > "$tgz"
268263
if [ $? -ne 0 ]; then
264+
# binary download failed. oh well. cleanup, and proceed.
269265
rm "$tgz"
270-
nave_uninstall "$version"
271-
echo "Binary unpack failed, trying source." >&2
266+
else
267+
# unpack straight into the build target.
268+
$tar xzf "$tgz" -C "$2" --strip-components 1
269+
if [ $? -ne 0 ]; then
270+
rm "$tgz"
271+
nave_uninstall "$version"
272+
echo "Binary unpack failed, trying source." >&2
273+
fi
274+
# it worked!
275+
echo "installed from binary" >&2
276+
return 0
272277
fi
273-
# it worked!
274-
echo "installed from binary" >&2
275-
return 0
276-
fi
278+
done
279+
echo "Binary download failed, trying source." >&2
277280
fi
278281
fi
279282

@@ -404,14 +407,15 @@ ver () {
404407
nave_version_family () {
405408
local family="$1"
406409
family="${family/v/}"
407-
get -s http://nodejs.org/dist/ \
410+
{ get -s http://nodejs.org/dist/;
411+
get -s https://iojs.org/dist/; } \
408412
| egrep -o $family'\.[0-9]+' \
409413
| sort -u -k 1,1n -k 2,2n -k 3,3n -t . \
410414
| tail -n1
411415
}
412416

413417
nave_latest () {
414-
get -s http://nodejs.org/dist/ \
418+
get -s https://iojs.org/dist/ \
415419
| egrep -o '[0-9]+\.[0-9]+\.[0-9]+' \
416420
| sort -u -k 1,1n -k 2,2n -k 3,3n -t . \
417421
| tail -n1

0 commit comments

Comments
 (0)