scripts/rvm-selector in wayneeseguin-rvm-0.0.35 vs scripts/rvm-selector in wayneeseguin-rvm-0.0.36

- old
+ new

@@ -4,10 +4,16 @@ function __rvm_select { 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)}') + if [ ! -z "$(echo $temp | grep '[0-9]')" ] ; then + rvm_ruby_version=$rvm_ruby_interpreter + rvm_ruby_interpreter="ruby" + fi ; unset temp + if [ "$rvm_ruby_version" = "1.8" ] ; then rvm_ruby_version="1.8.6" ; fi if [ "$rvm_ruby_version" = "1.9" ] ; then rvm_ruby_version="1.9.1" ; fi case "$rvm_ruby_interpreter" in @@ -43,11 +49,11 @@ alias jruby_ng_server="jruby --ng-server" ;; ruby-enterprise|ree) rvm_ruby_interpreter=`__rvm_db "ree_interpreter"` - rvm_ruby_version=${rvm_ruby_version:-`__rvm_db "ruby_version"`} + rvm_ruby_version=${rvm_ruby_version:-`__rvm_db "ree_version"`} rvm_ruby_patch_level="${3:-`__rvm_db "ree_patch_level"`}" if [ "$rvm_ruby_version" != "1.8.6" ] ; then __rvm_log "fail" "Unknown Ruby Enterprise Edition version: $rvm_ruby_version" fi @@ -113,11 +119,11 @@ 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 else - unset rvm_selected + rvm_gem_home=$GEM_HOME fi } function __rvm_use { @@ -133,19 +139,20 @@ fi else GEM_HOME=$rvm_gem_home ; export GEM_HOME MY_RUBY_HOME=$rvm_ruby_home ; export MY_RUBY_HOME 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." __rvm_install-ruby $rvm_ruby_interpreter $rvm_ruby_version $rvm_ruby_patch_level fi if [ ! -s "$rvm_ruby_irbrc" ] ; then - rvm_irbrc_file=$(cat <<Config + rvm_irbrc_file=`cat <<Config ; # No, this is not a stray ';' :) require "irb/completion" rescue nil @prompt = { :PROMPT_I => "${rvm_ruby_package_name} > ", # default prompt :PROMPT_S => "${rvm_ruby_package_name}%l> ", # known continuation @@ -156,14 +163,15 @@ } @prompt_mode = :DEFAULT IRB.conf[:PROMPT][@prompt_mode] = @prompt IRB.conf[:PROMPT_MODE] = @prompt_mode Config -) +` if [ -s ~/.irbrc ] ; then cp ~/.irbrc $rvm_ruby_home/.irbrc fi + touch $rvm_ruby_home/.irbrc echo "$rvm_irbrc_file" >> $rvm_ruby_home/.irbrc fi PATH="$MY_RUBY_HOME/bin:$GEM_HOME/bin:$rvm_path/bin:$rvm_default_path" ; export PATH rvm_prompt="$rvm_ruby_package_name" ; export rvm_prompt @@ -173,15 +181,19 @@ if [ ! -z "$rvm_set_default" ] ; then RUBY_VERSION="$($MY_RUBY_HOME/bin/ruby -v | sed 's/^\(.*\) (.*$/\1/')" export GEM_HOME MY_RUBY_HOME RUBY_VERSION - echo "PATH=$MY_RUBY_HOME/bin:$GEM_HOME/bin:$rvm_path/bin:$rvm_default_path ; export PATH" > $rvm_path/current + echo "PATH=$MY_RUBY_HOME/bin:$GEM_HOME/bin:$rvm_path/bin:\$PATH ; export PATH" > $rvm_path/current - for variable in rvm_prompt RUBY_VERSION GEM_HOME MY_RUBY_HOME ; do + for variable in rvm_prompt RUBY_VERSION GEM_HOME MY_RUBY_HOME IRBRC ; do eval "export $variable" eval value=\$${variable} - echo "${variable}='$value' ; export ${variable}" >> $rvm_path/current + if [ ! -z "$variable" ] ; then + echo "${variable}='$value' ; export ${variable}" >> $rvm_path/current + else + echo "unset ${variable}" >> $rvm_path/current + fi done fi fi }