Skip to content

Commit

Permalink
Merge pull request #269 from tedgaydos/issue-230
Browse files Browse the repository at this point in the history
Fix for issue #230
  • Loading branch information
tjwebb committed Jul 13, 2015
2 parents 176944d + 17fc12f commit beed0dd
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
2 changes: 0 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,11 @@ with flags:
(iojs):

n io latest Install or activate the latest iojs release
n io stable Install or activate the latest stable iojs release
n io <version> Install iojs <version>
n io use <version> [args ...] Execute iojs <version> with [args ...]
n io bin <version> Output bin path for <version>
n io rm <version ...> Remove the given version(s)
n io --latest Output the latest iojs version available
n io --stable Output the latest stable iojs version available
n io ls Output the versions of iojs available

Options:
Expand Down
32 changes: 28 additions & 4 deletions bin/n
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,11 @@ display_help() {
(iojs):
n io latest Install or activate the latest iojs release
n io stable Install or activate the latest stable iojs release
n io <version> Install iojs <version>
n io use <version> [args ...] Execute iojs <version> with [args ...]
n io bin <version> Output bin path for <version>
n io rm <version ...> Remove the given version(s)
n io --latest Output the latest iojs version available
n io --stable Output the latest stable iojs version available
n io ls Output the versions of iojs available
Options:
Expand Down Expand Up @@ -213,6 +211,14 @@ check_current_version() {
fi
}

#
# Check the operation is supported for io.
#

check_io_supported() {
test $DEFAULT -eq 1 && abort "$1 not supported for io.js"
}

#
# Display sorted versions directories paths.
#
Expand Down Expand Up @@ -359,6 +365,23 @@ activate_previous() {
echo
}

#
# Install latest version.
#

install_latest() {
install $(display_latest_version)
}

#
# Install latest stable version.
#

install_stable() {
check_io_supported "stable"
install $(display_latest_stable_version)
}

#
# Install <version>
#
Expand Down Expand Up @@ -475,6 +498,7 @@ display_latest_version() {
#

display_latest_stable_version() {
check_io_supported "--stable"
$GET 2> /dev/null ${MIRROR[$DEFAULT]} \
| egrep -o '[0-9]+\.[0-9]*[02468]\.[0-9]+' \
| sort -u -k 1,1n -k 2,2n -k 3,3n -t . \
Expand Down Expand Up @@ -529,8 +553,8 @@ else
bin|which) display_bin_path_for_version $2; exit ;;
as|use) shift; execute_with_version $@; exit ;;
rm|-) shift; remove_versions $@; exit ;;
latest) install $($0 ${BINS[$DEFAULT]} --latest); exit ;;
stable) install $($0 ${BINS[$DEFAULT]} --stable); exit ;;
latest) install_latest; exit ;;
stable) install_stable; exit ;;
ls|list) display_remote_versions; exit ;;
prev) activate_previous; exit ;;
*) install $1; exit ;;
Expand Down

0 comments on commit beed0dd

Please sign in to comment.