Setting GEM_PATH in environment.rb

This isn’t a hosting-related question. I’m not looking for a way to set
the GEM_PATH in a shell script.

Instead, I’m trying to load gems from both the systemwide gem path and
from a directory of app-specific gems I’ve placed in
RAILS_ROOT/lib/gems.

I have installed my app-specific gems from my app’s root with

gem install --install-dir lib/gems gemname

Now in lib/gems I have the usual set of subdirs – cache, bin, gems, doc
and specifications. So far, so good.

In environment.rb immediately after the line that reads as follows:

require File.join(File.dirname(FILE), ‘boot’)

I have added the following:

#Yes, this is where my default gems reside. They all work.
ENV[‘GEM_HOME’] = “#{RAILS_ROOT}/…/…/ext/ruby/lib/ruby/gems/1.8”

#However, the gems in the second part of this GEM_PATH don’t load.
ENV[‘GEM_PATH’] =
“#{RAILS_ROOT}/…/…/ext/ruby/lib/ruby/gems/1.8:#{RAILS_ROOT}/lib/gems”

How do I get those additional gems to load? If I put rcov in my main gem
repo, it will load when I invoke “require ‘rcov’”. If I install it to
the secondary path, it will not.

Thanks.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs