0

I'm trying to load gems to execute ruby code from a local directory. I don't want ScriptingContainer(JRuby) object to use the system's default gemsets.

Emptied the Environment Variables using

container.setEnvironment(env);

an empty Map to change GEM_HOME and GEM_PATH but still it is taking the system's gemset.

How do i avoid this?

2 Answers2

1

We've had a similar problem when building Puck, a tool for bundling JRuby applications as self-contained Jar files. To get a clean environment that isn't tainted by all the things RubyGems and Bundler set up you really need to go to some lengths. Here's a pull request to Puck that solves the problem: https://github.com/iconara/puck/pull/7, the important pieces are in the DependencyResolver class, and it involves starting a separate ScriptingContainer and jumping through some hoops.

I hope you don't need all of that to solve your problem, but depending on exactly what you want to do, resetting the environment is surprisingly hard.

Theo
  • 131,503
  • 21
  • 160
  • 205
0

try setting GEM_HOME / GEM_PATH to your local directory path

kares
  • 7,076
  • 1
  • 28
  • 38