Permalink
Browse files

Bugfix: 'rvm update' now tries current ruby first. Bugfix: 'rvm insta…

…ll' does not imbecillically use the same code as initialize and startup.
  • Loading branch information...
1 parent 0c8f8f9 commit 112fb356916936f3368e6a8ec86dc2216f961e27 @wayneeseguin wayneeseguin committed Dec 9, 2009
Showing with 17 additions and 8 deletions.
  1. +2 −3 scripts/install
  2. +15 −5 scripts/utility
View
@@ -3,13 +3,12 @@
if [[ -f /etc/rvmrc ]] ; then source /etc/rvmrc ; fi
if [[ -f "$HOME/.rvmrc" ]] ; then source "$HOME/.rvmrc" ; fi
-if [[ -z "$rvm_path" ]] ; then
+if [[ ! -d "$rvm_path" ]] || [[ "$rvm_path" = "/" ]] ; then
unset rvm_path
if [[ "root" = "$(whoami)" ]] ; then
rvm_path="/usr/local/rvm"
else
- if [[ -d "$HOME/.rvm" ]] ; then rvm_path="$HOME/.rvm" ; fi
- if [[ -d "/usr/local/bin/rvm" ]] && [[ -f "/usr/local/bin/rvm" ]] ; then rvm_path="${rvm_path:-"/usr/local/rvm"}" ; fi
+ rvm_path="$HOME/.rvm"
fi
fi
View
@@ -357,22 +357,32 @@ __rvm_update_rvm() {
mkdir -p "$rvm_src_path"
__rvm_pushpop "$rvm_src_path"
+ ruby="$(which ruby)"
system_ruby="$(rvm system ; which ruby 2>/dev/null)"
+ if [[ ! -x "$ruby" ]] ; then
+ if [[ ! -x "$system" ]] ; then
+ unset ruby
+ else
+ ruby=$system_ruby
+ fi
+ fi
+
if [[ "head" = "$rvm_ruby_revision" ]] || [[ -z "$system_ruby" ]] ; then
if [[ -d "$rvm_src_path/rvm/.git" ]] ; then
builtin cd $rvm_src_path/rvm/ && git pull origin master && ./scripts/install
else
builtin cd $rvm_src_path && git clone git://github.com/wayneeseguin/rvm.git && builtin cd rvm/ && ./install
fi
else
- # TODO: rvm_install_path:
- if [ $(gem list rvm --installed) = 'true' ]; then
- gem update rvm --no-rdoc --no-ri --quiet
+ if [[ "true" = "$($ruby -S gem list rvm --installed)" ]]; then
+ $ruby -S gem update rvm --no-rdoc --no-ri --quiet
else
- gem install rvm --no-rdoc --no-ri --quiet
+ $ruby -S gem install rvm --no-rdoc --no-ri --quiet
fi
- builtin cd "$(rvm system ; gem env | grep "\- $HOME" | awk '{print $NF}' | head -n 1)/gems/rvm-$(gem list rvm | sed 's/.*(//' | sed 's/).*//' | awk -F',' '{print $1 ; exit}')" && ./install
+ # TODO: Check all gem paths instead of simply assuming the last one...
+ builtin cd "$($ruby -S gem env | grep "\- $HOME" | awk '{print $NF}' | head -n 1)/gems/rvm-$(gem list rvm | sed 's/.*(//' | sed 's/).*//' | awk -F',' '{print $1 ; exit}')" && ./install
fi
+ unset ruby system_ruby
__rvm_pushpop
__rvm_hook "after_update"
}

0 comments on commit 112fb35

Please sign in to comment.