scripts/rvm-selector in wayneeseguin-rvm-0.0.40 vs scripts/rvm-selector in wayneeseguin-rvm-0.0.42

- old
+ new

@@ -1,11 +1,11 @@ #!/bin/bash # __rvm_select implementation version patch_level function __rvm_select { - __rvm_ruby_string + if [ ! -z "$rvm_ruby_string" ] ; then __rvm_ruby_string ; fi rvm_ruby_interpreter="${1:-$rvm_ruby_interpreter}" rvm_ruby_interpreter="${rvm_ruby_interpreter:-ruby}" # Default is standard ruby temp=$(echo $rvm_ruby_interpreter | awk '{print substr($1, 0, 1)}') @@ -20,13 +20,15 @@ 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="${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" # For now we are only supporting the 'nightly' builds + 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 else __rvm_log "fail" "MacRuby can only be installed on a Darwin OS." fi ;; @@ -65,12 +67,13 @@ ruby) 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 - - rvm_ruby_version=${rvm_ruby_version:-`__rvm_db "ruby_version"`} # Default verison is 1.8.6 + if [ -z "$rvm_ruby_version" ] ; then + 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 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" @@ -105,21 +108,21 @@ else rvm_gem_home="$rvm_gem_path/$rvm_ruby_interpreter/$rvm_ruby_version-$rvm_gem_set_name" fi fi - if [ ! -z "$rvm_load" ] ; then __rvm_gemset_load ; fi - if [ ! -z "$rvm_dump" ] ; then __rvm_gemset_dump ; fi - 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 [ "`echo $rvm_ruby_patch_level | awk '{print substr($1, 0, 1)}'`" != "p" ] ; then - rvm_ruby_patch_level="p$rvm_ruby_patch_level" + if [ "$rvm_ruby_interpreter" != "ruby-enterprise" ] ; then + if [ ! -z "`echo $rvm_ruby_patch_level | awk '/[0-9]+/{print}'`" ] ; 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_log_path="$rvm_log_path/$rvm_ruby_package_name" @@ -127,12 +130,15 @@ rvm_ruby_binary="$rvm_ruby_home/bin/ruby" rvm_ruby_irbrc="$rvm_ruby_home/.irbrc" rvm_ruby_string="$rvm_ruby_package_name" rvm_selected=1 - export rvm_ruby_interpreter rvm_ruby_version rvm_ruby_repo_url rvm_ruby_version 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_package_name 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_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 + if [ ! -z "$rvm_load_flag" ] ; then __rvm_gemset_load ; fi + if [ ! -z "$rvm_dump_flag" ] ; then __rvm_gemset_dump ; fi + else rvm_gem_home=$GEM_HOME fi } @@ -154,10 +160,11 @@ fi elif [ "$rvm_ruby_interpreter" = "system" ] ; then unset GEM_HOME GEM_PATH MY_RUBY_HOME RUBY_VERSION IRBRC + # TODO: Remove .rvm/bin from the path PATH="$rvm_system_path" ; export PATH if [ -s $rvm_path/system ] ; then grep "^MY_RUBY_HOME='$rvm_path" "$rvm_path/system" > /dev/null if [ $? -eq 0 ] ; then rm -f $rvm_path/system # 'system' should *not* point to an rvm ruby. @@ -172,28 +179,22 @@ 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 - # Install if not installed if [ ! -d $MY_RUBY_HOME ] ; then __rvm_log "warn" "$rvm_ruby_interpreter $rvm_ruby_version is not installed." - echo -n -e "Would you like rvm to install $rvm_ruby_interpreter $rvm_ruby_version for you now?\n(Y/n) ? " - read response - if [ "$response" = 'n' ] ; then - __rvm_log "warn" "Please run 'rvm install $rvm_ruby_interpreter $rvm_ruby_version' if you wish to use it.\n" - return 0 - else + if [ ! -z "$rvm_install_on_use" ] ; then __rvm_install-ruby $rvm_ruby_interpreter $rvm_ruby_version $rvm_ruby_patch_level fi fi __rvm_irbrc PATH="$MY_RUBY_HOME/bin:$GEM_HOME/bin:$rvm_path/bin:$rvm_system_path" ; export PATH - if [ ! -z "$rvm_set_default" ] ; then + if [ ! -z "$rvm_default_flag" ] ; then RUBY_VERSION="$($MY_RUBY_HOME/bin/ruby -v | sed 's/^\(.*\) (.*$/\1/')" export GEM_HOME GEM_PATH MY_RUBY_HOME RUBY_VERSION echo "PATH=$MY_RUBY_HOME/bin:$GEM_HOME/bin:$rvm_path/bin:\$PATH ; export PATH" > $rvm_path/default @@ -211,16 +212,12 @@ ln -fs $rvm_path/bin/$rvm_ruby_package_name $rvm_path/bin/ruby ln -fs $rvm_path/bin/$rvm_ruby_package_name $rvm_path/bin/default-ruby # So that people know what it's for :) ln -fs $rvm_path/bin/gem-$rvm_ruby_package_name $rvm_path/bin/gem ln -fs $rvm_path/bin/irb-$rvm_ruby_package_name $rvm_path/bin/irb else - rm -f $rvm_path/bin/ruby - rm -f $rvm_path/bin/default-ruby - rm -f $rvm_path/bin/gem - rm -f $rvm_path/bin/irb + rm -f $rvm_path/bin/ruby $rvm_path/bin/default-ruby $rvm_path/bin/gem $rvm_path/bin/irb fi - - unset rvm_set_default + unset rvm_default_flag fi fi }