scripts/utility in rvm-0.1.7 vs scripts/utility in rvm-0.1.8

- old
+ new

@@ -24,15 +24,16 @@ # Ouput rvm environment information. __rvm_info() { if [[ ! -z "$(which ruby 2>/dev/null)" ]] ; then full_version=$(ruby -v) ; fi + echo -e "system:\n uname: \"$(uname -a)\"" +if [[ ! -z "$ZSH_VERSION" ]] ; then echo -e " shell: \"zsh\"\n version: \"$ZSH_VERSION\"" ; fi +if [[ ! -z "$BASH_VERSION" ]] ; then echo -e " shell: \"bash\"\n version: \"$BASH_VERSION\"" ; fi + cat <<Info -system: - uname: "$(uname -a)" - ruby: interpreter: "$(echo $full_version | awk '{print $1}')" version: "$(echo $full_version | awk '{print $2}')" date: "$(echo $full_version | sed 's/^.*(\([0-9]\{4\}\(-[0-9][0-9]\)\{2\}\).*$/\1/')" platform: "$(echo $full_version | sed 's/^.*\[//' | sed 's/\].*$//')" @@ -53,11 +54,11 @@ GEM_HOME: "$GEM_HOME" GEM_PATH: "$GEM_PATH" MY_RUBY_HOME: "$MY_RUBY_HOME" IRBRC: "$IRBRC" Info -if [[ ! -z "$MAGLEV_HOME" ]] ; then echo " MAGLEV_HOME: $MAGLEV_HOME" ; fi +if [[ ! -z "$MAGLEV_HOME" ]] ; then echo -e " MAGLEV_HOME: \"$MAGLEV_HOME\"" ; fi unset full_version } # Output debugging information that has been found useful to help people identify and resolve issues. @@ -750,25 +751,37 @@ fi if [[ -z "$rvm_gem_set_name" ]] ; then unset rvm_gem_set_name ; fi else rvm_ruby_gem_home="$rvm_gems_path/$rvm_ruby_string%$rvm_gem_set_name" fi + + if [[ ! -d "$rvm_ruby_gem_home" ]] ; then mkdir -p $rvm_ruby_gem_home ; fi + rvm_ruby_gem_path="$rvm_ruby_gem_home:$rvm_ruby_global_gems_path" # TODO: Remove next line after a few releases. mkdir -p $rvm_gems_path/cache $rvm_gems_path/doc # Careful not to nuke system gems cache. if [[ ! -z "$rvm_ruby_gem_home" ]] && [[ ! -z "$(echo $rvm_ruby_gem_home | awk '/rvm/')" ]] ; then # Global gems cache + # Ensure that the ruby gem home exists. mkdir -p "$rvm_ruby_gem_home" - if [[ ! -L "$rvm_ruby_gem_home/cache" ]] ; then + + # If there is a cache *directory* already, + # move all the gems to the global cache directory and remove it. + if [[ -d "$rvm_ruby_gem_home/cache" ]] ; then for file in "$rvm_ruby_gem_home"/cache/* ; do mv $file "$rvm_gems_path/cache/" > /dev/null 2>&1 done rm -rf "$rvm_ruby_gem_home/cache" + fi + + # If the ruby's gems cache directory is not a symlink to the global cache, + # symlink it + if [[ ! -L "$rvm_ruby_gem_home/cache" ]] ; then ln -nfs "$rvm_gems_path/cache" "$rvm_ruby_gem_home/cache" fi - fi + fi ; export rvm_ruby_gem_path rvm_ruby_gem_home } # Use a gems(et) specified by 'rvm_ruby_gem_home' __rvm_gems_use() { if [[ -z "$rvm_ruby_selected_flag" ]] ; then __rvm_select ; fi