[arch-dev-public] Ruby directory clean up proposal.

Thomas Dziedzic gostrc at gmail.com
Sun Feb 12 18:37:17 EST 2012

vendor_ruby was introduced as a new folder in ruby 1.9 so that
packages installed by a distribution's packages will have a separate
place to stay.
Gem is a package manager for installing ruby related programs/libs.

Current layout:
/usr/lib/ruby/site_ruby - packages either installed here
/usr/lib/ruby/gems/[ruby_base_version] - or here, this directory
contains both pacman installed packages and packages installed using
the gem tool.

Planned layout:
/usr/lib/ruby/site_ruby - manually installed files by user go here,
packages shouldn't touch this
/usr/lib/ruby/gems/[ruby_base_version] - pacman packages built from gems go here
/usr/lib/ruby/vendor_ruby - ruby packages installed with pacman which
aren't gems go here
$HOME/.gem/ruby/[ruby_base_version] - used by the gem command to
install packages unmanaged by pacman
/etc/gemrc - contains "gem: --user-install" to install user installed
gems with gem to $HOME/.gem/gems

If the user chooses to install gems using gem, they will have to add
the bin directory to the $PATH:
export PATH="$PATH:$(ruby -rubygems -e 'puts Gem.user_dir')/bin".

Benefits of this change include:
Using the proper directory layout introduced in ruby 1.9 (using vendor_ruby).
Clean separation of pacman installed packages
(/usr/lib/ruby/gems/[ruby_base_version] & /usr/lib/ruby/vendor_ruby)
from gem installed packages ($HOME/.gem/ruby/[ruby_base_version]).

Problems left:
The user will still be able to install to the system wide gem
directory /usr/lib/ruby/gems/[ruby_base_version] if they remove
--user-install from /etc/gemrc

Possible remedies:
1) Leave it as is.
  If the user runs gem with --no-user-install then gem will still
install the files to the system wide directory at
/usr/lib/ruby/gems/[ruby_base_version] and will install binaries to
  This should provide a clean default and is the easiest path.
  This option is still better than the one we currently use where we
try to install to the system wide location by default.
2) Change all ruby pacman packages to use local
  This would free up /usr/lib/ruby/gems/[ruby_base_version] which we
could move to /var/lib/ruby/gems/[ruby_base_version] for system wide
gems installed with the gem command.
  Not sure if installing gems to /usr/lib/ruby/vendor_ruby is smart
yet since this might rely on undocumented behavior and could be
"fixed" in future versions of ruby, still have to figure this out.
  (Optional) We could leave /usr/lib/ruby/gems/[ruby_base_version] in
the $LOAD_PATH in ruby for backwards compatibility so that packages
using the old standard would still work.
  For the optional, the work could range from a simple configure
change to patching ruby.
3) ???

I'm currently leaning towards 1 since it will be a simple solution
with no changes needed to existing ruby-* packages.

More information about the arch-dev-public mailing list