In GlassFish v3 I am using JRuby APIs to instantiate JRuby and Rails runtime. I am using maven to write a unit test for rails. My maven dependency is on jruby-complete.jar. However when my test tries to loadup the rails application I get the error "Missing the Rails 2.1.0 gem. Please `gem install -v=2.1.0 rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed." This explains why, because jruby-complete.jar does not have Rails gem. What options do have to make it work so that JRuby runtime can locate Rails gem as resource from the classpath?I tried copy Rails gem as part of maven test resources but this does not help. Anyone, any idea how I can make Rails gem or anyother gem available to JRuby runtime while using jruby-complete.jar? -vivek.
on 20.08.2008 00:37
on 20.08.2008 01:05
On Tue, Aug 19, 2008 at 5:36 PM, Vivek Pandey <vivek.pandey@gmail.com> wrote: > This explains why, because jruby-complete.jar does not have Rails gem. What > options do have to make it work so that JRuby runtime can locate Rails gem > as resource from the classpath?I tried copy Rails gem as part of maven test > resources but this does not help. > > Anyone, any idea how I can make Rails gem or anyother gem available to JRuby > runtime while using jruby-complete.jar? Set the environment variable GEM_PATH to the location of a place where you've pre-installed the Rails gem. Typically this will be something like GEM_PATH=/usr/local/jruby/lib/ruby/gems/1.8 Entries on GEM_PATH have cache, doc, gems, and specifications directories. /Nick --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
on 20.08.2008 01:24
Great! This works. Although I would have preferred a java system property but this would do. thanks, -vivek.
on 20.08.2008 01:37
Well it would work in my standalone case, I can do export GEM_PATH=... but it does not help me when I try to automate. The unit test will be run using maven and there does not appear a way to set environment variables from inside maven pom files:-( -vivek.
on 20.08.2008 06:34
On Tue, Aug 19, 2008 at 6:37 PM, Vivek Pandey <vivek.pandey@gmail.com> wrote: > Well it would work in my standalone case, I can do export GEM_PATH=... but > it does not help me when I try to automate. The unit test will be run using > maven and there does not appear a way to set environment variables from > inside maven pom files:-( > > -vivek. Not ideal, but could you require/export GEM_PATH in ~/.mavenrc on the build machine? You'd probably have to have the gems directory set up ahead of time anyway, unless you plan to have the gem repository checked in somewhere. Otherwise you could use a java system property to pass the value along and have a special path to handle setting GEM_PATH inside JRuby during your test setup. /Nick --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email