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

Tomas

-----Original Message-----
From: ironruby-core-boun...@rubyforge.org 
[mailto:ironruby-core-boun...@rubyforge.org] On Behalf Of Aaron Clauson
Sent: Friday, July 09, 2010 5:47 AM
To: ironruby-core@rubyforge.org
Subject: [Ironruby-core] 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
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

Reply via email to