Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

resolve version with one dot #138

Merged
merged 1 commit into from

2 participants

@jeromedecoster

This enhancement allow to use single dot version like 0.8 or 0.10

If the script detect it is a single dot version, it will resolve it to find the higher version available, so here 0.8.25 and 0.10.12

It use the same logic as display_remote_versions, so it's 0.8.6 minimum

It allows to quickly switch/install to the latest version of a "branch"

@tj tj merged commit 76de515 into tj:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 9, 2013
  1. @jeromedecoster
This page is out of date. Refresh to see the latest.
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)
Something went wrong with that request. Please try again.