Re: rexml/document with IronRuby

I don’t remember the exact command, but there is a method…
SetupSearchPath or something like that (it’s on my computer which needs
to charge).

JD


From: Orion E. [email protected]
Sent: Friday, January 15, 2010 9:52 PM
To: [email protected] [email protected]
Subject: Re: [Ironruby-core] rexml/document with IronRuby

While I agree that changing the app.config is a common task, and it’s
easy if you’re just shipping a single standalone app, it’s a giant pain
in the ass if you’re having to upgrade an existing installation, or
integrate with another program. (Outlook.exe.config anyone??)
I’ve seen a fair few .net apps move their configuration OUT of
app.config and into the registry because of things like that.

Is there a way that we can set the library path and other such things
programatically (eg: RubyEngine.LoadPath = “blah”), etc? That would be
much nicer than app.config mangling :frowning:

Cheers, Orion

On 16/01/2010, at 8:09 AM, Jimmy S. wrote:

This configuration, setting different paths etc is too much a hassle for
developers.

Let’s go over what “configuration, setting different paths etc” actually
means:

  • When using ir.exe directly?

Nothing, the Ruby standard library just works.

  • When embedding IronRuby inside a .NET app?

Just telling your C# app where IronRuby’s libraries are:

  1. Copy ir.exe.config into your app.config
  2. Make sure LibraryPaths still make sense. Making these full-paths is
    easiest,
    So just replace the “…” with “C:\IronRuby” (or wherever you
    extracted a IronRuby
    release to … for example this is the LibraryPaths for a
    C:\IronRuby installation:
    C:\IronRuby\lib\IronRuby;C:\IronRuby\lib\ruby\site_ruby\1.8;C:\IronRuby\lib\ruby\site_ruby;C:\IronRuby\lib\ruby\1.8

And that’s it. So please, let me know how this could be too much hassle
for you.
Sure, embedding isn’t “one-click”, but don’t blow it up to be more than
it really is.
Please let us know if you’ve found any real ship-stopping bugs.

Note that ir.exe.config uses relative paths as we have no idea where
someone will
unzip the release to. With the MSI we can possibly generate
ir.exe.config to use
full paths, but that would be very low on our list of stuff to do for
1.0. Also,
if we release VS integration in the future, generating the correct
app.config
for embedding is also a possibility.

However, for embedding, presumably you are going to want to put the
libraries
into your application’s directory, so you do really care about where the
paths
are, which is why we don’t somehow magically find them.

~Jimmy

ScriptEngine.SetSearchPaths does it for search paths.

A configuration file is just one of the options how to configure
IronRuby. The most general API is
Ruby.CreateRuntime(ScriptRuntimeSetup), where you provide a
configuration object. In fact, the parameter-less Ruby.CreateRuntime and
Ruby.CreateEngine just call
Ruby.CreateRuntime(ScriptRuntimeSetup.ReadConfiguration()). You can
write your own configuration system that produces ScriptRuntimeSetup
instance from registry, MEF, yaml files, server on the Internet, or any
other data provider.

Tomas

From: [email protected]
[mailto:[email protected]] On Behalf Of Jim D.
Sent: Friday, January 15, 2010 10:15 PM
To: [email protected]
Subject: Re: [Ironruby-core] rexml/document with IronRuby

I don’t remember the exact command, but there is a method…
SetupSearchPath or something like that (it’s on my computer which needs
to charge).

JD


From: Orion E. [email protected]
Sent: Friday, January 15, 2010 9:52 PM
To: [email protected] [email protected]
Subject: Re: [Ironruby-core] rexml/document with IronRuby
While I agree that changing the app.config is a common task, and it’s
easy if you’re just shipping a single standalone app, it’s a giant pain
in the ass if you’re having to upgrade an existing installation, or
integrate with another program. (Outlook.exe.config anyone??)
I’ve seen a fair few .net apps move their configuration OUT of
app.config and into the registry because of things like that.

Is there a way that we can set the library path and other such things
programatically (eg: RubyEngine.LoadPath = “blah”), etc? That would be
much nicer than app.config mangling :frowning:

Cheers, Orion

On 16/01/2010, at 8:09 AM, Jimmy S. wrote:

This configuration, setting different paths etc is too much a hassle for
developers.

Let’s go over what “configuration, setting different paths etc” actually
means:

  • When using ir.exe directly?

Nothing, the Ruby standard library just works.

  • When embedding IronRuby inside a .NET app?

Just telling your C# app where IronRuby’s libraries are:

  1. Copy ir.exe.config into your app.config
  2. Make sure LibraryPaths still make sense. Making these full-paths is
    easiest,
    So just replace the “…” with “C:\IronRuby” (or wherever you
    extracted a IronRuby
    release to … for example this is the LibraryPaths for a
    C:\IronRuby installation:
    C:\IronRuby\lib\IronRuby;C:\IronRuby\lib\ruby\site_ruby\1.8;C:\IronRuby\lib\ruby\site_ruby;C:\IronRuby\lib\ruby\1.8

And that’s it. So please, let me know how this could be too much hassle
for you.
Sure, embedding isn’t “one-click”, but don’t blow it up to be more than
it really is.
Please let us know if you’ve found any real ship-stopping bugs.

Note that ir.exe.config uses relative paths as we have no idea where
someone will
unzip the release to. With the MSI we can possibly generate
ir.exe.config to use
full paths, but that would be very low on our list of stuff to do for
1.0. Also,
if we release VS integration in the future, generating the correct
app.config
for embedding is also a possibility.

However, for embedding, presumably you are going to want to put the
libraries
into your application’s directory, so you do really care about where the
paths
are, which is why we don’t somehow magically find them.

~Jimmy

Sweet :slight_smile:

What can I say, I’ve just had some bad experiences with app.config files
in the past. Apologies for the rantish tone I took the other day

Thanks, Orion

var scriptingRuntime = IronRuby.Ruby.CreateRuntime();
var engine = scriptingRuntime.GetEngine(“rb”);
var operations = engine.CreateOperations();

        var paths = new List<String>();
        paths.Add(@"C:\ironruby\ironruby\Merlin\Main\Languages\Ruby\Libs");
        paths.Add(@"C:\ironruby\ironruby\Merlin\External.LCA_RESTRICTED\Languages\Ruby\redist-libs\ruby\1.8");

       engine.SetSearchPaths(paths);