[Rubygems-developers] /etc/gemrc and GEM_PATH behaviour
drbrain at segment7.net
Wed Sep 17 22:21:06 EDT 2008
On Sep 1, 2008, at 02:18 AM, Amanda Waite wrote:
> I've been working on OS level packaging of some Ruby Gems on
> OpenSolaris. I had hoped to be able to use /etc/gemrc to specify the
> gem search path, but I've found that setting gempath in /etc/gemrc
> only affects the running of the gem command and not the running/
> loading of gems themselves. I've worked through the code as best I
> can and it seems to come down to the GemRunner class creating a
> Gem::ConfigFile instance which then reads the /etc/gemrc file. The
> gempath and gemhome values are then pushed into the Gem.path via the
> use_paths method in rubygems.rb. This code path is only used when
> running the gem command. For running Gems (like rails) or loading
> gems in scripts, the value for default_path is used unless GEM_PATH
> is set. In this case the ConfigFile is never loaded.
> Is there any documentation that describes the intended behaviour of /
> etc/gemrc? I've looked around but most of what I've found relates
> to .gemrc and much of that is anecdotal.
The best way to do this is to write a lib/rubygems/defaults/
operating_system.rb that overrides settings from lib/rubygems/
defaults.rb and include it with the OpenSolaris package.
More information about the Rubygems-developers