scripts/manage in rvm-0.1.37 vs scripts/manage in rvm-0.1.38
- old
+ new
@@ -99,10 +99,11 @@
__rvm_post_install
__rvm_pushpop
}
__rvm_install_ruby() {
+
if [[ -z "$rvm_ruby_selected_flag" ]] ; then __rvm_select ; fi
if [[ ! -z "$RUBYOPT" ]] ; then ruby_options="$RUBYOPT" ; unset RUBYOPT ; fi
case "$rvm_ruby_interpreter" in
@@ -636,11 +637,10 @@
;;
*) $rvm_scripts_path/log "fail" "Ruby interpreter '$rvm_ruby_interpreter' is not known."
esac
-
# Import the initial gemsets.
(source $rvm_scripts_path/rvm; rvm use "$rvm_ruby_string"; $rvm_scripts_path/gemsets initial)
rvm_hook="after_install" ; source $rvm_scripts_path/hook
@@ -762,10 +762,20 @@
$rvm_scripts_path/log "info" "Copying from repo to src path..."
cp -r "$rvm_ruby_repo_path" "$rvm_ruby_src_path"
fi
}
+__rvm_check_default() {
+ default_ruby_interpreter="$(rvm alias show default 2>/dev/null | awk -F"${rvm_gemset_seperator:-"@"}" '{print $1}')"
+ current_ruby_interpreter="$(echo "$rvm_ruby_string" | awk -F"${rvm_gemset_seperator:-"@"}" '{print $1}')"
+ if [[ -n "$current_ruby_interpreter" && "$current_ruby_interpreter" == "$default_ruby_interpreter" ]]; then
+ # In a new subshell, set the default interpeter to system.
+ (source $rvm_scripts_path/rvm; rvm use system --default)
+ fi
+ unset default_ruby_interpreter current_ruby_interpreter
+}
+
__rvm_uninstall_ruby() {
if [[ -z "$rvm_ruby_selected_flag" ]] ; then __rvm_select ; fi
if [[ ! -z "$rvm_ruby_string" ]] ; then
for dir in $rvm_rubies_path ; do
@@ -778,10 +788,13 @@
if [[ -e $rvm_bin_path/$rvm_ruby_string ]] ; then
rm -f $rvm_bin_path/$rvm_ruby_string
fi
done ; unset dir
__rvm_remove_gemsets
+
+ __rvm_check_default
+
else
$rvm_scripts_path/log "fail" "Cannot uninstall unknown package '$rvm_ruby_string'"
fi ; unset rvm_uninstall_flag
}
@@ -799,13 +812,12 @@
if [[ -e $rvm_bin_path/$rvm_ruby_string ]] ; then
rm -f $rvm_bin_path/$rvm_ruby_string
fi
- if grep -q "$rvm_ruby_string" "$rvm_config_path/default" 2>/dev/null ; then
- rm -f "$rvm_config_path/default"
- fi
+ __rvm_check_default
+
done ; unset dir
__rvm_remove_gemsets
else
$rvm_scripts_path/log "fail" "Cannot uninstall unknown package '$rvm_ruby_string'"
fi ; unset rvm_remove_flag
@@ -837,9 +849,20 @@
done ; unset binary binaries
fi
__rvm_irbrc
__rvm_generate_default_docs
+
+ if [[ -n "$rvm_ruby_aliases" ]]; then
+ $rvm_scripts_path/log "info" "Setting up aliases for $rvm_ruby_string"
+ for ruby_alias in $rvm_ruby_aliases; do
+ $rvm_scripts_path/log "info" "Aliasing $rvm_ruby_string to $ruby_alias"
+ $rvm_scripts_path/alias delete "$ruby_alias" > /dev/null 2>&1
+ $rvm_scripts_path/alias create "$ruby_alias" "$rvm_ruby_string" > /dev/null 2>&1
+ done
+ unset rvm_ruby_aliases ruby_alias
+ fi
+
}
__rvm_generate_default_docs() {
if [[ "$rvm_docs_flag" = "1" && "$rvm_ruby_interpreter" != "macruby" ]]; then
$rvm_scripts_path/log "info" "Attempting to generate ri docs..."