Permalink
Browse files

Bugfix: "rvm 1.8.7 test.rb" now works as expected, Thanks to Alex Cha…

…ffee
  • Loading branch information...
1 parent f3ccd9a commit ea56daa52759dc468ebc4c0540917e6e7bf91d99 @wayneeseguin wayneeseguin committed Nov 12, 2010
Showing with 15 additions and 14 deletions.
  1. +3 −1 scripts/cli
  2. +12 −13 scripts/set
View
4 scripts/cli
@@ -575,7 +575,9 @@ __rvm_parse_args()
if "$rvm_path/scripts/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" ; fi
+ if [[ -z "${rvm_action:-""}" || "$rvm_action" = "use" ]]; then
+ rvm_action="ruby"
+ fi
else
rvm_action="error"
rvm_error_message="Unrecognized command line argument: '$rvm_token'"
View
25 scripts/set
@@ -23,7 +23,7 @@ __rvm_ruby_do()
if [[ "$action" = "exec" ]]; then
# Exec is a special case.
- rvm_command="${args[@]}"
+ command="${args[@]}"
else
@@ -70,22 +70,21 @@ __rvm_ruby_do()
# TODO: the else case below should be run if $args =~ /\.rb$/
if [[ "ruby" = "$(basename $binary)" && "$rvm_benchmark_flag" -ne 1 ]] ; then
- if "$rvm_path/scripts/match" "${args[@]}" "\.rb$" ; then
+ case "${args[@]}" in
- if [[ -z "$prefix" ]] ; then prefix="-S" ; fi
+ *[:space:]-S[:space:]*)
+ command="$binary $rvm_ruby_mode $rvm_ruby_require -I$load_path ${args[@]}"
+ ;;
- if ! "$rvm_path/scripts/match" "${args[@]}" "$prefix" ; then
+ *)
+ command="$binary $rvm_ruby_mode $rvm_ruby_require -I$load_path -S ${args[@]}"
+ ;;
- args=($prefix ${args[@]})
-
- fi
- fi
-
- rvm_command="$binary $rvm_ruby_mode $rvm_ruby_require -I$load_path ${args[@]}"
+ esac
else
- rvm_command="$binary $rvm_ruby_mode ${args[@]}"
+ command="$binary $rvm_ruby_mode ${args[@]}"
fi
@@ -99,7 +98,7 @@ __rvm_ruby_do()
touch ./log/$rvm_ruby_string/$action.log ./log/$rvm_ruby_string/$action.error.log
- eval "$rvm_command" \
+ eval "$command" \
>> ./log/$rvm_ruby_string/$action.log \
2>> ./log/$rvm_ruby_string/$action.error.log
@@ -119,7 +118,7 @@ __rvm_ruby_do()
unset current_env
fi
- eval "$rvm_command"
+ eval "$command"
fi
result=$?

0 comments on commit ea56daa

Please sign in to comment.