scripts/cli in rvm-0.0.58 vs scripts/cli in rvm-0.0.59

- old
+ new

@@ -3,11 +3,11 @@ function __rvm_meta { rvm_meta_author="Wayne E. Seguin" rvm_meta_author_email="wayneeseguin@gmail.com" rvm_meta_website="http://rvm.beginrescueend.com/" rvm_meta_version="$(cat $rvm_path/lib/VERSION.yml | tail -n 3 | sed 's/^.*: //g' | tr "\n" '.' | sed 's/\.$//')" - rvm_meta_updated="2009.10.12" + rvm_meta_updated="2009.10.16" } function __rvm_version { __rvm_meta ; echo "rvm $rvm_meta_version ($rvm_meta_updated) [$rvm_meta_website]" ; } function __rvm_usage { @@ -98,11 +98,11 @@ Resources: http://rvm.beginrescueend.com/ https://www.pivotaltracker.com/projects/26822 -" | ${PAGER:-/usr/bin/less} +" | ${PAGER:-less} } function __rvm_parse_args { while [ $# -gt 0 ] ; do rvm_token="$1" ; shift @@ -129,15 +129,15 @@ system|default) rvm_action=${rvm_action:-use} rvm_ruby_interpreter="$rvm_token" ;; - # TODO: if $1 is a $version string nab it and shift jruby|ree|macruby|rbx|rubinius|default|all) rvm_ruby_interpreter="$rvm_token" rvm_action="${rvm_action:-use}" - if [ ! -z "$(echo $1 | awk '/^[0-9]/')" ] ; then + #if [ ! -z "$(echo $1 | awk '/^[0-9]/')" ] ; then + if [[ $1 =~ ^[0-9] ]] ; then rvm_ruby_version=$1 ; shift fi ;; gems|gemset) @@ -373,22 +373,28 @@ ;; *) if [ ! -z "$rvm_token" ] ; then if [ "gems" = "$rvm_action" ] ; then - if [ -z "$(echo $rvm_token | awk '/\.gems$/')" ] ; then - rvm_gem_set_name=$(echo $rvm_token | sed 's/\.gems//g') - else + if [ ! -z "$(echo $rvm_token | awk '/\.gems$/')" ] ; then rvm_file_name="$(echo $rvm_token | sed 's/\.gems//g').gems" + # elif [ ! -z "$(echo $rvm_token | awk '/\.gems$/')" ] ; then + else + rvm_gem_set_name="$(echo $rvm_token | sed 's/\.gems//g')" + rvm_file_name="$rvm_gem_set_name.gems" fi elif [ ! -z "$(echo $rvm_token | awk '/,/')" ] ; then rvm_ruby_version="$rvm_token" if [ -z "$rvm_action" ] ; then rvm_action="do" # Not sure if we really want to do this but we'll try it out. fi + elif [ ! -z "$(echo $rvm_token | awk '/^.+%.+$/')" ] ; then + rvm_gem_set_name="$(echo $rvm_token | awk -F'%' '{print $2}')" + rvm_ruby_string="$(echo $rvm_token | awk -F'%' '{print $1}')" else - if [ ! -z "$(echo $rvm_token | awk '/\.rb$/{print}' 2> /dev/null)" ] ; then # we have a specified ruby script + if [ ! -z "$(echo $rvm_token | awk '/\.rb$/{print}')" ] ; then # we have a specified ruby script + #if [[ ! $rvm_token =~ \.rb$ ]] ; then # we have a specified ruby script rvm_ruby_args=$rvm_token rvm_ruby_file=$rvm_token if [ -z "$rvm_action" ] ; then rvm_action="ruby" # Not sure if we really want to do this but we'll try it out. fi @@ -404,21 +410,24 @@ if [ "error" = "$rvm_action" ] ; then break; fi esac + + if [ -z "$rvm_action" -a ! -z "$rvm_ruby_string" ] ; then rvm_action="use" ; fi + if [ ! -z "$rvm_parse_break" -o ! -z "$rvm_error_message" ] ; then unset rvm_parse_break; break; fi done if [ ! -z "$rvm_error_message" ] ; then __rvm_pushpop ; return 1 ; fi } function rvm { - trap '__rvm_cleanup_variables ; rm -f "/tmp/rvm/$$" >/dev/null 2>&1' 0 1 2 3 15 + trap '__rvm_cleanup_variables ; rm -rf "/tmp/rvm/$$" >/dev/null 2>&1' 0 1 2 3 15 __rvm_cleanup_variables - __rvm_load-rvmrc + __rvm_load_rvmrc __rvm_initialize __rvm_load_defaults __rvm_parse_args $@ if [ -z "$rvm_trace_flag" ] ; then set +x ; else set -x ; fi