[Ironruby-core] Library path in order to use gems

Aaron Clauson lists at ruby-forum.com
Fri Jul 9 08:47:00 EDT 2010


I'd like my C# hosted IronRuby script to be able to use gems (I install
them with igem so they go into the IronRuby directory). I've been able
to successfully require an installed gem but to do so I had to
explicitly add the path it was installed in to the app.config
LibraryPaths setting. If I have to do that for every gem it's going to
end up being a very long parameter.

Is there a library path I can specify so that IronRuby will search
beneath it to when doing requires?

My code looks like:

 var setup = ScriptRuntimeSetup.ReadConfiguration();
 var scriptRuntime = Ruby.CreateRuntime(setup);
 ScriptEngine scriptEngine = Ruby.GetEngine(scriptRuntime);

 string script =
   "require 'httpclient'\n" +
    "print 'hello\n'";


The require works with a LibraryPath setting of:

        <set language='Ruby' option='LibraryPaths'

I would have thought instead of
I would specify
C:\Data\Dev\IronRuby\ironruby-1.0v4\lib\ironruby\gems\1.8\gems and sub
directories would be automatically searched?

Posted via http://www.ruby-forum.com/.

More information about the Ironruby-core mailing list