scripts/set in rvm-1.0.5 vs scripts/set in rvm-1.0.6

- old
+ new

@@ -2,25 +2,28 @@ source "$rvm_scripts_path/base" __rvm_attempt_single_exec() { # Return if we have multiple rubies. or we're not running exec. - local ruby_string_lines="$(printf "$rvm_ruby_strings" | wc -l | __rvm_strip)" - if [[ "$action" = "exec" && -n "$rvm_ruby_strings" && "$ruby_string_lines" = "0" ]]; then + if [[ "$action" = "exec" && ${#rvm_ruby_strings[@]} -lt 2 ]]; then __rvm_become "$rvm_ruby_strings" + eval "exec ${args[@]}" fi + return 1 } # Perform an action using one of a selected ruby's specified binaries. __rvm_ruby_do() { # Return on invalid rubies. __rvm_become "$current_set_ruby" || return 1 + if [[ "$action" = "exec" ]]; then # Exec is a special case. rvm_command="$args" + else binary="$(echo $action | sed 's#do$##')" if [[ -x "$rvm_ruby_home/bin/$binary" ]] ; then binary="$rvm_ruby_home/bin/$binary" @@ -44,11 +47,11 @@ rvm_ruby_mode="--$(echo "$rvm_ruby_mode" | sed 's/^m//')" fi load_path="$(dirname $(command -v $binary) 2>/dev/null):$rvm_ruby_load_path" # TODO: the else case below should be run if $args =~ /\.rb$/ - if [[ "ruby" = "$(basename $binary)" ]] && [[ "$rvm_benchmark_flag" -ne 1 ]] ; then + if [[ "ruby" = "$(basename $binary)" && "$rvm_benchmark_flag" -ne 1 ]] ; then if "$rvm_scripts_path/match" "$args" "\.rb$" ; then if [[ -z "$prefix" ]] ; then prefix="-S" ; fi @@ -151,11 +154,11 @@ json="$json\n {\"${rubies[$index]}\": ${statuses[$index]}}" if (( $index + 1 < $total + $array_start )) ; then json="$json, " ; fi done ; unset index array_start json="$json\n }\n}" - \mkdir -p log + mkdir -p log printf "$json" | tee -a log/summary.json return ${#errors[*]} } @@ -176,15 +179,16 @@ if [[ "$action" == "ruby" ]] && echo "$args" | \grep -q "^'--[^[:space:]]*'$" ; then "$rvm_scripts_path/log" "warn" "You called rvm ruby with the arguments $args which look like use options." "$rvm_scripts_path/log" "warn" "Please note that 'rvm ruby' invokes set operations instead." fi -rvm_ruby_strings="$(__rvm_expand_ruby_string "$rvm_ruby_strings")" +rvm_ruby_strings=$(__rvm_expand_ruby_string "$rvm_ruby_strings") +rvm_ruby_strings=(${rvm_ruby_strings//default}) # No quotes here is intentional. # Check for a single ruby && exec if present. __rvm_attempt_single_exec -for current_set_ruby in ${rvm_ruby_strings} ; do +for current_set_ruby in ${rvm_ruby_strings[@]} ; do __rvm_ruby_do done if [[ ! -z "$rvm_summary_flag" ]] ; then __rvm_summary ; fi if [[ ! -z "$rvm_yaml_flag" ]] ; then __rvm_yaml ; fi