Skip to content

Commit

Permalink
Bugfix: Separate directory and symlink logic.
Browse files Browse the repository at this point in the history
  • Loading branch information
wayneeseguin committed Feb 5, 2010
1 parent ae066f1 commit 20f2905
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions scripts/utility
Expand Up @@ -763,16 +763,24 @@ __rvm_gems_select() {
# 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
export rvm_ruby_gem_path rvm_ruby_gem_home
fi ; export rvm_ruby_gem_path rvm_ruby_gem_home
}

# Use a gems(et) specified by 'rvm_ruby_gem_home'
Expand Down

0 comments on commit 20f2905

Please sign in to comment.