scripts/selector in rvm-1.0.21 vs scripts/selector in rvm-1.0.22
- old
+ new
@@ -527,11 +527,11 @@
[[:digit:]]\.[[:digit:]]*)
case "$string" in
- 0.*|1.*)
+ 0.[[:digit:]]|0.[[:digit:]]\.[[:digit:]]|1.[[:digit:]]\.[[:digit:]])
rvm_ruby_version="$string"
rvm_ruby_revision=""
rvm_ruby_tag=""
;;
@@ -657,29 +657,41 @@
else
patch_level="$(__rvm_db "${rvm_ruby_interpreter}_${rvm_ruby_version}_patch_level")"
if [[ -n "${patch_level:-""}" ]] ; then
- if [[ "ree" = "$rvm_ruby_interpreter" ]] || [[ "rbx" = "$rvm_ruby_interpreter" ]] ; then
- rvm_ruby_patch_level="${patch_level}"
- else
- rvm_ruby_patch_level="p${patch_level}"
- fi
+ case "$rvm_ruby_interpreter" in
+ ree|rbx)
+ # REE & Rubinius use dates for their patch levels.
+ rvm_ruby_patch_level="${patch_level}"
+ ;;
+ *)
+ # MRI uses -pN+ to specify the patch level.
+ rvm_ruby_patch_level="p${patch_level}"
+ ;;
+ esac
+
fi
if [[ -n "${rvm_ruby_patch_level:-""}" ]] ; then
rvm_ruby_patch_level="${rvm_ruby_patch_level/#pp/p}"
rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_patch_level}"
- if [[ "ree" = "${rvm_ruby_interpreter:-""}" || "rbx" = "${rvm_ruby_interpreter:-""}" ]] ; then
- rvm_ruby_string="${rvm_ruby_string//-p*/-}"
+ case "$rvm_ruby_interpreter" in
- else
- rvm_ruby_string="${rvm_ruby_string//-pp/-p}"
- rvm_ruby_string="${rvm_ruby_string//-prc/-rc}"
- fi
+ ree|rbx)
+ rvm_ruby_string="${rvm_ruby_string//-p*/-}"
+ ;;
+
+ *)
+ rvm_ruby_string="${rvm_ruby_string//-pp/-p}"
+ rvm_ruby_string="${rvm_ruby_string//-prc/-rc}"
+ ;;
+
+ esac
+
fi
fi
if [[ -n "${rvm_ruby_name:-""}" ]] ; then
rvm_ruby_string="${rvm_ruby_string}-n${rvm_ruby_name}"
@@ -738,17 +750,20 @@
fi
if [[ -n "${rvm_ruby_string:-""}" ]] ; then
if [[ -z "${rvm_ruby_gem_home:-""}" || -n "${gemset:-""}" ]] ; then
+
rvm_ruby_gem_home="${rvm_gems_path:-"$rvm_path/gems"}/${rvm_ruby_string}${rvm_gemset_separator:-"@"}${rvm_gemset_name}"
elif [[ -n "${gemset:-""}" && "${rvm_gemset_name:-""}" != "${gemset:-""}" ]] ; then
+
rvm_ruby_gem_home="${rvm_gems_path:-"$rvm_path/gems"}/${rvm_ruby_string}${rvm_gemset_separator:-"@"}${rvm_gemset_name}"
fi
else
- "$rvm_path/scripts/log" "error" "Gemsets can not be used with non rvm controlled rubies (currently)."
+ "$rvm_path/scripts/log" "error" \
+ "Gemsets can not be used with non rvm controlled rubies (currently)."
return 1
fi
fi
if [[ -z "${GEM_HOME:-""}" ]] ; then unset GEM_HOME ; fi
@@ -756,12 +771,15 @@
# If the gemset does not exist, then notify the user as such and abort the action.
if [[ -n "${rvm_gemset_name:-""}" && ! -d "$rvm_ruby_gem_home" ]] ; then
if [[ ${rvm_gemset_create_on_use_flag:-0} -ne 1 && ${rvm_create_flag:-0} -ne 1 && ${rvm_delete_flag:-0} -ne 1 ]] ; then
- "$rvm_path/scripts/log" "error" "Gemset '$rvm_gemset_name' does not exist, rvm gemset create '$rvm_gemset_name' first."
+ "$rvm_path/scripts/log" "error" \
+ "Gemset '$rvm_gemset_name' does not exist, rvm gemset create '$rvm_gemset_name' first."
+ unset rvm_gemset_name gemset_name
+
return 1
fi
elif [[ ${rvm_delete_flag:-0} -eq 1 ]] ; then
return 1
@@ -774,28 +792,37 @@
rvm_ruby_global_gems_path="${rvm_ruby_gem_home%%${rvm_gemset_separator:-"@"}*}${rvm_gemset_separator:-"@"}global"
rvm_ruby_gem_path="$rvm_ruby_gem_home:$rvm_ruby_global_gems_path"
# Ensure that the ruby gem home exists.
\mkdir -p "$rvm_ruby_gem_home"
- if [[ -n "${rvm_ruby_gem_home:-""}" ]] && echo "$rvm_ruby_gem_home" | \grep -q 'rvm'; then
+
+ if [[ -n "${rvm_ruby_gem_home:-""}" ]] &&
+ echo "$rvm_ruby_gem_home" | \grep -q 'rvm'; then
+
if __rvm_using_gemset_globalcache && [[ ! -L "$rvm_ruby_gem_home/cache" ]]; then
+
\mv "$rvm_ruby_gem_home/cache/"*.gem "$rvm_gems_cache_path/" 2>/dev/null
\rm -rf "$rvm_ruby_gem_home/cache"
\ln -nfs "$rvm_gems_cache_path" "$rvm_ruby_gem_home/cache"
+
fi
+
fi
export rvm_ruby_gem_path rvm_ruby_gem_home
}
# Use a gemset specified by 'rvm_ruby_gem_home'
__rvm_gemset_use()
{
if [[ -z "${rvm_gemset_name:-""}" ]] ; then
+
"$rvm_path/scripts/log" "error" \
"Gemset was not given.\n Usage:\n rvm gemset use <gemsetname>\n"
+
return 1
+
fi
if [[ -n "${rvm_ruby_gem_home:-""}" ]] ; then
if [[ ! -d "$rvm_ruby_gem_home" ]] ; then
@@ -814,10 +841,11 @@
"$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"
GEM_HOME="$rvm_ruby_gem_home"
BUNDLE_PATH="$rvm_ruby_gem_home"
GEM_PATH="$rvm_ruby_gem_home:$rvm_ruby_global_gems_path"
@@ -845,8 +873,7 @@
GEM_PATH="$rvm_ruby_gem_home:$rvm_ruby_global_gems_path"
export rvm_ruby_gem_home rvm_ruby_global_gems_path GEM_HOME BUNDLE_PATH GEM_PATH
__rvm_use # Now ensure the selection takes effect for the environment.
-
}