Is there an environment variable that will make gems available to scriptlets run through a Scripting

I’ve run “gem install blah,” but I’m having trouble making those gems
available to a script being run in a ScriptingContainer. I’d prefer to
set
some sort of environment variable instead of adding things to the load
path
in java, if possible.

Any ideas? Thanks
Jon

Argh, looks like JRUBY_HOME does the trick

2012/9/28 Jonathan C. [email protected]

Sorry for the spam! It looks like it does not, in fact, work. Back to
square one. Any help is appreciated.

2012/9/28 Jonathan C. [email protected]

what about to pack the gems into your jar (if you have such a jar) ?

for details see
http://yokolet.blogspot.in/2010/10/gems-in-jar-with-redbridge.html

  • Kristian

What about bundler? This is what it’s for, I think?

Russell J. http://datasyndrome.com

On Sep 28, 2012, at 11:43 AM, Jonathan C. [email protected]
wrote:

This is an idea people have mentioned before, and is what I wanted to do
originally… that’s a pretty good example. The annoying part is that
this
has to integrate with an existing project which has its own jar and
build
system, so I’d have to either integrate this with that, or make a new
jar
copying the old contents, with the gems I want. That’s not a horrible
idea,
I suppose. Hmm.

2012/9/28 kristian [email protected]

I haven’t used ScriptingContainer, but from reading about it I wonder
where it finds JRuby? And that made me wonder why you thought JRUBY_HOME
worked, and then concluded that it doesn’t. Perhaps it did work on the
occasion when it was pointing to the appropriate copy of JRuby - or when
the instance it pointed to was appropriate.

Is it possible to make the ScriptingContainer use a copy of JRuby that
is included in your project?

Check the value of the GEM_HOME environment variable, it’s used by
Rubygems to find where to find gems. If it’s not set, setting if might
help, but if it’s set then maybe the problem is harder…

T#

This is an idea people have mentioned before, and is what I wanted to do
originally… that’s a pretty good example. The annoying part is that
this
has to integrate with an existing project which has its own jar and
build
system, so I’d have to either integrate this with that, or make a new
jar
copying the old contents, with the gems I want. That’s not a horrible
idea,
I suppose. Hmm.

2012/9/28 kristian [email protected]

So, it turns out JRUBY_HOME was correct, but I had some clashing jruby
installs or something. Once I cleaned that up, JRUBY_HOME properly set
it.

I think with Bundler it would be possible to push it all into the jar,
so
that everything comes within the jar. This is more jar wrangling than
I’d
like…

2012/9/29 Robin McKay [email protected]

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