scripts/rvm-install in rvm-1.1.0 vs scripts/rvm-install in rvm-1.1.1

- old
+ new

@@ -204,17 +204,28 @@ exit 1 ;; esac done -if [[ -z "${rvm_prefix:-""}" ]] ; then - __rvm_load_rvmrc - if [[ "$rvm_selfcontained" = "0" ]] ; then - rvm_prefix="${rvm_prefix:-"/usr/local/"}" +if [[ -z "${rvm_prefix:-""}" ]] ; then + + if [[ "$USER" = "root" ]] ; then + + source /etc/rvmrc + + if [[ ${rvm_selfcontained:-0} -eq 0 ]] ; then + rvm_prefix="${rvm_prefix:-"/usr/local/"}" + else + rvm_prefix="${rvm_prefix:-"$HOME/."}" + fi + else + rvm_prefix="${rvm_prefix:-"$HOME/."}" + fi + fi if [[ -z "${rvm_path:-""}" ]] ; then rvm_path="${rvm_prefix}rvm" fi @@ -462,11 +473,11 @@ # # Migrate ~/.rvm/ruby-X,jruby-X,... to ~/.rvm/rubies/ for 0.1.0. # mkdir -p "${rvm_rubies_path:-"$rvm_path/rubies"}/" -for ruby in $rvm_path/ruby-* $rvm_path/jruby-* $rvm_path/mput-* \ +for ruby in $rvm_path/ruby-* $rvm_path/jruby-* \ $rvm_path/rbx-* $rvm_path/maglev-* $rvm_path/ree-* ; do if [[ -d "$ruby" ]] ; then mv "$ruby" "${rvm_rubies_path:-"$rvm_path/rubies"}/" @@ -493,9 +504,21 @@ done # # End of rubies migration. # +if [[ -d "$rvm_path/environments" ]] ; then + # + # Remove BUNDLE_PATH from environment files + # + environments=($( find "$rvm_path/environments" -maxdepth 1 -mindepth 1 -type f )) + for file in "${environments[@]}" ; do + if grep 'BUNDLE_PATH' "$file" > /dev/null ; then + grep -v 'BUNDLE_PATH' "$file" > "$file.new" + mv "$file.new" "$file" + fi + done +fi # # Migrate old gemset directories to new gemset pattern. # for gemset in "$rvm_path"/gems/*\%* ; do