scripts/utility in rvm-0.1.37 vs scripts/utility in rvm-0.1.38
- old
+ new
@@ -113,29 +113,31 @@
__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 rvm_docs_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_flag rvm_rvmrc_flag rvm_gems_flag rvm_only_path_flag rvm_docs_flag rvm_ruby_aliases
}
# 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
}
__rvm_set_rvmrc() {
if [[ "$HOME" != "$(pwd)" ]] ; then
- if [[ "$rvm_create_flag" -eq 1 ]] ; then flags="--create " ; fi
if [[ "$rvm_verbose_flag" -eq 1 ]] ; then flags="use " ; fi
if [[ -s .rvmrc ]] ; then
mv .rvmrc .rvmrc.$(date +%m.%d.%Y-%H:%M:%S)
$rvm_scripts_path/log "warning" ".rvmrc is not empty, moving aside to preserve."
fi
- echo "rvm $flags $(basename $rvm_ruby_gem_home)" > .rvmrc
+ local identifier=$(__rvm_environment_identifier)
+ printf "if [[ -s \"$rvm_environments_path/$identifier\" ]] ; then\n . \"$rvm_environments_path/$identifier\"" > .rvmrc
+ printf "\nelse\n rvm --create $flags \"$identifier\"\nfi" >> .rvmrc
+
unset flags
else
$rvm_scripts_path/log "error" ".rvmrc cannot be set in your home directory. \n The home .rvmrc is for global rvm settings only."
fi
@@ -539,12 +541,26 @@
echo "system"
fi
unset ruby_string
}
+__rvm_become() {
+ [[ -n "$1" ]] && rvm_ruby_string="$1"
+ { __rvm_ruby_string && __rvm_select && __rvm_use; } > /dev/null 2>&1
+}
+
__rvm_ensure_has_enviroment_files() {
local environment_identifier="$(__rvm_environment_identifier)"
file_name="${rvm_environments_path}/$environment_identifier"
+
+ # Ensure system is a blank file.
+ if [[ "$environment_identifier" == "system" ]]; then
+ rm -f "$file_name"
+ mkdir -p "$(dirname "$file_name")"
+ touch "$file_name"
+ return
+ fi
+
if [[ ! -s "$file_name" ]] ; then
mkdir -p "${rvm_environments_path}"
echo "export PATH=\"${rvm_ruby_gem_home}/bin:${rvm_ruby_global_gems_path}/bin:${rvm_ruby_home}/bin:${rvm_bin_path}:\$PATH\"" > $file_name
for variable in RUBY_VERSION GEM_HOME GEM_PATH BUNDLE_PATH MY_RUBY_HOME IRBRC rvm_ruby_string rvm_gemset_name MAGLEV_HOME ; do
eval "export $variable"