Skip to content

Commit

Permalink
Merge pull request tj#138 from jeromedecoster/resolve-version-with-on…
Browse files Browse the repository at this point in the history
…e-dot

resolve version with one dot
  • Loading branch information
tj committed Jul 9, 2013
2 parents ef91436 + c41dfd9 commit 76de515
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions bin/n
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,20 @@ activate_previous() {

install_node() {
local version=${1#v}

local dots=`echo $version | sed 's/[^.]*//g'`
if test ${#dots} -eq 1; then
version=`$GET 2> /dev/null http://nodejs.org/dist/ \
| egrep -o '[0-9]+\.[0-9]+\.[0-9]+' \
| egrep -v '^0\.[0-7]\.' \
| egrep -v '^0\.8\.[0-5]$' \
| sort -u -k 1,1n -k 2,2n -k 3,3n -t . \
| egrep ^$version \
| tail -n1`

test $version || abort "invalid version ${1#v}"
fi

local config=$@
local dir=$VERSIONS_DIR/$version
local url=$(tarball_url $version)
Expand Down

0 comments on commit 76de515

Please sign in to comment.