scripts/selector in rvm-0.0.55 vs scripts/selector in rvm-0.0.56

- old
+ new

@@ -26,11 +26,11 @@ case "$rvm_ruby_interpreter" in macruby) if [ "`uname`" = "Darwin" ] ; then rvm_ruby_repo_url="${rvm_ruby_repo_url:-`__rvm_db "macruby_repo_url"`}" - rvm_ruby_version="head" + rvm_ruby_version="${rvm_ruby_version:-head}" rvm_ruby_package_name=${rvm_ruby_interpreter}-${rvm_ruby_version} #rvm_ruby_version="${rvm_ruby_version:-`__rvm_db "macruby_version"`}" #rvm_ruby_package_name=${rvm_ruby_interpreter}_nightly-${rvm_ruby_version} #rvm_url="http://dl.getdropbox.com/u/163257/$rvm_ruby_package_name.pkg" # 'nightly' builds unset rvm_ruby_patch_level @@ -38,19 +38,19 @@ __rvm_log "fail" "MacRuby can only be installed on a Darwin OS." fi ;; rbx|rubinius) - rvm_ruby_version="head" + rvm_ruby_interpreter="rbx" + rvm_ruby_version="${rvm_ruby_version:-head}" + #rvm_ruby_revision="head" unset rvm_ruby_patch_level - rvm_ruby_interpreter="rubinius" rvm_ruby_repo_url=${rvm_rbx_repo_url:-`__rvm_db "rubinius_repo_url"`} rvm_url=$rvm_ruby_repo_url rvm_ruby_configure="" rvm_ruby_make="build" rvm_ruby_make_install="" - #rvm_ruby_rev="head" ;; jruby) rvm_ruby_version="${rvm_ruby_version:-`__rvm_db "jruby_version"`}" rvm_jruby_repo_url="${rvm_jruby_repo_url:-"git://kenai.com/jruby~main"}" @@ -68,15 +68,15 @@ alias jruby_ng="jruby --ng" alias jruby_ng_server="jruby --ng-server" ;; ruby-enterprise|ree) - rvm_ruby_interpreter="ree" - rvm_ruby_interpreter=`__rvm_db "ree_interpreter"` + rvm_ruby_interpreter=ree rvm_ruby_version=${rvm_ruby_version:-`__rvm_db "ree_version"`} - rvm_ruby_patch_level="${3:-`__rvm_db "ree_${rvm_ruby_version}_patch_level"`}" - rvm_ruby_package_name="ruby-enterprise-$rvm_ruby_version-$rvm_ruby_patch_level" + rvm_ruby_patch_level="${rvm_ruby_revision:-`__rvm_db "ree_${rvm_ruby_version}_patch_level"`}" + rvm_ruby_package_name="ree-$rvm_ruby_version-$rvm_ruby_patch_level" + rvm_ruby_package_file="ruby-enterprise-$rvm_ruby_version-$rvm_ruby_patch_level" if [ -z "$(echo $rvm_ruby_version | awk '/^1\.8/')" ] ; then __rvm_log "fail" "Unknown Ruby Enterprise Edition version: $rvm_ruby_version" fi ;; @@ -84,15 +84,14 @@ if [ ! -z "$rvm_ruby_tag" ] ; then rvm_ruby_version=$(echo $rvm_ruby_tag | sed 's/^v//' | sed 's/\///' | awk -F'_' '{print 1 "." $2 "." $3 }') rvm_ruby_patch_level=$rvm_ruby_tag # $(echo $rvm_ruby_tag | sed 's/^v//' | sed 's/\///' | awk -F'_' '{print $4 }') fi if [ -z "$rvm_ruby_version" ] ; then - rvm_ruby_version=`__rvm_db "ruby_version"` # Default verison is 1.8.6 + rvm_ruby_version=$(__rvm_db "ruby_version") # Default verison is 1.8.6 fi - rvm_ruby_patch_level=${rvm_ruby_patch_level:-`__rvm_db "ruby_${rvm_ruby_version}_patch_level"`} # Default verison is 1.8.6 + rvm_ruby_patch_level=${rvm_ruby_patch_level:-$(__rvm_db "ruby_${rvm_ruby_version}_patch_level")} # Default verison is 1.8.6 if [ -z "rvm_ruby_patch_level" ] ; then unset rvm_ruby_patch_level ; fi - if [ -z "rvm_ruby_version" ] ; then __rvm_log "fail" "Unknown ruby version: $rvm_ruby_version" fi ;; @@ -107,72 +106,55 @@ else __rvm_log "fail" "Ruby implementation '$rvm_ruby_interpreter' is not known." fi esac - if [ ! -z "$rvm_ruby_rev" ] ; then - if [ "$rvm_ruby_rev" = "head" -o "$rvm_ruby_rev" = "trunk" ] ; then + if [ ! -z "$rvm_ruby_revision" ] ; then + if [ "$rvm_ruby_revision" = "head" -o "$rvm_ruby_revision" = "trunk" ] ; then rvm_ruby_patch_level="head" else - rvm_ruby_patch_level="$rvm_ruby_rev" + rvm_ruby_patch_level="$rvm_ruby_revision" fi fi - if [ -z "$rvm_gem_set_name" ] ; then - gemset=$(gem env gemdir | xargs basename | sed "s/${rvm_ruby_version}-//") - if [ "$gemset" != "$rvm_ruby_version" -a -z "$(echo $gemset | awk '/^[0-9]/')" ] ; then - rvm_gem_set_name="$gemset" - else - unset rvm_gem_set_name - fi ; unset gemset - fi + __rvm_gems_select if [ ! -z "$rvm_ruby_interpreter" -a ! -z "$rvm_ruby_version" -a "$rvm_ruby_interpreter" != "system" ] ; then rvm_major_version=$(echo $rvm_ruby_version | awk -F'.' '{ print $2 }') rvm_minor_version=$(echo $rvm_ruby_version | awk -F'.' '{ print $3 }') - if [ -z "$rvm_gem_set_name" ] ; then - rvm_gem_home="$rvm_gem_path/$rvm_ruby_interpreter/$rvm_ruby_version" - else - if [ ! -z "$rvm_gem_set_name_rm" -a -d $rvm_gem_path/$rvm_ruby_interpreter/$rvm_ruby_version-$rvm_gem_set_name ] ; then - rm -rf $rvm_gem_path/$rvm_ruby_interpreter/$rvm_ruby_version-$rvm_gem_set_name/ - if [ "$rvm_gem_set_name_rm" = "$rvm_gem_set_name" ] ; then unset rvm_gem_set_name ; fi - else - rvm_gem_home="$rvm_gem_path/$rvm_ruby_interpreter/$rvm_ruby_version-$rvm_gem_set_name" - fi - fi + __rvm_gems_select - mkdir -p $rvm_gem_home - if [ -z "$rvm_ruby_patch_level" ] ; then rvm_ruby_package_name="${rvm_ruby_package_name:-"$rvm_ruby_interpreter-$rvm_ruby_version"}" rvm_ruby_home="${rvm_ruby_home:-"$rvm_path/$rvm_ruby_interpreter-$rvm_ruby_version"}" else - if [ "$rvm_ruby_interpreter" != "ruby-enterprise" ] ; then + if [ "$rvm_ruby_interpreter" != "ree" ] ; then if [ ! -z "`echo $rvm_ruby_patch_level | awk '/^[0-9]/'`" ] ; then rvm_ruby_patch_level="p$rvm_ruby_patch_level" fi rvm_ruby_patch_level="`echo $rvm_ruby_patch_level | sed 's/^pp/p/'`" # sanity check, thanks sfpyra fi rvm_ruby_package_name="${rvm_ruby_package_name:-"$rvm_ruby_interpreter-$rvm_ruby_version-$rvm_ruby_patch_level"}" rvm_ruby_home="${rvm_ruby_home:-"$rvm_path/$rvm_ruby_interpreter-$rvm_ruby_version-$rvm_ruby_patch_level"}" fi + rvm_ruby_string="$rvm_ruby_package_name" rvm_ruby_log_path="$rvm_log_path/$rvm_ruby_package_name" - rvm_ruby_src_path="$rvm_source_path/$rvm_ruby_string" + rvm_ruby_src_path="$rvm_src_path/$rvm_ruby_string" rvm_ruby_binary="$rvm_ruby_home/bin/ruby" rvm_ruby_irbrc="$rvm_ruby_home/.irbrc" - rvm_selected=1 + rvm_selected_flag=1 - export rvm_ruby_interpreter rvm_ruby_version rvm_ruby_repo_url rvm_ruby_package_name rvm_url rvm_ruby_patch_level rvm_ruby_configure rvm_ruby_make rvm_ruby_make_install rvm_ruby_rev rvm_ruby_tag rvm_major_version rvm_minor_version rvm_gem_set_name rvm_gem_path rvm_gem_home rvm_path rvm_source_path rvm_bin_path rvm_ruby_binary rvm_ruby_home rvm_log_path rvm_ruby_log_path rvm_source_path rvm_ruby_src_path rvm_ruby_irbrc rvm_selected rvm_ruby_string + export rvm_ruby_interpreter rvm_ruby_version rvm_ruby_repo_url rvm_ruby_package_name rvm_url rvm_ruby_patch_level rvm_ruby_configure rvm_ruby_make rvm_ruby_make_install rvm_ruby_revision rvm_ruby_tag rvm_major_version rvm_minor_version rvm_gem_set_name rvm_gem_path rvm_ruby_gem_home rvm_path rvm_src_path rvm_bin_path rvm_ruby_binary rvm_ruby_home rvm_log_path rvm_ruby_log_path rvm_src_path rvm_ruby_src_path rvm_ruby_irbrc rvm_selected_flag rvm_ruby_string else - rvm_gem_home=$GEM_HOME + rvm_ruby_gem_home=$GEM_HOME fi } function __rvm_use { - if [ -z "$rvm_selected" ] ; then __rvm_select $* ; fi + if [ -z "$rvm_selected_flag" ] ; then __rvm_select $* ; fi if [ -z "$rvm_ruby_interpreter" ] ; then rvm_ruby_interpreter="default" ; fi if [ "$rvm_ruby_interpreter" = "default" ] ; then PATH=$(echo $PATH | tr ':' '\n' | awk '$0 !~ /rvm/' | paste -sd : -) @@ -200,12 +182,12 @@ source $rvm_path/system fi fi else - GEM_HOME=$rvm_gem_home ; export GEM_HOME - GEM_PATH=$rvm_gem_home ; export GEM_PATH + 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_package_name ; export RUBY_VERSION IRBRC="$rvm_ruby_irbrc" ; export IRBRC if [ -z "$IRBRC" ] ; then unset IRBRC ; fi @@ -253,36 +235,56 @@ fi fi unset rvm_default_flag fi - if [ ! -z "$rvm_load_flag" ] ; then __rvm_gemset_load ; fi - if [ ! -z "$rvm_dump_flag" ] ; then __rvm_gemset_dump ; fi + if [ ! -z "$rvm_load_flag" ] ; then __rvm_gems_load ; fi + if [ ! -z "$rvm_dump_flag" ] ; then __rvm_gems_dump ; fi } function __rvm_ruby_string { if [ "$rvm_ruby_interpreter" = "system" ] ; then rvm_ruby_string="system" elif [ ! -z "$rvm_ruby_string" ] ; then - rvm_ruby_string=`echo "$rvm_ruby_string" | sed 's/ruby-enterprise/ree/g'` # dash-antics :) - rvm_ruby_interpreter=`echo $rvm_ruby_string | tr '-' ' ' | awk '{print $1}'` - rvm_ruby_version=`echo $rvm_ruby_string | awk -F'-' '{print $2}'` - revision=`echo $rvm_ruby_string | awk -F'-' '{print $3}'` + ruby_string=$(echo "$rvm_ruby_string" | sed 's/ruby-enterprise/ree/g') # dash-antics : + __rvm_unset_ruby_variables + rvm_ruby_interpreter=$(echo $ruby_string | awk -F'-' '{print $1}') + rvm_ruby_version=$(echo $ruby_string | awk -F'-' '{print $2}') + if [ ! -z "$(echo $rvm_ruby_interpreter | awk '/^1\.[8-9]/')" ] ; then + rvm_ruby_patch_level=$rvm_ruby_version + rvm_ruby_version=$rvm_ruby_interpreter + rvm_ruby_interpreter="ruby" + if [ -z "$rvm_ruby_patch_level" ] ; then + rvm_ruby_patch_level="${rvm_ruby_patch_level:-$(__rvm_db "${rvm_ruby_interpreter}_${rvm_ruby_version}_patch_level")}" + fi + elif [ ! -z "$(echo $rvm_ruby_interpreter | awk '/^1\.[3-4]/')" ] ; then + rvm_ruby_version=$rvm_ruby_interpreter + rvm_ruby_interpreter=jruby + unset rvm_ruby_patch_level + fi + + if [ "$rvm_ruby_version" = "head" ] ; then + revision="head" + if [ "$rvm_ruby_interpreter" = "ree" ] ; then rvm_ruby_version="1.8.7" ; fi + if [ "$rvm_ruby_interpreter" = "rbx" ] ; then unset revision ; fi + else + revision=$(echo $ruby_string | awk -F'-' '{print $3}') + fi + if [ "$revision" = "head" -o "$revision" = "preview" ] ; then rvm_ruby_revision="$revision" else - echo $revision | grep '^p[0-9]\+' > /dev/null - if [ $? -eq 0 ] ; then - rvm_ruby_patch_level=`echo $revision | awk -F'p' '{print $2}'` + if [ ! -z "$(echo $revision | awk '/^p[0-9]\+/')" ] ; then + rvm_ruby_patch_level=${rvm_ruby_patch_level:-$(echo $revision | awk -F'p' '{print $2}')} else - echo $revision | grep '^[0-9]\+' > /dev/null - if [ $? -eq 0 ] ; then - rvm_ruby_rev="$revision" + if [ ! -z "$(echo $revision | awk '/^[0-9]\+/')" ] ; then + rvm_ruby_revision="$revision" else - unset rvm_ruby_patch_level rvm_ruby_rev + unset rvm_ruby_revision fi fi fi + unset ruby_string fi return 0 }