scripts/selector in rvm-1.1.1 vs scripts/selector in rvm-1.1.2

- old
+ new

@@ -160,10 +160,20 @@ if ! "$rvm_path/scripts/match" "$rvm_ruby_version" "^1\.8" ; then "$rvm_path/scripts/log" "fail" "Unknown Ruby Enterprise Edition version: $rvm_ruby_version" fi ;; + goruby) + rvm_ruby_interpreter="goruby" + rvm_ruby_version="head" + rvm_ruby_string="goruby" + rvm_ruby_patch_level="" + rvm_ruby_repo_url=${rvm_mput_repo_url:-"$(__rvm_db "goruby_repo_url")"} + rvm_ruby_url=$rvm_ruby_repo_url + rvm_ruby_configure="" ; rvm_ruby_make="" ; rvm_ruby_make_install="" + ;; + ruby) if [[ -z "${rvm_ruby_version:-""}" && ${rvm_head_flag:-0} -eq 0 ]]; then "$rvm_path/scripts/log" "fail" "Ruby version was not specified!" else @@ -244,60 +254,66 @@ else rvm_ruby_interpreter="${rvm_ruby_interpreter:-system}" fi } -__rvm_use() -{ - local new_path binary full_binary_path rvm_ruby_gem_home +__rvm_use_system() { - #if [[ ${rvm_ruby_selected_flag:-0} -eq 0 ]] ; then __rvm_select "$@" ; fi - __rvm_select "$@" + unset GEM_HOME GEM_PATH MY_RUBY_HOME RUBY_VERSION IRBRC - if [[ -z "${rvm_ruby_interpreter:-""}" ]] ; then rvm_ruby_interpreter="system" ; fi + new_path="$(__rvm_remove_rvm_from_path ; printf "$PATH"):${rvm_bin_path:-"$rvm_path/bin"}" - if [[ "system" = "$rvm_ruby_interpreter" ]] ; then + if [[ -s "$rvm_path/config/system" ]] ; then - unset GEM_HOME GEM_PATH MY_RUBY_HOME RUBY_VERSION IRBRC + \grep "MY_RUBY_HOME='$rvm_path/rubies" "$rvm_path/config/system" > /dev/null - new_path="$(__rvm_remove_rvm_from_path ; printf "$PATH"):${rvm_bin_path:-"$rvm_path/bin"}" + if [[ $? -eq 0 ]] ; then + # 'system' should *not* point to an rvm ruby. + [[ -f "$rvm_path/config/system" ]] && \rm -f "$rvm_path/config/system" + else + source "$rvm_path/config/system" + fi + fi - if [[ -s "$rvm_path/config/system" ]] ; then + # Check binaries, remove under the condition they're symlinks. + if [[ ${rvm_selfcontained:-1} -eq 0 ]] ; then - \grep "MY_RUBY_HOME='$rvm_path/rubies" "$rvm_path/config/system" > /dev/null + for binary in ruby gem irb ri rdoc rake erb testrb ; do - if [[ $? -eq 0 ]] ; then - # 'system' should *not* point to an rvm ruby. - [[ -f "$rvm_path/config/system" ]] && \rm -f "$rvm_path/config/system" - else - source "$rvm_path/config/system" - fi - fi + full_binary_path="${rvm_bin_path:-"$rvm_path/bin"}/$binary" - # Check binaries, remove under the condition they're symlinks. - if [[ ${rvm_selfcontained:-1} -eq 0 ]] ; then + [[ -L "$full_binary_path" ]] && \rm -f "$full_binary_path" - for binary in ruby gem irb ri rdoc rake erb testrb ; do + done - full_binary_path="${rvm_bin_path:-"$rvm_path/bin"}/$binary" + fi - [[ -L "$full_binary_path" ]] && \rm -f "$full_binary_path" + if [[ ${rvm_verbose_flag:-0} -gt 0 ]] ; then + "$rvm_path/scripts/log" "info" "Now using system ruby." + fi - done + __rvm_remove_rvm_from_path - fi + new_path="$PATH:${rvm_bin_path:-"$rvm_path/bin"}" - if [[ ${rvm_verbose_flag:-0} -gt 0 ]] ; then - "$rvm_path/scripts/log" "info" "Now using system ruby." - fi + export rvm_ruby_string="system" - __rvm_remove_rvm_from_path +} - new_path="$PATH:${rvm_bin_path:-"$rvm_path/bin"}" +__rvm_use() +{ + local new_path binary full_binary_path rvm_ruby_gem_home - export rvm_ruby_string="system" + #if [[ ${rvm_ruby_selected_flag:-0} -eq 0 ]] ; then __rvm_select "$@" ; fi + __rvm_select "$@" + if [[ -z "${rvm_ruby_interpreter:-""}" ]] ; then rvm_ruby_interpreter="system" ; fi + + if [[ "system" = "$rvm_ruby_interpreter" ]] ; then + + __rvm_use_system + else unset BUNDLE_PATH # Ensure that BUNDLE_PATH is not set! GEM_HOME="$rvm_ruby_gem_home" GEM_PATH="$rvm_ruby_gem_home:$rvm_ruby_global_gems_path" MY_RUBY_HOME="$rvm_ruby_home" @@ -359,10 +375,11 @@ "$rvm_path/scripts/wrapper" "$rvm_ruby_string" --no-prefix else "$rvm_path/scripts/wrapper" "$rvm_ruby_string" "default" fi + if [[ "system" = "$rvm_ruby_interpreter" ]] ; then "$rvm_path/scripts/alias" delete default &> /dev/null \find "${rvm_bin_path:-"$rvm_path/bin"}" -name 'default_*' -maxdepth 0 -delete \rm -f "$rvm_path/config/default" \rm -f "$rvm_path/environments/default" @@ -398,10 +415,19 @@ if [[ -x "$MAGLEV_HOME/gemstone/bin/gslist" ]] ; then "$MAGLEV_HOME/gemstone/bin/gslist" -clv > /dev/null 2>&1 ; result=$? if [[ $result -eq 1 ]] ; then "$rvm_ruby_home/bin/maglev" start ; fi fi fi + + else + + if [[ ${rvm_default_flag:-0} -eq 1 ]] ; then + + __rvm_reset + + fi + fi rvm_hook="after_use" ; source "$rvm_path/scripts/hook" return 0 @@ -593,10 +619,10 @@ n*) rvm_ruby_name="${string/n/}" ;; - ruby|rbx|jruby|macruby|ree|rubinius|maglev|ironruby) + ruby|rbx|jruby|macruby|ree|rubinius|maglev|ironruby|goruby) rvm_ruby_interpreter="$string" ;; *) "$rvm_path/scripts/log" "error" \