Skip to content

Commit

Permalink
Feature: Checks if rvm needs to be re-synced in the shell.
Browse files Browse the repository at this point in the history
  • Loading branch information
docwhat authored and wayneeseguin committed Oct 31, 2009
1 parent bddb166 commit 67e6eb0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 10 additions & 2 deletions scripts/cli
Expand Up @@ -4,12 +4,12 @@ function __rvm_meta {
rvm_meta_author="Wayne E. Seguin"
rvm_meta_author_email="wayneeseguin@gmail.com"
rvm_meta_website="http://rvm.beginrescueend.com/"
rvm_meta_version="$(cat $rvm_path/lib/VERSION.yml | tail -n 3 | sed 's/^.*: //g' | tr "\n" '.' | sed 's/\.$//')"
rvm_meta_version="${RVM_VERSION}"
}

function __rvm_version { __rvm_meta ; echo "rvm ${rvm_meta_version} by ${rvm_meta_author} (${rvm_meta_author_email}) [${rvm_meta_website}]" ; }

function __rvm_usage { cat "$rvm_path/README" | ${PAGER:-less} ; }
function __rvm_usage { cat "${rvm_path:-$HOME/.rvm}/README" | ${PAGER:-less} ; }

function __rvm_parse_args {
if [[ ! -z "$(echo "$*" | awk '/trace/')" ]] ; then echo "$*" ; fi
Expand Down Expand Up @@ -351,6 +351,14 @@ function rvm {

trap '__rvm_cleanup_variables ; rm -rf "/tmp/rvm/$$" >/dev/null 2>&1' 0 1 2 3 15

# Check that this is the current version.
disk_version=$(cat "${rvm_path:-$HOME/.rvm}/lib/VERSION.yml" | tail -n 3 | sed 's/^.*: //g' | tr "\n" '.' | sed 's/\.$//')
if [ -z "${RVM_VERSION}" -o "${RVM_VERSION}" != "${disk_version}" ]; then
echo "Your shell's copy of rvm is out of date with the version on disk."
echo "Please restart your shell or run rvm-restart."
return 1
fi

__rvm_cleanup_variables
__rvm_load_rvmrc
__rvm_initialize
Expand Down
4 changes: 4 additions & 0 deletions scripts/rvm
Expand Up @@ -17,6 +17,10 @@ source $rvm_path/scripts/cli
source $rvm_path/scripts/gems

rvm_loaded_flag=1 ; export rvm_loaded_flag
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\""

if [[ -f "$rvm_path/default" ]] ; then source $rvm_path/default ; fi

0 comments on commit 67e6eb0

Please sign in to comment.