How do I setup a custom Gem.path using JRuby::Rack?

Posted by Ben Hogan on Stack Overflow See other posts from Stack Overflow or by Ben Hogan
Published on 2010-04-12T15:21:40Z Indexed on 2010/04/12 15:22 UTC
Read the original article Hit count: 443

Filed under:
|
|
|

Hi Nick et al,

I've been having some fun looking at to source code of JRuby-Rack and Rubygems to try to figure out how to solve a

org.jruby.rack.RackInitializationException: no such file to load -- compass

in my rackup script cased by require 'compass'. I'm passing in a custom 'gem.path' as a servlet init parameter and it is being correctly picked up by jruby-rack as far as I can tell by debugging in my rackup script:

ENV['GEM_PATH'] => '/foo/lib/.jruby/gems' (expected)

but rubygems seems to be broken:

Gem.path => file:/foo/lib/jruby-complete-1.4.0.jar!/META-INF/jruby.home/lib/ruby/gems/1.8

I'm not sure why rubygems has not adjusted it's gem_path nor the LOAD_PATH, thus breaking require?

Thanks again, I'm still a newbie at ruby, jruby, rack and sinatra. Any pointers in the right direction appreciated!

Ben

© Stack Overflow or respective owner

Related posts about ruby

Related posts about jruby