Library path in order to use gems

Hi,

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’”;

scriptEngine.Execute(script);

The require works with a LibraryPath setting of:

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

value=‘C:\Data\Dev\IronRuby\ironruby-1.0v4\lib\ironruby;C:\Data\Dev\IronRuby\ironruby-1.0v4\lib\ruby\1.8;C:\Data\Dev\IronRuby\ironruby-1.0v4\lib\ironruby\gems\1.8\gems\httpclient-2.1.5.2\lib;’/>

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

Thanks,
Aaron

If you first require ‘rubygems’ you shouldn’t need to set any paths.

Tomas

Perfect, thanks!

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