scripts/cli in rvm-0.0.64 vs scripts/cli in rvm-0.0.65

- old
+ new

@@ -80,11 +80,12 @@ --prefix - path for all rvm files (~/.rvm/), with trailing slash! --bin - path for binaries to be placed (~/.rvm/bin/) --source - src directory to use (~/.rvm/src/) --archives - directory for downladed files (~/.rvm/archives/) - -S|--script - Specify a script file to attempt to load and run (rubydo) + -S - Specify a script file to attempt to load and run (rubydo) + -e - Execute code from the command line. -G|--gems - root gem path to use -C|--configure - custom configure options, comma separated default: --enable-shared=true --reconfigure - Force installer to re-run configure if already run --make - custom make command @@ -173,22 +174,33 @@ rvm_ruby_interpreter=$1 ; shift rvm_ruby_version=$2 ; shift fi ;; + -S|-e) + rvm_action="ruby" + rvm_ruby_args="$rvm_token '$@'" + rvm_parse_break=1 + ;; + do|ruby|rake|gem|rubydo|rakedo|gemdo) if [[ "do" = "$rvm_action" ]] ; then rvm_action="ruby" ; fi rvm_action=$(echo $rvm_token | sed 's#do##g') - if [[ "rake" = "$rvm_action" ]] || [[ "gem" = "$rvm_action" ]] || [[ "ruby" = "$rvm_action" ]] ; then if [[ -z "$1" ]] ; then - rvm_action="error" - rvm_error_message="the 'ruby' and 'gem' actions must be followed by arguments." - else + if [[ "gem" = "$rvm_action" ]] || [[ "ruby" = "$rvm_action" ]] ; then + rvm_action="error" + rvm_error_message="the '$rvm_action' actions must be followed by arguments." + fi + elif [[ "-S" = "$1" ]] || [[ "-e" = "$1" ]] ; then rvm_action="ruby" - rvm_ruby_args="$rvm_token $@" + flag="$1" ; shift + rvm_ruby_args="$flag '$@'" rvm_parse_break=1 + else + rvm_ruby_args="$*" + rvm_parse_break=1 fi else if match "$1" "^-" ; then unset rvm_ruby_version else @@ -290,11 +302,10 @@ rvm_action="error" rvm_error_message="-j *must* be followed by an integer (normally the # of CPU's in your machine)." fi ;; - -C|--configure) if [[ ! -z "$1" ]] ; then rvm_ruby_configure="$(echo $1 | tr ',' ' ')" shift else @@ -327,39 +338,33 @@ rvm_action="ruby" rvm_ruby_file="$1" shift ;; - -S|--script|-e|--execute) - rvm_action="ruby" - rvm_ruby_args="$@" - rvm_parse_break=1 - ;; - default|system) rvm_action="use" rvm_ruby_interpreter="system" ;; - --install) rvm_install_on_use_flag=1 ;; - -h|--help|usage|help) rvm_action=help ;; - --prefix) rvm_prefix_path="$1" ; shift ;; - -G|--gems) rvm_gem_path="$1" ; shift ;; - --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 ;; + --install) rvm_install_on_use_flag=1 ;; + -h|--help|usage|help) rvm_action=help ;; + --prefix) rvm_prefix_path="$1" ; shift ;; + -G|--gems) rvm_gem_path="$1" ; shift ;; + --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="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" ;; + -m|--gem-set) rvm_gem_set_name="$1" ; shift ;; + --sdk) rvm_sdk="$1" ; shift ;; + --archflags) rvm_archflags="$1" ; shift ;; - --trace) - eval "rvm_$(echo $rvm_token | sed 's#-##g')_flag=1" - set -x - ;; + tests|specs) rvm_action="tests" ;; + --trace) eval "rvm_$(echo $rvm_token | sed 's#-##g')_flag=1" ; set -x ;; + --self|--gem|--rubygems|--reconfigure|--default|--debug|--force|--all|--dump|--summary|--jit|--latest|--yaml|--json|--archive|--shebang|--env|--path|--tail|--delete) eval "rvm_$(echo $rvm_token | sed 's#-##g')_flag=1" ;; reboot|flush|asdf|damnit|wtf|argh|work|workdamnit|BOOM|boom|wth) @@ -372,11 +377,14 @@ ;; *) if [[ ! -z "$rvm_token" ]] ; then if [[ "gems" = "$rvm_action" ]] ; then - if [[ ! -z "$(echo "$rvm_token" | awk '/\.gems$/')" ]] ; then + if 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 [[ ! -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" @@ -437,50 +445,38 @@ __rvm_parse_args $@ if [[ -z "$rvm_trace_flag" ]] ; then set +x ; else set -x ; fi result=0 case "$rvm_action" in - use) __rvm_use ; result=$? ;; - gemdir) __rvm_gemdir ; result=$? ;; - gemdup) __rvm_gemdup ; result=$? ;; - srcdir) __rvm_source_dir ; result=$? ;; - list) __rvm_list ; result=$? ;; - version) __rvm_version ; result=$? ;; - reset) __rvm_reset ; result=$? ;; - # TODO: how can we use bin_path here for reload, default file? - implode) __rvm_implode ; result=$? ;; - update) __rvm_update ; result=$? ;; - readline) __rvm_readline_install ; result=$? ;; - reboot) __rvm_reboot ; result=$? ;; - usage|help) __rvm_usage ; result=$? ;; - benchmark) __rvm_benchmark ; result=$? ;; - ruby) __rvm_do ; result=$? ;; - inspect) __rvm_inspect ; result=$? ;; - gems) __rvm_gems ; result=$? ;; - remove) __rvm_remove_ruby ; result=$? ;; - reload) - source "$rvm_path/scripts/rvm" - ;; + use) __rvm_use ; result=$? ;; + gemdir) __rvm_gemdir ; result=$? ;; + gemdup) __rvm_gemdup ; result=$? ;; + srcdir) __rvm_source_dir ; result=$? ;; + list) __rvm_list ; result=$? ;; + version) __rvm_version ; result=$? ;; + reset) __rvm_reset ; result=$? ;; + implode) __rvm_implode ; result=$? ;; + update) __rvm_update ; result=$? ;; + readline) __rvm_readline_install ; result=$? ;; + reboot) __rvm_reboot ; result=$? ;; + usage|help) __rvm_usage ; result=$? ;; + benchmark) __rvm_benchmark ; result=$? ;; + inspect) __rvm_inspect ; result=$? ;; + gems) __rvm_gems ; result=$? ;; + remove) __rvm_remove_ruby ; result=$? ;; + ruby|gem|rake) __rvm_do ; result=$? ;; + reload) source "$rvm_path/scripts/rvm" ;; + install|uninstall) __rvm_manage_rubies ; result=$? ;; + tests|specs) rvm_action="rake" ; __rvm_do ; result=$? ;; iconv|openssl|ncurses|zlib|readline) __rvm_${rvm_action}_install result=$? ;; - install|uninstall) - __rvm_manage_rubies - result=$? - ;; - gemsync) rvm_source_gem_path=$(__rvm_select ; echo $rvm_ruby_gem_home) __rvm_gem_sync - ;; - - tests|specs) - rvm_summary_flag=1 - rvm_action="rake" - __rvm_do ;; info|debug) __rvm_version __rvm_info