bash/rvm in rvm-0.0.16 vs bash/rvm in rvm-0.0.17

- old
+ new

@@ -1,11 +1,11 @@ #!/bin/bash rvm_author="Wayne E. Seguin" rvm_author_email="wayneeseguin@gmail.com" rvm_website="http://github.com/wayneeseguin/rvm" -rvm_version="0.0.16" +rvm_version="0.0.17" rvm_updated="2009.08.25" # # License: See LICENSE # @@ -42,10 +42,12 @@ srcdir - Switch to src directory for the current ruby installation gemdup - Clone source version gems to current version (highly expiramental) Example: rvm gemdup ~/.gem/ruby/1.8/ install - Install a ruby version, default is from source uninstall - Uninstall a ruby version + reset - Remove default and current settings, exit the shell. + (If you experience odd behavior try this first) debug - Emit environment & configuration information for *current* ruby Implementation: * ruby - MRI/YARV Ruby (The Standard), defaults to 1.8.6 @@ -386,17 +388,14 @@ implementation="${1-$implementation}" case "$implementation" in default) - # TODO: There is a reproducible bug here when switching off of 1.8.7... - # Seems that the path is not reset properly. rm -f $install_path/current source $install_path/default PATH="$default_path" ; export PATH ;; - #leopard) MY_RUBY_HOME="/System/Library/Frameworks/Ruby.framework/Versions/Current/usr"; GEM_HOME="$HOME/.gem/ruby/1.8" ;; jruby) version="${version-1.3.1}" if [ "$version" = "1.2.0" -o "$version" = "1.3.1" ] ; then MY_RUBY_HOME="$install_path/jruby-$version" @@ -488,11 +487,30 @@ ls -l $install_path/ | awk '/jruby-.*/ { print " - " $NF }' echo echo "ree:" ls $install_path/ | awk '/ruby-enterprise-.*/ { print " - " $NF }' echo + echo "default:" + echo " - system (`$default_system_ruby -v`)" } + +function rvm-reset { + + PATH="$default_path" ; export PATH + for variable in RUBY_VERSION GEM_HOME MY_RUBY_HOME ; do + unset $variable + done + rm -f $install_path/default* $install_path/current + if [ ! -z "$BASH_VERSION" ] ; then + exec bash -l + elif [ ! -z "$ZSH_VERSION" ] ; then + exec zsh -l + else + rvm-log-fail "Your shell is not supported bash and zsh are currently supported." + fi + +} function rvm-gem-dir { implementation=${1-$implementation} if [ "$implementation" = "" ] ; then implementation="current" ; fi @@ -621,16 +639,19 @@ done while [ $# -gt 0 ] ; do token="$1" ; shift case "$token" in - install|uninstall|use|path|info|setup|version|debug|srcdir|list) - action=$token ;; + install|uninstall|use|path|info|setup|version|srcdir|list|reset|debug) + action=$token + ;; + ruby|jruby|ree|default|all) - implementation="$token" - action="${action-use}" + implementation="$token" + action="${action-use}" ;; + gemdir) action=$token if [ "$1" = "system" ] ; then implementation="system" ; shift fi @@ -638,22 +659,25 @@ implementation="user" ; shift fi implementation="${implementation-current}" ;; + 1.8|1.8.6|1.8.7|1.9|1.9.1|1.9.2|1.2.0|1.3.1) version="$token" action="${action-use}" ;; + -v|--version) if [ -z "$1" ] ; then action="version" else version="$1" fi shift ;; + -l|--level) patchlevel="$1" ; shift ;; -p|--prefix) install_path="$1" ; shift ;; -s|--source) source_path="$1" ; shift ;; # Undocumented / untested "feature" -c|--configure) configure="$1" ; shift ;; -u|--gemdup) action="gemdup" ; gem_dir="$1" ; shift ;; @@ -714,10 +738,18 @@ default_system_gem_path=`cat $install_path/default_system_gem_path` else ruby -r rubygems -e "puts Gem::default_path.compact[1] || Gem::default_path.compact.first" > $install_path/default_system_gem_path fi + # system ruby version + if [ -s $install_path/default_system_ruby ] ; then + default_system_ruby=`cat $install_path/default_system_ruby` + else + default_system_ruby=`which ruby` + echo $default_system_ruby > $install_path/default_system_ruby + fi + if [ "$debug" = "1" ] ; then set -x ; fi case "$action" in install) if [ "$implementation" = "all" ] ; then @@ -740,9 +772,10 @@ gemdir) rvm-gem-dir $implementation $version $patchlevel ;; srcdir) rvm-src-dir $implementation $version $patchlevel ;; gemdup) rvm-gem-dup $implementation $version $patchlevel ;; info) rvm-info $implementation $version $patchlevel ;; version) rvm-version ;; + reset) rvm-reset ;; debug) rvm-version rvm-info rvm-log-info "PATH:$(echo $PATH | awk -F":" '{print $1":"$2":"$3":"$4":"$5}')" for file in ~/.bash_profile ~/.zprofile ; do