scripts/utility in rvm-0.1.35 vs scripts/utility in rvm-0.1.36

- old
+ new

@@ -113,11 +113,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_flagrvm_rvmrc_flag rvm_gems_flag rvm_only_path_flag + 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_flagrvm_rvmrc_flag rvm_gems_flag rvm_only_path_flag rvm_docs_flag } # 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 @@ -354,14 +354,16 @@ # Save or restore the rvm's state. This is a toggle action. # Meant for use before and after an operation that might reset the currently selected ruby. __rvm_state() { if [[ -z "$rvm_state" ]] ; then - if [[ -z "$(command -v ruby | awk /$(basename $rvm_rubies_path)/)" ]] ; then - rvm_state=system - else - rvm_state="$(dirname "$(command -v ruby)" | xargs dirname | xargs basename)" + rvm_state="$(__rvm_environment_identifier)" + rvm_state="${rvm_state:-"system"}" + if [[ -n "$1" ]]; then + rvm_ruby_string="$1" + __rvm_select + __rvm_use fi else rvm_ruby_string="$rvm_state" __rvm_select __rvm_use @@ -547,10 +549,16 @@ export PKG_CONFIG_PATH="$rvm_usr_path/lib/pkgconfig:$PKG_CONFIG_PATH" PATH="$rvm_usr_path/bin:$PATH" } __rvm_environment_identifier() { - echo "$GEM_HOME" | xargs basename + ruby_string="$(command -v ruby)" + if [ -n "$ruby_string" ] && echo "$ruby_string" | grep -q -F "$rvm_rubies_path"; then + echo "$GEM_HOME" | xargs basename + else + echo "system" + fi + unset ruby_string } __rvm_ensure_has_enviroment_files() { local environment_identifier="$(__rvm_environment_identifier)" file_name="${rvm_environments_path}/$environment_identifier"