scripts/selector in rvm-1.0.14 vs scripts/selector in rvm-1.0.15
- old
+ new
@@ -423,41 +423,54 @@
# * rvm_ruby_version
# * rvm_ruby_patch_level
# * rvm_ruby_revision
# * rvm_ruby_tag
+ local ruby_string gemset_name
+
rvm_expanding_aliases=${rvm_expanding_aliases:-0}
rvm_ruby_version=${rvm_ruby_version:-""}
rvm_gemset_name=${rvm_gemset_name:-""}
rvm_ruby_interpreter=${rvm_ruby_interpreter:-""}
rvm_ruby_version=${rvm_ruby_version:-""}
rvm_ruby_patch_level=${rvm_ruby_patch_level:-""}
rvm_ruby_revision=${rvm_ruby_revision:-""}
rvm_ruby_tag=${rvm_ruby_tag:-""}
+ if echo "$rvm_ruby_string" | \grep -q "${rvm_gemset_separator:-"@"}" ; then
+ rvm_gemset_name="${rvm_ruby_string/*${rvm_gemset_separator:-"@"}/}"
+ rvm_ruby_string="${rvm_ruby_string/${rvm_gemset_separator:-"@"}*/}"
+ fi
+
# Alias'd rubies
- if [[ ${rvm_expanding_aliases:-0} -eq 0 && -n ${rvm_ruby_string:-""} && $rvm_ruby_string != "system" ]]; then
- if expanded_alias_name="$("$rvm_path/scripts/alias" show "$rvm_ruby_string" 2>/dev/null)" && [[ -n "$expanded_alias_name" ]] ; then
+ if [[ ${rvm_expanding_aliases:-0} -eq 0 && -n ${rvm_ruby_string:-""}
+ && $rvm_ruby_string != "system" ]] ; then
+ if expanded_alias_name="$("$rvm_path/scripts/alias" show "$rvm_ruby_string" 2>/dev/null)" \
+ && [[ -n "$expanded_alias_name" ]] ; then
rvm_ruby_string="$expanded_alias_name"
- elif [[ "$rvm_ruby_string" = default ]]; then
+ elif [[ "$rvm_ruby_string" = default ]] ; then
# Default is not a known value. Instead, we need to therefore set it to system.
rvm_ruby_string="system"
fi
fi
if echo "$rvm_ruby_string" | \grep -q "${rvm_gemset_separator:-"@"}" ; then
rvm_gemset_name="${rvm_ruby_string/*${rvm_gemset_separator:-"@"}/}"
rvm_ruby_string="${rvm_ruby_string/${rvm_gemset_separator:-"@"}*/}"
- rvm_sticky_flag=1
fi
- ruby_string=${rvm_ruby_string/${rvm_gemset_separator:-"@"}*/}
+ # Stash the ruby string.
+ ruby_string=${rvm_ruby_string:-""}
+ gemset_name=${rvm_gemset_name:-""}
__rvm_unset_ruby_variables
- rvm_ruby_string=${rvm_ruby_string:-""}
+ if [[ ! -z "$gemset_name" ]] ; then
+ rvm_gemset_name="$gemset_name"
+ rvm_sticky_flag=1 # <- not sold on this.
+ fi
strings=($(echo ${ruby_string//-/ }))
if [[ ${#strings[@]} -eq 0 ]] ; then
@@ -776,10 +789,11 @@
return 1
fi
fi
if [[ ${rvm_interactive_flag:-0} -gt 0 && ${rvm_verbose_flag:-1} -ne 0 ]] ; then
- "$rvm_path/scripts/log" "info" "Now using gemset '${rvm_gemset_name:-default}'"
+ "$rvm_path/scripts/log" "info" \
+ "Now using gemset '${rvm_gemset_name:-default}'"
fi
rvm_ruby_gem_home="${GEM_HOME//${rvm_gemset_separator:-"@"}*}${rvm_gemset_separator:-"@"}${rvm_gemset_name}"
rvm_ruby_global_gems_path="${rvm_ruby_gem_home%%${rvm_gemset_separator:-"@"}*}${rvm_gemset_separator:-"@"}global"