scripts/cli in rvm-1.0.7 vs scripts/cli in rvm-1.0.8

- old
+ new

@@ -2,30 +2,35 @@ __rvm_usage() { \less "${rvm_path:-$HOME/.rvm}/README" ; } __rvm_run_script() { local rvm_script_name="${1:-"$rvm_action"}" + eval "$rvm_path/scripts/$rvm_script_name $rvm_ruby_args" + return $? } __rvm_parse_args() { + # TODO: # Make this more robust '__rvm_history' so that it stores *unique* rvm commands. # Otherwise this file gets big rather fast. #echo "$@" >> $HOME/.rvm_history if echo "$@" | \grep -q 'trace' ; then echo "$@" ; __rvm_version ; fi rvm_action="${rvm_action:-""}" - export rvm_ruby_string="${rvm_ruby_string:-""}" - local rvm_parse_break=0 - local rvm_error_message="" + export rvm_ruby_string + rvm_parse_break=0 + while [[ -n "$next_token" ]] ; do + rvm_token="$next_token" + if [[ $# -gt 0 ]] ; then next_token="$1" ; shift ; else next_token="" ; fi case "$rvm_token" in fetch|version|srcdir|reset|debug|reload|update|monitor|notes|implode|seppuku|question|answer|env) rvm_action=$rvm_token @@ -124,12 +129,11 @@ rvm_ruby_gem_home="$rvm_ruby_gem_home${rvm_gemset_separator:-"@"}$rvm_gemset_name" fi else - rvm_gemset_name="${rvm_gemset_name:-""}" - if [[ "$rvm_ruby_string" != "$rvm_gemset_name" ]] ; then __rvm_ruby_string ; fi + if [[ "${rvm_ruby_string:-""}" != "${rvm_gemset_name:-""}" ]] ; then __rvm_ruby_string ; fi rvm_ruby_args="$next_token $@" fi rvm_parse_break=1 ;; @@ -393,11 +397,11 @@ ;; --trace|--debug) local option="" - rvm_debug_flag=1 + export rvm_debug_flag=1 for option in verbose noclobber nounset ; do set -o $option done @@ -407,11 +411,11 @@ # errexit pipefail if [[ "$rvm_token" = "--trace" ]] ; then - rvm_trace_flag=1 + export rvm_trace_flag=1 set -o xtrace if [[ -z "${ZSH_VERSION:-""}" ]] ; then export PS4='-[${BASH_SOURCE}] : ${LINENO} : ${FUNCNAME[0]:+${FUNCNAME[0]}() > }' @@ -545,11 +549,11 @@ elif "$rvm_path/scripts/match" "$rvm_token" "^ree-" ; then rvm_ruby_string="$rvm_token" rvm_ruby_strings="$rvm_token" rvm_action="${rvm_action:-use}" - elif [[ -L "$rvm_rubies_path/$rvm_token" ]] ; then # Alias + elif [[ -L "$rvm_path/rubies/$rvm_token" ]] ; then # Alias rvm_ruby_string=$rvm_token rvm_ruby_strings="$rvm_token" rvm_action="${rvm_action:-use}" else @@ -573,10 +577,12 @@ if [[ -z "${rvm_action:-""}" && -n "${rvm_ruby_string:-""}" ]] ; then rvm_action="use" ; fi if [[ ${rvm_parse_break:-0} -eq 1 || -n "${rvm_error_message:-""}" ]] ; then break ; fi done + export rvm_head_flag $(env | awk -F= -v ORS=' ' '/^rvm_/{print $1}') + # Empty args list. while [[ $# -gt 0 ]] ; do shift ; done if [[ -n "${rvm_error_message:-""}" ]] ; then "$rvm_path/scripts"/log "fail" "$rvm_error_message ( see: 'rvm usage' )" @@ -584,21 +590,21 @@ fi } rvm() { - local next_token result + local result __rvm_setup case $- in *i*) rvm_interactive_flag=1 ;; *) rvm_interactive_flag=0 ;; esac ; export rvm_interactive_flag if [[ -z "${ZSH_VERSION:-""}" ]] ; then - trap '\rm -rf "$rvm_tmp_path/$$" >/dev/null 2>&1' 0 1 2 3 15 + trap '\rm -rf "${rvm_tmp_path:-"$rvm_path/tmp"}/$$" >/dev/null 2>&1' 0 1 2 3 15 fi # Check that this is the current version. disk_version="$(awk '/:/{printf $NF"."}' "$rvm_path/lib/VERSION.yml")" @@ -622,14 +628,14 @@ __rvm_parse_args "$@" rvm_action="${rvm_action:-usage}" - export BUNDLE_PATH GEM_HOME GEM_PATH rvm_ruby_string rvm_action rvm_bin_flag rvm_debug_flag rvm_delete_flag rvm_docs_type rvm_file_name rvm_gemset_name rvm_head_flag rvm_install_on_use_flag rvm_interactive_flag rvm_llvm_flag rvm_make_flags rvm_proxy rvm_remove_flag rvm_ruby_args rvm_configure_flags rvm_ruby_file rvm_ruby_gem_home rvm_ruby_interpreter rvm_ruby_name rvm_ruby_version rvm_system_flag rvm_trace_flag rvm_use_flag rvm_user_flag rvm_verbose_flag rvm_patch_names rvm_patch_original_pwd rvm_clang_flag rvm_install_arguments rvm_path rvm_rubies_path rvm_archives_path rvm_src_path rvm_log_path rvm_bin_path rvm_gems_path rvm_config_path rvm_tmp_path rvm_hooks_path rvm_gems_cache_path rvm_gemset_separator rvm_ruby_aliases rvm_quiet_flag rvm_silent_flag rvm_pretty_print_flag - result=0 + export BUNDLE_PATH GEM_HOME GEM_PATH $(env | awk -F= -v ORS=' ' '/^rvm_/{print $1}') + case "$rvm_action" in use) __rvm_use ;; srcdir) __rvm_source_dir ;; strings) __rvm_strings ;; version) __rvm_version ;; @@ -666,13 +672,15 @@ ruby|gem|rake|exec) old_rvm_ruby_string=$rvm_ruby_string unset rvm_ruby_string export rvm_ruby_strings - "$rvm_path/scripts/set" "$rvm_action" $rvm_ruby_args - result=$? + + "$rvm_path/scripts/set" "$rvm_action" $rvm_ruby_args ; result=$? + # Restore the state pre-sets. [[ -n "$old_rvm_ruby_string" ]] && rvm_ruby_string=$old_rvm_ruby_string + unset old_rvm_ruby_string ;; cleanup|tools|snapshot|disk-usage|repair|alias|docs|rubygems|migrate|upgrade) __rvm_run_script "$rvm_action"