scripts/cli in rvm-0.0.67 vs scripts/cli in rvm-0.0.68

- old
+ new

@@ -2,18 +2,20 @@ 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 + while [[ $# -gt 0 ]] ; do rvm_token="$1" ; shift case "$rvm_token" in install|uninstall|path|info|setup|version|srcdir|list|reset|debug|reload|implode|readline|gemsync|update|iconv|openssl|ncurses|zlib|readline) rvm_action=$rvm_token @@ -35,10 +37,11 @@ ;; system|default) rvm_action=${rvm_action:-use} rvm_ruby_interpreter="$rvm_token" + rvm_ruby_string="$rvm_token" ;; jruby|ree|macruby|rbx|rubinius|mput|shyouhei|default|all) rvm_ruby_interpreter="$rvm_token" rvm_action="${rvm_action:-use}" @@ -175,10 +178,11 @@ rvm_action="${rvm_action:-use}" shift ;; --head) + if [[ -z "$rvm_ruby_string" ]] ; then rvm_ruby_string="head"; else rvm_ruby_string="${rvm_ruby_string}-head" ; fi rvm_ruby_revision="head" rvm_head_flag=1 rvm_action="${rvm_action:-use}" ;; @@ -249,10 +253,11 @@ ;; default|system) rvm_action="use" rvm_ruby_interpreter="system" + rvm_ruby_string="$rvm_token" ;; --install) rvm_install_on_use_flag=1 ;; -h|--help|usage|help) rvm_action=help ;; --prefix) rvm_prefix_path="$1" ; shift ;; @@ -343,9 +348,16 @@ } 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 [[ "${rvm_version}" != "${disk_version}" ]] && [[ "reload" != "$1" ]]; then + echo -e "A newer version of rvm has been installed ($disk_version) than is loaded ($rvm_version), please do one of the following:\n * 'rvm reload'\n * open a new shell\n * source your shell init scripts" + return 1 + fi __rvm_cleanup_variables __rvm_load_rvmrc __rvm_initialize __rvm_load_defaults