Permalink
Browse files

resolve version with one dot

  • Loading branch information...
1 parent 7f84472 commit c41dfd94ddc040115880a192fc34f1c9ca3040f1 @jeromedecoster jeromedecoster committed Jul 9, 2013
Showing with 14 additions and 0 deletions.
  1. +14 −0 bin/n
View
14 bin/n
@@ -267,6 +267,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)

0 comments on commit c41dfd9

Please sign in to comment.