scripts/utility in rvm-0.1.44 vs scripts/utility in rvm-0.1.45

- old
+ new

@@ -52,11 +52,11 @@ [[ "$?" -gt 0 ]] && rm -rf "$dump_environment_file" fi fi unset rvm_dump_environment_flag } - + # 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 @@ -212,16 +212,16 @@ __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_sticky_flag rvm_rvmrc_flag rvm_gems_flag rvm_only_path_flag rvm_docs_flag rvm_ruby_aliases rvm_ruby_aliases rvm_patch_names rvm_clang_flag rvm_install_arguments rvm_dump_environment_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_sticky_flag rvm_rvmrc_flag rvm_gems_flag rvm_only_path_flag rvm_docs_flag rvm_ruby_aliases rvm_patch_names rvm_clang_flag rvm_install_arguments rvm_dump_environment_flag rvm_ruby_alias } # 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 + 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_strings rvm_ruby_repo_path } # Usage: __rvm_with_env 'env-name' 'command' __rvm_with_env() { [[ -n "$rvm_trace_flag" ]] && rvm_env_args="--trace" @@ -290,11 +290,11 @@ mv .rvmrc .rvmrc.$(date +%m.%d.%Y-%H:%M:%S) $rvm_scripts_path/log "warning" ".rvmrc is not empty, moving aside to preserve." fi local identifier=$(__rvm_environment_identifier) - printf "if [[ -s \"$rvm_environments_path/$identifier\" ]] ; then\n . \"$rvm_environments_path/$identifier\"" > .rvmrc + printf "if [[ -n \"\$rvm_environments_path\" && -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." @@ -453,11 +453,11 @@ if [[ "$rvm_head_flag" == "1" ]] ; then if [[ -d "$rvm_src_path/rvm/.git" ]] ; then builtin cd "$rvm_src_path/rvm/" && git pull origin master && ./scripts/install else - builtin cd "$rvm_src_path" && git clone http://github.com/wayneeseguin/rvm.git && builtin cd rvm/ && ./scripts/install + builtin cd "$rvm_src_path" && ( git clone --depth 1 git://github.com/wayneeseguin/rvm.git || git clone http://github.com/wayneeseguin/rvm.git ) && builtin cd rvm/ && ./scripts/install fi else stable_version="$(curl -s http://rvm.beginrescueend.com/releases/stable-version.txt)" __rvm_run "fetch" "$rvm_scripts_path/fetch 'http://rvm.beginrescueend.com/releases/rvm-${stable_version}.tar.gz'" "fetching rvm-${stable_version}.tar.gz" @@ -585,19 +585,19 @@ __rvm_become() { [[ -n "$1" ]] && rvm_ruby_string="$1" { __rvm_ruby_string && __rvm_select && __rvm_use; } > /dev/null 2>&1 } -__rvm_ensure_has_enviroment_files() { +__rvm_ensure_has_environment_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" + rm -f "$file_name" 2>&1 | grep -v 'rm: cannot remove .* Permission denied' mkdir -p "$(dirname "$file_name")" - touch "$file_name" + touch "$file_name" 2>&1 | grep -v 'touch: cannot touch .* Permission denied' return fi if [[ ! -s "$file_name" ]] ; then mkdir -p "${rvm_environments_path}" @@ -722,15 +722,29 @@ else return 1 fi } - __rvm_environment_identifier() { 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 -} \ No newline at end of file +} + +__rvm_expand_ruby_string() { + if [[ -z "$1" || "$1" = "all" || "$1" == "all-gemsets" ]]; then + $rvm_scripts_path/list gemsets strings + elif [[ "$1" == "all-rubies" || "$1" == "rubies" ]]; then + $rvm_scripts_path/list strings | tr ' ' "\n" + elif [[ "$1" == "current" || "$1" == "gemsets" ]]; then + local current_ruby="$(__rvm_environment_identifier | awk -F"$rvm_gemset_separator" '{print $1}')" + rvm_silence_logging=1 $rvm_scripts_path/gemsets list | sed "s/^/$current_ruby$rvm_gemset_separator/" + elif [[ "$1" == "aliases" ]]; then + cat "$rvm_config_path/alias" | awk -F= '{print $1}' + else + echo "$1" | tr "," "\n" | __rvm_strip + fi +}