Non standard rubygems location

Hi,

Page 183 of Programming Ruby, talking about the $: load path variable,
states: “You can always add additional directories to this array from
within your running program”. So why can’t I do this in
environment.rb:

$:.concat(Dir["/home/jhughes/lib/ruby/site_ruby/1.8"]) # path points
at my install of rubygems

and then have

require 'rubygems'

work in boot.rb?

Here’s the error log (just trying to get CGI working right now):

[Mon May 29 14:12:32 2006] [error] [client 192.168.0.112]
/projects/active/pts/public/current/public/…/config/boot.rb:18:in
`require’: no such file to load – rubygems (LoadError)
[Mon May 29 14:12:32 2006] [error] [client 192.168.0.112] !from
/projects/active/pts/public/current/public/…/config/boot.rb:18
[Mon May 29 14:12:32 2006] [error] [client 192.168.0.112] !from
/projects/active/pts/public/current/public/…/config/environment.rb:8
[Mon May 29 14:12:32 2006] [error] [client 192.168.0.112] !from
/projects/active/pts/public/current/public/dispatch.cgi:3
[Mon May 29 14:12:32 2006] [error] [client 192.168.0.112] Premature
end of script headers: dispatch.cgi

I have RUBYLIB set appropriately in my bash_profile and can “require
‘rubygems’” in irb, but nothing works trying to make this available to
Apache. I’ve also tried adding -I to the shebang line, concatting to
ADDITIONAL_LOAD_PATHS in various locations, and probably a few other
things I can’t remember. Same result every time.

jh


James H.
Web application developer
Vancouver, BC

“Developing a coherent political analysis is in many respects
contingent upon an ability to connect one context to another, a
process not dissimilar to playing the kid’s game of dot-to-dot.”

  • Ward Churchill, from ‘“A Government of Laws”?’