Setting GEM_HOME/GEM_PATH on scripting-container

hi,

is there a way to set GEM_HOME/GEM_PATH for ScriptingContainer per
instance ?

currently I use the environment Map to set it and it works OK for the
first ScriptingContainer but any further instance of
ScriptingContainer just does not obey the new environment Map. so the
first scripting container require ‘rubygems’ wins.

  • Kristian

Does something like this work for you?

ScriptingContainer container = new ScriptingContainer();
container.runScriptlet(“ENV[‘GEM_PATH’]=’” + basepath +
“/lib/jruby/1.8’”);

There is a good write up on Yoko’s blog:

http://yokolet.blogspot.com/2010/10/gems-in-jar-with-redbridge.html

HTH
Brendan

On Thu, Sep 13, 2012 at 12:38 AM, Brendan Grainger
[email protected] wrote:

Does something like this work for you?

I tried this as well. it works OK for the first container. if make a
second one with different GEM_PATH that GEM_PATH gets omited by
rubygems, i.e.
p Gem.path
will give me the GEM_PATH I set on the first container. it feels like
rubygems gets shared between different instances of ScriptngContainer

also tried a few of scope and behaviour settings without luck.

thanx anyways.

  • Kristian

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