scripts/utility in rvm-0.1.40 vs scripts/utility in rvm-0.1.41
- old
+ new
@@ -25,10 +25,21 @@
# Hence, we ensure we remove them at in
# the cleanup phase.
unset rvm_ruby_strings
}
+# Return a list of directories under a given base path.
+# Derived from rvm_ruby_string.
+__rvm_ruby_string_paths_under() {
+ local patch_parts="$(echo "$rvm_ruby_string" | tr '-' ' ' | __rvm_strip)"
+ while true; do
+ echo "$1/$patch_parts" | tr ' ' '/' | sed 's#\/$##'
+ [[ -z "$patch_parts" ]] && break
+ patch_parts="$(echo "$patch_parts" | awk '{$NF=""; print}' | __rvm_strip)"
+ done
+}
+
# Query the rvm key-value database for a specific key
# Allow overrides from user specifications in $rvm_config_path/user
__rvm_db() {
key=$1 ; variable=$2
if [[ -f "$rvm_config_path/user" ]] ; then
@@ -156,11 +167,11 @@
__rvm_cleanup_variables() {
__rvm_unset_ruby_variables
if [[ "$rvm_sticky_flag" = "1" ]] ; then export rvm_gemset_name ; else unset rvm_gemset_name ; fi
- unset rvm_action rvm_irbrc_file rvm_command rvm_error_message rvm_url rvm_force_flag rvm_all_flag rvm_reconfigure_flag rvm_make_flags rvm_bin_flag rvm_import_flag rvm_export_flag rvm_self_flag rvm_gem_flag rvm_rubygems_flag rvm_debug_flag rvm_delete_flag rvm_summary_flag rvm_test_flag _rvm_spec_flag rvm_json_flag rvm_yaml_flag rvm_shebang_flag rvm_env_flag rvm_tail_flag rvm_use_flag rvm_dir_flag rvm_list_flag rvm_empty_flag rvm_file_name rvm_benchmark_flag rvm_clear_flag rvm_name_flag rvm_verbose_flag rvm_user_flag rvm_system_flag rvm_ruby_configure_flags rvm_uninstall_flag rvm_install_flag rvm_llvm_flag rvm_ruby_bits rvm_ruby_patch rvm_sticky_flag rvm_rvmrc_flag rvm_gems_flag rvm_only_path_flag rvm_docs_flag rvm_ruby_aliases
+ unset rvm_action rvm_irbrc_file rvm_command rvm_error_message rvm_url rvm_force_flag rvm_all_flag rvm_reconfigure_flag rvm_make_flags rvm_bin_flag rvm_import_flag rvm_export_flag rvm_self_flag rvm_gem_flag rvm_rubygems_flag rvm_debug_flag rvm_delete_flag rvm_summary_flag rvm_test_flag _rvm_spec_flag rvm_json_flag rvm_yaml_flag rvm_shebang_flag rvm_env_flag rvm_tail_flag rvm_use_flag rvm_dir_flag rvm_list_flag rvm_empty_flag rvm_file_name rvm_benchmark_flag rvm_clear_flag rvm_name_flag rvm_verbose_flag rvm_user_flag rvm_system_flag rvm_ruby_configure_flags rvm_uninstall_flag rvm_install_flag rvm_llvm_flag rvm_ruby_bits rvm_sticky_flag rvm_rvmrc_flag rvm_gems_flag rvm_only_path_flag rvm_docs_flag rvm_ruby_aliases rvm_ruby_aliases rvm_patch_names
}
# Unset ruby-specific variables
__rvm_unset_ruby_variables() {
unset rvm_ruby_interpreter rvm_ruby_version rvm_url rvm_ruby_repo_url rvm_ruby_package_name rvm_ruby_patch_level rvm_ruby_make rvm_ruby_make_install rvm_ruby_revision rvm_ruby_tag rvm_release_version rvm_major_version rvm_minor_version rvm_ruby_gem_home rvm_ruby_binary rvm_ruby_home rvm_ruby_log_path rvm_ruby_src_path rvm_ruby_irbrc rvm_ruby_selected_flag rvm_ruby_src_path rvm_ruby_repo_url rvm_major_version rvm_minor_version rvm_ruby_gem_home rvm_head_flag rvm_ruby_configure rvm_ruby_mode rvm_ruby_package_file rvm_ruby_package_name rvm_ruby_gem_path rvm_ruby_name rvm_ruby_alias rvm_ruby_strings rvm_ruby_repo_path
@@ -192,19 +203,16 @@
}
__rvm_ensure_has_18_compat_ruby() {
if [[ -z "$(__rvm_18_compat_ruby)" ]]; then
# TODO: install currently doesn't return the correct status.
- original_ruby="$(__rvm_environment_identifier)"
local compat_result=0
- if ! $rvm_bin_path/rvm install 1.8.7; then
+ if ! ( rvm install 1.8.7 ); then
$rvm_scripts_path/log "fatal" "To proceed rvm requires a 1.8-compatible ruby is installed. We attempted to install 1.8.7 automatically but it failed."
$rvm_scripts_path/log "fatal" "Please install it manually (or a compatible alternative) to proceed."
compat_result=1
fi
- __rvm_unset_ruby_variables
- __rvm_become "$original_ruby"
unset original_ruby
return $compat_result
fi
}
@@ -704,9 +712,14 @@
# Install the default wrappers.
$rvm_scripts_path/wrapper "$environment_identifier" &> /dev/null
fi
unset rvm_creating_default_wrappers directory_name
fi
+}
+
+# Strip whitespace and normalize it all.
+__rvm_strip() {
+ sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' -e 's/[[:space:]]\{1,\}/ /g'
}
__rvm_using_gemset_globalcache() {
$rvm_scripts_path/db "$rvm_config_path/user" "use_gemset_globalcache" | grep -q '^true$'
}