Permalink
Browse files

Features:

'rvm list known' now returns immediately and does not include svn.
'rvm list ruby_svn_tags' now lists the ruby svn tags available.
'rvm list known' alters behavior based on context.
  • Loading branch information...
wayneeseguin committed May 28, 2010
1 parent d083b9f commit c1a9c46b2f0ab0e285981a45035e385b2b711c20
Showing with 17 additions and 17 deletions.
  1. +17 −17 scripts/list
View
@@ -4,11 +4,11 @@ if [[ "$rvm_trace_flag" -eq 2 ]] ; then set -x ; export rvm_trace_flag ; fi
# Query for valid rvm ruby strings
# This is meant to be used with scripting.
-__rvm_list_strings() {
+list_strings() {
echo $(\ls $rvm_rubies_path)
}
-__rvm_list_default() {
+list_default() {
strings="$(echo $rvm_ruby_args | awk '{print $2}')"
if [[ "$strings" = "string" ]] ; then
$rvm_scripts_path/alias show default 2>/dev/null | awk -F"$rvm_gemset_separator" '{print $1}' | xargs basename
@@ -24,26 +24,24 @@ __rvm_list_default() {
fi
}
-__rvm_list_known() {
+list_ruby_svn_tags() {
while read -r tag
do
prefix="$(echo ${tag/\//} | sed 's#^v1_##' | awk -F'_' '{print "(ruby-)1."$1"."$2}' | sed 's#p$##')"
echo "${prefix}-t${tag/\//}"
unset prefix tag
done < <(svn list http://svn.ruby-lang.org/repos/ruby/tags/ | awk '/^v1_[8|9]/')
- printf "\n(ruby-)1.8.6(-p399)\n(ruby-)1.8.6-head\n(ruby-)1.8.7(-p249)\n(ruby-)1.8.7-head\n(ruby-)1.9.1(-p243)\n(ruby-)1.9.1(-p376)\n(ruby-)1.9.1-head\n(ruby-)1.9.2-preview1\n(ruby-)1.9.2-head\nruby-head\n"
- printf "\njruby-1.2.0\njruby-1.3.1\njruby-1.4.0\njruby(-1.5.0) # the default\njruby-head"
- printf "\nrbx(-1.0.0) # default\nrbx-head"
- printf "\nree-1.8.6\nree(-1.8.7) # the default\nree-1.8.6-head\nree-1.8.7-head"
- printf "\nmaglev(-23530)\nmaglev-head"
- printf "\nmput(-head) # shyouhei head, the default mput"
- printf "\nironruby-0.9.3\nironruby-1.0-rc2\nironruby-head"
- if [[ "Darwin" = "$(uname)" ]] ; then
- printf "\nmacruby(-nightly) # the default macruby\nmacruby-head # Build from the macruby git repository"
+}
+
+list_known() {
+ if [[ -z "$rvm_interactive" ]] || [[ -z "$TERM" ]] || [[ "unknown" = "$TERM" ]] ; then
+ cat "$rvm_config_path/known"
+ else
+ cat "$rvm_config_path/known" | ${PAGER:-less}
fi
}
-__rvm_list_rubies() {
+list_rubies() {
echo
ruby=$(command -v ruby) ; current_ruby=""
if [[ ! -z "$ruby" ]] && [[ ! -z "$(echo $ruby | awk '/rvm/')" ]] ; then
@@ -88,13 +86,15 @@ __rvm_list_rubies() {
action="$(echo "$1" | awk '{print $1}')"
if [[ "known" = "$action" ]] ; then
- __rvm_list_known
+ list_known
elif [[ "default" = "$action" ]] ; then
- __rvm_list_default
+ list_default
elif [[ -z "$action" ]] || [[ "rubies" = "$action" ]] ; then
- __rvm_list_rubies
+ list_rubies
elif [[ "strings" = "$action" ]] ; then
- __rvm_list_strings
+ list_strings
+elif [[ "ruby_svn_tags" = "$action" ]] ; then
+ list_ruby_svn_tags
else # help
printf "\nUsage: rvm list {known,default,rubies,strings}"
fi

0 comments on commit c1a9c46

Please sign in to comment.