Skip to content

Commit

Permalink
let us all join the io.js revolution!
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
edef1c authored and isaacs committed Jan 15, 2015
1 parent 29a7c04 commit e0b9a96
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions nave.sh
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ nave_fetch () {

local url
local urls=(
"https://iojs.org/dist/v$version/iojs-v$version.tar.gz"
"http://nodejs.org/dist/v$version/node-v$version.tar.gz"
"http://nodejs.org/dist/node-v$version.tar.gz"
"http://nodejs.org/dist/node-$version.tar.gz"
Expand Down Expand Up @@ -255,25 +256,27 @@ build () {
esac
if [ $binavail -eq 1 ]; then
local t="$version-$os-$arch"
local url="http://nodejs.org/dist/v$version/node-v${t}.tar.gz"
local tgz="$NAVE_SRC/$t.tgz"
get -#Lf "$url" > "$tgz"
if [ $? -ne 0 ]; then
# binary download failed. oh well. cleanup, and proceed.
rm "$tgz"
echo "Binary download failed, trying source." >&2
else
# unpack straight into the build target.
$tar xzf "$tgz" -C "$2" --strip-components 1
for url in "https://iojs.org/dist/v$version/iojs-v${t}.tar.gz" \
"http://nodejs.org/dist/v$version/node-v${t}.tar.gz"; do
get -#Lf "$url" > "$tgz"
if [ $? -ne 0 ]; then
# binary download failed. oh well. cleanup, and proceed.
rm "$tgz"
nave_uninstall "$version"
echo "Binary unpack failed, trying source." >&2
else
# unpack straight into the build target.
$tar xzf "$tgz" -C "$2" --strip-components 1
if [ $? -ne 0 ]; then
rm "$tgz"
nave_uninstall "$version"
echo "Binary unpack failed, trying source." >&2
fi
# it worked!
echo "installed from binary" >&2
return 0
fi
# it worked!
echo "installed from binary" >&2
return 0
fi
done
echo "Binary download failed, trying source." >&2
fi
fi

Expand Down Expand Up @@ -404,14 +407,15 @@ ver () {
nave_version_family () {
local family="$1"
family="${family/v/}"
get -s http://nodejs.org/dist/ \
{ get -s http://nodejs.org/dist/;
get -s https://iojs.org/dist/; } \
| egrep -o $family'\.[0-9]+' \
| sort -u -k 1,1n -k 2,2n -k 3,3n -t . \
| tail -n1
}

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

4 comments on commit e0b9a96

@stefanpenner
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yay!

@thlorenz
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to use 0.12 when I supply stable.
Is this intended? Isn't io.js stable enough?
On the other hand when I do latest it pulls io.js 1.2.

Misleading though since usually latest is some sort of nightly build -- at least not considered stable.

@ljharb
Copy link

@ljharb ljharb commented on e0b9a96 Feb 19, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thlorenz "stable" and "unstable" apply to node, since io.js doesn't communicate stability or instability through version numbers. http://nvm.sh follows the same convention.

@thlorenz
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, not sure if that makes sense, but so be it.
Whatever is released on io.js is considered stable though.

Please sign in to comment.