scripts/selector in rvm-0.0.80 vs scripts/selector in rvm-0.0.81

- old
+ new

@@ -16,35 +16,35 @@ if [[ "Darwin" = "$(uname)" ]] ; then rvm_ruby_package_name=${rvm_ruby_interpreter}-${rvm_ruby_version} if [[ "$rvm_head_flag" -eq 1 ]] ; then unset rvm_ruby_version rvm_ruby_tag rvm_ruby_revision="head" - rvm_ruby_repo_url=${rvm_ruby_repo_url:-"$(__rvm_db "macruby_repo_url")"} + rvm_ruby_repo_url=${rvm_ruby_repo_url:-"$($rvm_scripts_path/db "$rvm_config_path/db" "macruby_repo_url")"} rvm_url="$rvm_ruby_repo_url" rvm_ruby_string="${rvm_ruby_interpreter}-head" elif [[ "nightly" = "$rvm_ruby_version" ]] ; then rvm_url="http://macruby.icoretech.org/latest" rvm_ruby_string="${rvm_ruby_interpreter}-${rvm_ruby_version}" else - rvm_ruby_version="${rvm_ruby_version:-"$(__rvm_db "macruby_version")"}" + rvm_ruby_version="${rvm_ruby_version:-"$($rvm_scripts_path/db "$rvm_config_path/db" "macruby_version")"}" rvm_ruby_package_name="${rvm_ruby_interpreter}_nightly-${rvm_ruby_version}" rvm_ruby_package_file="MacRuby%200.5%20beta%201.zip" rvm_url="http://www.macruby.org/files/MacRuby%200.5%20beta%201.zip" rvm_ruby_string="${rvm_ruby_interpreter}-${rvm_ruby_version}" fi unset rvm_ruby_patch_level else - __rvm_log "fail" "MacRuby can only be installed on a Darwin OS." + $rvm_scripts_path/log "fail" "MacRuby can only be installed on a Darwin OS." fi ;; rbx|rubinius) rvm_ruby_interpreter="rbx" rvm_ruby_version="${rvm_ruby_version:-head}" unset rvm_ruby_patch_level - rvm_ruby_repo_url=${rvm_rbx_repo_url:-"$(__rvm_db "rubinius_repo_url")"} + rvm_ruby_repo_url=${rvm_rbx_repo_url:-"$($rvm_scripts_path/db "$rvm_config_path/db" "rubinius_repo_url")"} rvm_ruby_string="rbx-head" # for now :) rvm_url=$rvm_ruby_repo_url rvm_ruby_configure=" true " rvm_ruby_make="build" rvm_ruby_make_install="" @@ -53,25 +53,25 @@ jruby) unset rvm_ruby_patch_level if [[ "$rvm_head_flag" -eq 1 ]] ; then rvm_ruby_version="head" rvm_ruby_string="jruby-head" - rvm_ruby_repo_url="${rvm_ruby_repo_url:-$(__rvm_db "jruby_repo_url")}" - rvm_url="${rvm_ruby_repo_url:-$(__rvm_db "jruby_repo_url")}" + rvm_ruby_repo_url="${rvm_ruby_repo_url:-$($rvm_scripts_path/db "$rvm_config_path/db" "jruby_repo_url")}" + rvm_url="${rvm_ruby_repo_url:-$($rvm_scripts_path/db "$rvm_config_path/db" "jruby_repo_url")}" else - rvm_ruby_version="${rvm_ruby_version:-"$(__rvm_db "jruby_version")"}" + rvm_ruby_version="${rvm_ruby_version:-"$($rvm_scripts_path/db "$rvm_config_path/db" "jruby_version")"}" rvm_package_file="${rvm_ruby_interpreter}-bin-${rvm_ruby_version}" rvm_ruby_string="${rvm_ruby_interpreter}-${rvm_ruby_version}" rvm_url="http://jruby.kenai.com/downloads/${rvm_ruby_version}/${rvm_package_file}.tar.gz" fi alias jruby_ng="jruby --ng" alias jruby_ng_server="jruby --ng-server" ;; ree) rvm_ruby_interpreter=ree - rvm_ruby_version=${rvm_ruby_version:-"$(__rvm_db "ree_version")"} + rvm_ruby_version=${rvm_ruby_version:-"$($rvm_scripts_path/db "$rvm_config_path/db" "ree_version")"} if [[ ! -z "$rvm_ruby_patch_level" ]] ; then rvm_ruby_patch_level="$(echo $rvm_ruby_patch_level | sed 's#^p##')" rvm_ruby_string="${rvm_ruby_interpreter}-${rvm_ruby_version}-${rvm_ruby_patch_level}" elif [[ "$rvm_head_flag" = 1 ]] ; then rvm_ruby_string="${rvm_ruby_interpreter}-${rvm_ruby_version}-head" @@ -81,37 +81,37 @@ if [[ ! -z "$rvm_ruby_revision" ]] ; then unset rvm_ruby_patch_level rvm_ruby_package_file rvm_ruby_package_name="ree-$rvm_ruby_version-$rvm_ruby_revision" else rvm_ruby_package_file="ruby-enterprise-$rvm_ruby_version-$rvm_ruby_patch_level" - rvm_url="${rvm_url:-$(__rvm_db "${rvm_ruby_interpreter}_${rvm_ruby_version}_url")}/$rvm_ruby_package_file.tar.gz" + rvm_url="${rvm_url:-$($rvm_scripts_path/db "$rvm_config_path/db" "${rvm_ruby_interpreter}_${rvm_ruby_version}_url")}/$rvm_ruby_package_file.tar.gz" fi fi - if ! match "$rvm_ruby_version" "^1\.8" ; then - __rvm_log "fail" "Unknown Ruby Enterprise Edition version: $rvm_ruby_version" + if ! $rvm_scripts_path/match "$rvm_ruby_version" "^1\.8" ; then + $rvm_scripts_path/log "fail" "Unknown Ruby Enterprise Edition version: $rvm_ruby_version" fi ;; mput|shyouhei) rvm_ruby_interpreter="mput" rvm_ruby_version="head" rvm_ruby_string="mput-head" unset rvm_ruby_patch_level - rvm_ruby_repo_url=${rvm_mput_repo_url:-"$(__rvm_db "shyouhei_repo_url")"} + rvm_ruby_repo_url=${rvm_mput_repo_url:-"$($rvm_scripts_path/db "$rvm_config_path/db" "shyouhei_repo_url")"} rvm_url=$rvm_ruby_repo_url unset rvm_ruby_configure rvm_ruby_make rvm_ruby_make_install ;; ruby) - rvm_ruby_repo_url="${rvm_ruby_repo_url:-"$(__rvm_db "ruby_repo_url")"}" - if [[ -z "$rvm_ruby_version" ]] ; then __rvm_log "fail" "Unknown ruby version: $rvm_ruby_version" ; fi + rvm_ruby_repo_url="${rvm_ruby_repo_url:-"$($rvm_scripts_path/db "$rvm_config_path/db" "ruby_repo_url")"}" + if [[ -z "$rvm_ruby_version" ]] ; then $rvm_scripts_path/log "fail" "Unknown ruby version: $rvm_ruby_version" ; fi ;; current) ruby_binary="$(which binary)" - if match "$ruby_binary" "rvm" ; then + if $rvm_scripts_path/match "$ruby_binary" "rvm" ; then rvm_ruby_string="$(dirname "$ruby_binary" | xargs dirname | xargs basename)" else rvm_ruby_interpreter="system" fi ;; @@ -124,11 +124,11 @@ if [[ ! -z "$MY_RUBY_HOME" ]] ; then rvm_ruby_string=$(basename $MY_RUBY_HOME) __rvm_select else if [[ -z "$rvm_ruby_string" ]] ; then - __rvm_log "fail" "Ruby implementation '$rvm_ruby_interpreter' is not known." + $rvm_scripts_path/log "fail" "Ruby implementation '$rvm_ruby_interpreter' is not known." fi fi esac __rvm_gems_select @@ -171,15 +171,15 @@ if [[ -s $rvm_path/default ]] ; then source $rvm_path/default if [[ ! -z "$rvm_verbose_flag" ]] ; then - __rvm_log "info" "Now using default ruby." + $rvm_scripts_path/log "info" "Now using default ruby." fi else rvm_ruby_interpreter="system" - __rvm_log "warn" "no default rvm specified, defaulting to pre-rvm system." + $rvm_scripts_path/log "warn" "no default rvm specified, defaulting to pre-rvm system." unset GEM_HOME GEM_PATH MY_RUBY_HOME RUBY_VERSION IRBRC if [[ -s $rvm_path/system ]] ; then source $rvm_path/system ; fi fi elif [[ "system" = "$rvm_ruby_interpreter" ]] ; then @@ -201,35 +201,38 @@ rm -f /usr/local/bin/$binary done fi if [[ ! -z "$rvm_verbose_flag" ]] ; then - __rvm_log "info" "Now using system ruby." + $rvm_scripts_path/log "info" "Now using system ruby." fi rvm_ruby_string="system" else - GEM_HOME=$rvm_ruby_gem_home ; export GEM_HOME - GEM_PATH=$rvm_ruby_gem_home ; export GEM_PATH - MY_RUBY_HOME=$rvm_ruby_home ; export MY_RUBY_HOME - RUBY_VERSION=$rvm_ruby_string ; export RUBY_VERSION - IRBRC="$rvm_ruby_irbrc" ; export IRBRC + GEM_HOME=$rvm_ruby_gem_home + GEM_PATH=$rvm_ruby_gem_home + MY_RUBY_HOME=$rvm_ruby_home + RUBY_VERSION=$rvm_ruby_string + IRBRC="$rvm_ruby_irbrc" + + export GEM_HOME GEM_PATH MY_RUBY_HOME RUBY_VERSION IRBRC + if [[ -z "$IRBRC" ]] ; then unset IRBRC ; fi if [[ ! -d $MY_RUBY_HOME ]] ; then - __rvm_log "warn" "$rvm_ruby_interpreter $rvm_ruby_string is not installed." + $rvm_scripts_path/log "warn" "$rvm_ruby_interpreter $rvm_ruby_string is not installed." if [[ ! -z "$rvm_install_on_use_flag" ]] ; then __rvm_install_ruby $rvm_ruby_interpreter $rvm_ruby_version $rvm_ruby_patch_level else - __rvm_log "info" "To install do: 'rvm install $rvm_ruby_string'" + $rvm_scripts_path/log "info" "To install do: 'rvm install $rvm_ruby_string'" return 1 fi fi if [[ ! -z "$rvm_verbose_flag" ]] ; then - __rvm_log "info" "Now using $(echo $rvm_ruby_string | tr '-' ' ')" + $rvm_scripts_path/log "info" "Now using $(echo $rvm_ruby_string | tr '-' ' ')" fi __rvm_irbrc PATH=$(echo $PATH | tr ':' '\n' | awk '$0 !~ /rvm/' | paste -sd : -) @@ -238,10 +241,12 @@ if [[ "root" = "$(whoami)" ]] ; then for binary in erb gem irb rake rdoc ri ruby testrb ; do rm -f /usr/local/bin/$binary ln -nfs $rvm_ruby_home/bin/$binary /usr/local/bin/$binary + rm -f /usr/local/bin/passenger_ruby + ln -nfs $rvm_bin_path/$rvm_ruby_string /usr/local/bin/passenger_ruby done fi fi if [[ ! -z "$rvm_default_flag" ]] && [[ "default" != "$rvm_ruby_interpreter" ]] ; then @@ -263,13 +268,14 @@ echo "unset ${variable}" >> $rvm_path/default fi done ; unset variable value if [[ -s "$rvm_path/bin/$rvm_ruby_string" ]] ; then - ln -fs "$rvm_path/bin/$rvm_ruby_string" "$rvm_path/bin/default-ruby" # So that people know what it's for :) - ln -fs "$rvm_path/$rvm_ruby_string/bin/gem" "$rvm_path/bin/default-gem" - ln -fs "$rvm_path/$rvm_ruby_string/bin/irb" "$rvm_path/bin/default-irb" + rm -f $rvm_path/bin/default* + ln -fs "$rvm_path/bin/$rvm_ruby_string" "$rvm_path/bin/default_ruby" # So that people know what it's for :) + ln -fs "$rvm_path/$rvm_ruby_string/bin/gem" "$rvm_path/bin/default_gem" + ln -fs "$rvm_path/$rvm_ruby_string/bin/irb" "$rvm_path/bin/default_irb" else rm -f $rvm_path/bin/default* fi fi unset rvm_default_flag @@ -311,68 +317,74 @@ break elif [[ "nightly" = "$string" ]] ; then rvm_ruby_version="nightly" rvm_nightly_flag=1 break - elif match "$string" "^preview" ; then + elif $rvm_scripts_path/match "$string" "^preview" ; then rvm_ruby_patch_level="$string" - elif match "$string" "^[0-9]\.[0-9]" ; then + elif $rvm_scripts_path/match "$string" "^[0-9]\.[0-9]" ; then if [[ "1.8" = "$string" ]] ; then string="1.8.6" ; fi if [[ "1.9" = "$string" ]] ; then string="1.9.1" ; fi rvm_ruby_version="$string" unset rvm_ruby_revision rvm_ruby_tag - elif match "$string" "^p[0-9]" ; then + elif $rvm_scripts_path/match "$string" "^p[0-9]" ; then rvm_ruby_patch_level="$string" - elif match "$string" "^[0-9][0-9]" ; then + elif $rvm_scripts_path/match "$string" "^[0-9][0-9]" ; then if [[ "ree" = "$rvm_ruby_interpreter" ]] ; then rvm_ruby_patch_level="$string" unset rvm_ruby_revision else rvm_ruby_revision="r$string" fi - elif match "$string" "^r[0-9]" ; then + elif $rvm_scripts_path/match "$string" "^r[0-9]" ; then unset rvm_ruby_patch_level rvm_ruby_revision="$string" - elif match "$string" "^s[0-9]" ; then + elif $rvm_scripts_path/match "$string" "^s[0-9]" ; then unset rvm_ruby_revision rvm_ruby_sha="$string" - elif match "$string" "^t[v0-9]" ; then + elif $rvm_scripts_path/match "$string" "^t[v0-9]" ; then unset rvm_ruby_patch_level rvm_ruby_revision rvm_ruby_tag="$string" - elif match "$string" "^[a-z][a-z]" ; then + elif $rvm_scripts_path/match "$string" "^m[0-9]" ; then + rvm_ruby_mode="$string" + elif $rvm_scripts_path/match "$string" "^[a-z][a-z]" ; then rvm_ruby_interpreter="$string" else - __rvm_log "error" "Unknown ruby string component: '$string'" + $rvm_scripts_path/log "error" "Unknown ruby string component: '$string'" fi done # Unspecified interpreter if [[ -z "$rvm_ruby_interpreter" ]] ; then - if match "$rvm_ruby_version" "^1\.[8-9]" ; then + if $rvm_scripts_path/match "$rvm_ruby_version" "^1\.[8-9]" ; then rvm_ruby_interpreter="ruby" - elif match "$rvm_ruby_version" "^0.5" ; then + elif $rvm_scripts_path/match "$rvm_ruby_version" "^0.5" ; then rvm_ruby_interpreter="macruby" - elif match "$rvm_ruby_version" "^1.[2-4]" ; then + elif $rvm_scripts_path/match "$rvm_ruby_version" "^1.[2-4]" ; then rvm_ruby_interpreter="jruby" fi fi # Unspecified version if [[ -z "$rvm_ruby_version" ]] ; then - rvm_ruby_version=${rvm_ruby_version:-"$(__rvm_db "${rvm_ruby_interpreter}_version")"} + rvm_ruby_version=${rvm_ruby_version:-"$($rvm_scripts_path/db "$rvm_config_path/db" "${rvm_ruby_interpreter}_version")"} fi - rvm_ruby_string="${rvm_ruby_interpreter}-${rvm_ruby_version}" + if [[ -z "$rvm_ruby_version" ]] ; then + rvm_ruby_string="${rvm_ruby_interpreter}" + else + rvm_ruby_string="${rvm_ruby_interpreter}-${rvm_ruby_version}" + fi if [[ "$rvm_head_flag" -eq 1 ]] ; then rvm_ruby_string="${rvm_ruby_string}-head" elif [[ ! -z "$rvm_ruby_revision" ]] ; then rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_revision}" elif [[ ! -z "$rvm_ruby_tag" ]] ; then rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_tag}" elif [[ ! -z "$rvm_ruby_patch_level" ]] ; then rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_patch_level}" else - patch_level="$(__rvm_db "${rvm_ruby_interpreter}_${rvm_ruby_version}_patch_level")" + patch_level="$($rvm_scripts_path/db "$rvm_config_path/db" "${rvm_ruby_interpreter}_${rvm_ruby_version}_patch_level")" if [[ ! -z "$patch_level" ]] ; then rvm_ruby_patch_level="p${patch_level}" ; fi if [[ ! -z "$rvm_ruby_patch_level" ]] ; then rvm_ruby_patch_level="$(echo $rvm_ruby_patch_level | sed 's#^pp#p#')" rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_patch_level}" fi