bash/rvm in rvm-0.0.17 vs bash/rvm in rvm-0.0.18

- 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.17" +rvm_version="0.0.18" rvm_updated="2009.08.25" # # License: See LICENSE # @@ -68,27 +68,28 @@ Notes: * Defaults above are denoted with a '*' prefix. * rvm is intended to be run as an individual user (not root, yet) * All ruby installation, configuration and source files are in ~/.rvm - * To manually reset to defaults: "rm -f ~/.rvm/current", then open new shell - * To preserve previous gem installations for a particular ruby version copy, - move, symlink or copy the old gem directory to (1.8 for 1.8.X): - ~/.gem/\$interpreter/\$version Examples: + $ rvm -v # RVM version + $ rvm list # available rvm versions + $ rvm info # ruby information for current shell $ rvm install jruby # Install jRuby (default version is 1.3.1) $ rvm use ruby -v 1.9.1 # Use Ruby 1.9.1, installs if necessary $ rvm use 1.9 # Equivalent to above, due to defaults $ rvm use 1.8 # Use Ruby 1.8.6, installs if necessary - $ rvm use default # Use the system default (as if no rvm) - $ rvm gemdup ~/.gem/ruby/1.8/ # Install gems from ~/.gem/ruby/1.8/ $ rvm gemdir # Switch to gems directory for current ruby $ rvm gemdir system # Switch to the system gems directory $ rvm gemdir system user # Switch to the system user gems directory $ rvm gemdir ruby 1.9 # Switch to gems directory for ruby 1.9.1 + $ rvm use default # Use the system default (as if no rvm) + $ rvm reset # Reset to pre-rvm state. + $ rvm uninstall 1.8.7 # Uninstall rvm installed 1.8.7 version + $ rvm gemdup default # Install gems from ~/.gem/ruby/1.8/ TODO: (in order) * rvm gemdup * root support @@ -475,13 +476,15 @@ 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-list { + echo -e "\nruby:" ls -l $install_path/ | awk '/ ruby-[1-2].*/ { print " - " $NF }' echo echo "jruby:" ls -l $install_path/ | awk '/jruby-.*/ { print " - " $NF }' @@ -489,10 +492,11 @@ 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 @@ -610,11 +614,18 @@ } # clones from source implementation/version to current function rvm-gem-dup { - gem_dir=${1-$default_gem_path} # TODO: check for and remove trailing /gems + if [ "$1" = "default" ] ; then + gem_dir="$default_gem_path" + elif [ "$1" = "system" ] ; then + gem_dir="$default_system_gem_path" + else + gem_dir=${1-$default_gem_path} # TODO: check for and remove trailing /gems + fi + if [ ! -z "$gem_dir" ] ; then for gem_name_version in `ls $gem_dir/gems` ; do gem_name=${gem_name_version%-*} gem_version=${gem_name_version##*-} if [ -d $GEM_HOME/gems/$gem_name_version ] ; then @@ -639,11 +650,11 @@ done while [ $# -gt 0 ] ; do token="$1" ; shift case "$token" in - install|uninstall|use|path|info|setup|version|srcdir|list|reset|debug) + install|uninstall|use|path|info|setup|version|srcdir|list|reset|debug|gemdup) action=$token ;; ruby|jruby|ree|default|all) implementation="$token" @@ -678,11 +689,10 @@ -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 ;; -d|--debug) debug=1 ;; *) rvm-usage ; return 1 esac done @@ -707,11 +717,11 @@ prefix_path=${prefix-$HOME/.} fi source_path="${source_path-"${prefix_path}rvm/src"}" install_path="${prefix_path}rvm" - mkdir -p $prefix_path $source_path $install_path/bin + mkdir -p $source_path $install_path/bin if [ ! -f $install_path/default ] ; then for variable in RUBY_VERSION GEM_HOME MY_RUBY_HOME PATH ; do eval "export $variable" eval value=\$${variable} @@ -777,12 +787,12 @@ 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 + for file in .bash_profile .zshrc ; do if [ -s $file ] ; then - rvm-log-info "$file: \n$(cat ~/$file| tail -n 5)\n" + rvm-log-info "~/$file: \n$(cat ~/$file| tail -n 5)\n" fi done rvm-log-info "$install_path/current: \n$(cat $install_path/current)\n" return 0 ;;