[Rubygems-developers] Overriding default directories

Eric Hodel drbrain at segment7.net
Fri Sep 12 19:23:05 EDT 2008

On Aug 17, 2008, at 15:08 PM, Neil Wilson wrote:

> Using the 'operating_system.rb' I have been unable to find a simple
> way of changing the default directories by altering a single setting.
> For ubuntu, gems needs to go in /var/lib/gems/1.8 and the binaries in
> /var/lib/gems/1.8/bin.
> With every other setting I keep getting the standard /usr/lib showing
> up somewhere, either on the gem path or the binary path depending how
> things are changed. Essentially there doesn't appear to be one place
> with gems gets the path and the binary path from.

RubyGems doesn't get this information all from one place.  The default  
Gem.bindir comes directly from rbconfig.rb, but the default Gem.dir is  
composed of several pieces, etc.

> The best I've come up with is:
> # Set the default gem installation directories and paths to the Debian
>  # defaults by poking the correct values into the ENV hash.
>  ENV['GEM_HOME'] =  
> File.join('','var','lib','gems',ConfigMap[:ruby_version])
>  # I don't want to see 'default_dir' ever.
>  ENV['GEM_PATH'] = user_dir

Does adding a Gem.clear_paths at the bottom of operating_system.rb fix  
the problem?  You shouldn't touch ENV in operating_system.rb.  Can you  
attach your operating_system.rb?

> Is there a better way?

More information about the Rubygems-developers mailing list