scripts/cli in rvm-0.0.62 vs scripts/cli in rvm-0.0.63

- old
+ new

@@ -49,10 +49,11 @@ * ruby - MRI/YARV Ruby (The Standard), defaults to 1.8.6 jruby - jRuby rbx - rubinius ree - ruby Enterprise Edition + mput - shyouhei(mput)'s github repository system - use the system ruby (eg. pre-rvm state) default - use rvm set default ruby and system if it hasn't been set. Flags @@ -127,17 +128,14 @@ system|default) rvm_action=${rvm_action:-use} rvm_ruby_interpreter="$rvm_token" ;; - jruby|ree|macruby|rbx|rubinius|default|all) + jruby|ree|macruby|rbx|rubinius|mput|shyouhei|default|all) rvm_ruby_interpreter="$rvm_token" rvm_action="${rvm_action:-use}" - #if [[ ! -z "$(echo $1 | awk '/^[0-9]/')" ]] ; then - if [[ ! -z "$1" ]] && [[ "$1" =~ ^[0-9] ]] ; then - rvm_ruby_version=$1 ; shift - fi + if match "$1" "^[0-9]" ; then rvm_ruby_version=$1 ; shift ; fi ;; gems|gemset) rvm_action="gems" if [[ "name" = "$1" ]] || [[ "dir" = "$1" ]] || [[ "list" = "$1" ]] || [[ "empty" = "$1" ]] || [[ "delete" = "$1" ]] ; then @@ -189,18 +187,18 @@ rvm_action="ruby" rvm_ruby_args="$rvm_token $@" rvm_parse_break=1 fi else - if [[ ! -z "$(echo $1 | awk '/^-/')" ]] ; then + if match "$1" "^-" ; then unset rvm_ruby_version else - if [[ ! -z "$(echo $1 | awk '/^[0-9]/')" ]] ; then + if match "$1" "^[0-9]" ; then rvm_ruby_version=$(echo "$1" | tr ',' ' ') ; shift unset rvm_ruby_interpreter else - if [[ "jruby" = "$1" ]] || [[ "rbx" = "$1" ]] || [[ "rubinius" = "$1" ]] || [[ "macruby" = "$1" ]] || [[ "ree" = "$1" ]] || [[ "ruby-enterprise" = "$1" ]] ; then + if [[ "jruby" = "$1" ]] || [[ "rbx" = "$1" ]] || [[ "rubinius" = "$1" ]] || [[ "macruby" = "$1" ]] || [[ "ree" = "$1" ]] || [[ "ruby-enterprise" = "$1" ]] || [[ "mput" = "$1" ]] || [[ "shyouhei" = "$1" ]] ; then rvm_ruby_interpreter=$1 ; shift else unset rvm_ruby_interpreter rvm_ruby_version fi fi @@ -349,11 +347,11 @@ --source) rvm_src_path="$1" ; shift ;; --archives) rvm_archives_path="$1" ; shift ;; --make) rvm_ruby_make="$1" ; shift ;; --make-install) rvm_ruby_make_install="$1"; shift ;; --nice) rvm_niceness="$1" ; shift ;; - -l|--level) rvm_ruby_patch_level="$1" ; shift ;; + -l|--level) rvm_ruby_patch_level="p$1" ; shift ;; # TODO: handle this below better (if $1 is null) -m|--gem-set) rvm_gem_set_name="$1" ; shift ;; tests|specs) rvm_action="tests" ;; --trace) @@ -374,31 +372,32 @@ ;; *) if [[ ! -z "$rvm_token" ]] ; then if [[ "gems" = "$rvm_action" ]] ; then - 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 + 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_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 + 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}')" - #elif [[ ! -z "$(echo $rvm_token | awk '/^[0-9].[0-9]/')" ]] ; then - elif [[ ! -z "$rvm_token" ]] && [[ "$rvm_token" =~ ^[0-9].[0-9] ]] ; then + elif match "$rvm_token" "^.+%.+$" ; then + rvm_gem_set_name="$(echo "$rvm_token" | awk -F'%' '{print $2}')" + rvm_ruby_string="$(echo "$rvm_token" | awk -F'%' '{print $1}')" + elif match "$rvm_token" "^[0-9].[0-9]" ; then rvm_ruby_string="$rvm_token" - rvm_action="${rvm_action:-rvm_token}" + rvm_action="${rvm_action:-use}" + elif match "$rvm_token" "^ree" ; then + rvm_ruby_string="$rvm_token" + rvm_action="${rvm_action:-use}" else - if [[ ! -z "$(echo $rvm_token | awk '/\.rb$/{print}')" ]] ; then # we have a specified ruby script - #if [[ ! -z "$rvm_token" ]] && [[ " ! $rvm_token =~ \.rb$ ]] ; then # we have a specified ruby script + if match "$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