From ed19062a6964b2cc8bb97d254aca3c1038b36c69 Mon Sep 17 00:00:00 2001 From: Michal Papis Date: Tue, 14 Jan 2014 03:53:24 +0100 Subject: [PATCH] fix detecting installed rubies, fix #a82073e13555cb909720ec595afa2cab598d166f --- scripts/functions/cli | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/scripts/functions/cli b/scripts/functions/cli index a7f673ca1f..51b9f3e287 100644 --- a/scripts/functions/cli +++ b/scripts/functions/cli @@ -275,11 +275,12 @@ __rvm_cli_install_ruby() if [[ -n "$1" ]] then - typeset __rubies __search __installed __missing + typeset __rubies __installed __missing __search_list typeset -a __search __rvm_custom_separated_array __search , "$1" - __rubies="" - __rvm_cli_rubies_select "$1" || return $? + __rubies="$1" + __search_list="" + __rvm_cli_rubies_select || return $? if __rvm_cli_rubies_not_installed then __rvm_run_wrapper manage install "${__rubies}" || return $? fi @@ -296,18 +297,14 @@ __rvm_cli_rubies_select() do rvm_ruby_string="${__ruby}" __rvm_select && - if - [[ -n "$rvm_ruby_string" ]] - then - __rubies+="$rvm_ruby_string," - __search+="^$rvm_ruby_string\$|" + if [[ -n "$rvm_ruby_string" ]] + then __search_list+="^$rvm_ruby_string\$|" else rvm_error "Could not detect ruby version/name for installation '${__ruby}', please be more specific." return 1 fi done - __rubies="${__rubies%,}" - __search="${__search%|}" + __search_list="${__search_list%|}" } __rvm_cli_rubies_not_installed() @@ -315,7 +312,7 @@ __rvm_cli_rubies_not_installed() if (( ${rvm_force_flag:-0} == 0 )) && __installed="$( - __rvm_list_strings | __rvm_grep -E "${__search}" + __rvm_list_strings | __rvm_grep -E "${__search_list}" )" && [[ -n "${__installed}" ]] then