Permalink
Browse files

Bugfix: Check proper directory and script for root install, additiona…

…lly ensure rvm_path is a directory before attempting to load rvm.
  • Loading branch information...
1 parent 8a46165 commit c4005335d0e5f3ce7ff0dce6266d3020f2b43acc @wayneeseguin wayneeseguin committed Dec 14, 2009
Showing with 17 additions and 14 deletions.
  1. +17 −14 scripts/rvm
View
@@ -16,27 +16,30 @@ if [[ "$rvm_loaded_flag" != "1" ]] || [[ "$rvm_reload_flag" = "1" ]] ; then
rvm_path="/usr/local/rvm"
else
if [[ -d "$HOME/.rvm" ]] ; then rvm_path="$HOME/.rvm" ; fi
- if [[ -d "/usr/local/bin/rvm" ]] && [[ -s "/usr/local/bin/rvm" ]] ; then
+ if [[ -d "/usr/local/rvm" ]] && [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then
rvm_path="${rvm_path:-"/usr/local/rvm"}"
fi
fi
fi
+ if [[ -d "$rvm_path" ]] ; then
+ source $rvm_path/scripts/array
+ source $rvm_path/scripts/initialize
+ source $rvm_path/scripts/utility
+ source $rvm_path/scripts/selector
+ source $rvm_path/scripts/cli
+ #source $rvm_path/scripts/gems
+ source $rvm_path/scripts/libraries
+ source $rvm_path/scripts/cd
- source $rvm_path/scripts/array
- source $rvm_path/scripts/initialize
- source $rvm_path/scripts/utility
- source $rvm_path/scripts/selector
- source $rvm_path/scripts/cli
- #source $rvm_path/scripts/gems
- source $rvm_path/scripts/libraries
- source $rvm_path/scripts/cd
+ rvm_loaded_flag=1
- rvm_loaded_flag=1
+ rvm_version="$(cat "${rvm_path}/lib/VERSION.yml" | tail -n 3 | sed 's/^.*: //g' | tr "\n" '.' | sed 's/\.$//')" ; export rvm_version
- rvm_version="$(cat "${rvm_path}/lib/VERSION.yml" | tail -n 3 | sed 's/^.*: //g' | tr "\n" '.' | sed 's/\.$//')" ; export rvm_version
+ alias rvm-restart="source '${rvm_path}/scripts/rvm'"
- alias rvm-restart="source '${rvm_path}/scripts/rvm'"
-
- if [[ -s "$rvm_path/default" ]] ; then source "$rvm_path/default" ; fi
+ if [[ -s "$rvm_path/default" ]] ; then source "$rvm_path/default" ; fi
+ else
+ echo -e "\$rvm_path is not set. rvm cannot load."
+ fi
fi

0 comments on commit c400533

Please sign in to comment.