Permalink
Browse files

Refactored global gems cache to be located in $HOME/.gem/cache/

  • Loading branch information...
wayneeseguin committed Feb 13, 2010
1 parent 7953ba0 commit 7ab3cd267472e9cb5fc73585c70cfbb8095ac0c2
Showing with 16 additions and 8 deletions.
  1. +1 −1 scripts/install
  2. +15 −7 scripts/utility
View
@@ -179,7 +179,7 @@ if [[ "root" != "$(whoami)" ]] ; then
echo -e "\n if [[ -s $rvm_path/scripts/rvm ]] ; then source $rvm_path/scripts/rvm ; fi"
echo -e "\n2) Ensure that there is no 'return' from inside the .bashrc file. (otherwise rvm will be prevented from working properly)."
echo -e "\n This means that if you see '[ -z "$PS1" ] && return' then you must split your .bashrc"
- echo -e "\n Put everything below and above that line into your .bash_profile, and delete that line and below from .bashrc"
+ echo -e "\n Put everything *except the return code line(s)* into your .bash_profile, and everything above that code in your .bashrc."
echo -e "\n If you wish to DRY up your config you can 'source ~/.bashrc' at the top of your .bash_profile."
echo -e "\n4) Then $(tput setaf 1)CLOSE THIS SHELL$(tput sgr0) and open a new one in order to use rvm.\n"
fi
View
@@ -763,27 +763,35 @@ __rvm_gems_select() {
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
+ # TODO: Remove next section after a several releases.
+ if [[ ! -d "$HOME/.gem/cache" ]] ; then
+ mkdir -p $HOME/.gem/cache
+ fi
+ # Migrate original rvm global gem cache directory to $HOME/.gem/cache
+ if [[ -d "$rvm_path/gems/cache" ]] ; then
+ mv "$rvm_path"/gems/cache/* $HOME/.gem/cache/
+ rm -rf "$rvm_path"/gems/cache/
+ ln -nfs "$HOME/.gem/cache" "$rvm_path/gems/cache"
+ fi
+ # /TODO
+
# 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 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" ]] && [[ ! -L "$rvm_ruby_gem_home/cache" ]] ; then
if [[ ! -z "$(ls -A "$rvm_ruby_gem_home"/cache/)" ]] ; then
- mv "$rvm_ruby_gem_home"/cache/* "$rvm_gems_path"/cache/
+ mv "$rvm_ruby_gem_home"/cache/* "$HOME/.gem/cache/"
fi
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 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"
+ ln -nfs "$HOME/.gem/cache" "$rvm_ruby_gem_home/cache"
fi
fi ; export rvm_ruby_gem_path rvm_ruby_gem_home
}

0 comments on commit 7ab3cd2

Please sign in to comment.