Forum: IronRuby ERB

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
ERB
Paul W. (Guest)
on 2009-01-30 00:01
I playing with using ERB in IronRuby and having a little problem. The
code below works fine with Ruby:

require 'erb'
puts ERB.new('hello world').result

but in IronRuby I get this error:

IronRuby.Libraries:0:in `require': no such file to load -- erb
(LoadError)
        from :0

Now if I change the require to this it works:

require 'C:\ruby\lib\ruby\1.8\erb.rb'
puts ERB.new('hello world').result

I assume my IronRuby config is wrong but how do I fix it?
Tomas M. (Guest)
on 2009-01-30 01:43
(Received via mailing list)
There should be a line in ir.exe.config that says something like:

      <set language="Ruby" option="LibraryPaths"
value="..\..\Languages\Ruby\libs\;..\..\..\External\Languages\Ruby\ruby-1.8.6\lib\ruby\site_ruby\1.8\;..\..\..\External\Languages\Ruby\ruby-1.8.6\lib\ruby\site_ruby\;..\..\..\External\Languages\Ruby\ruby-1.8.6\lib\ruby\1.8\"
/>

These paths need to point to your MRI installation.

Tomas
Thibaut B. (Guest)
on 2009-01-30 10:31
(Received via mailing list)
Hello,

> There should be a line in ir.exe.config that says something like:
>
>      <set language="Ruby" option="LibraryPaths" 
value="..\..\Languages\Ruby\libs\;..\..\..\External\Languages\Ruby\ruby-1.8.6\lib\ruby\site_ruby\1.8\;..\..\..\External\Languages\Ruby\ruby-1.8.6\lib\ruby\site_ruby\;..\..\..\External\Languages\Ruby\ruby-1.8.6\lib\ruby\1.8\" 
/>
>
> These paths need to point to your MRI installation.

just curious (ie. I don't need this yet): is there currently a way to
set this programmatically, maybe while instantiating the IronRuby host
?

-- Thibaut
Tomas M. (Guest)
on 2009-01-30 10:57
(Received via mailing list)
Yes. Something like this should do:

var engine = IronRuby.Ruby.CreateEngine((setup) => {
setup.Options["LibraryPaths"] = "..." });

engine.Execute(code);

Tomas
Thibaut B. (Guest)
on 2009-01-30 11:36
(Received via mailing list)
> var engine = IronRuby.Ruby.CreateEngine((setup) => { setup.Options["LibraryPaths"] = 
"..." });

easy - great!

Thanks,

Thibaut
Paul W. (Guest)
on 2009-01-30 15:51
Tomas M. wrote:
> There should be a line in ir.exe.config that says something like:
>
>       <set language="Ruby" option="LibraryPaths"
> 
value="..\..\Languages\Ruby\libs\;..\..\..\External\Languages\Ruby\ruby-1.8.6\lib\ruby\site_ruby\1.8\;..\..\..\External\Languages\Ruby\ruby-1.8.6\lib\ruby\site_ruby\;..\..\..\External\Languages\Ruby\ruby-1.8.6\lib\ruby\1.8\"
> />
>
> These paths need to point to your MRI installation.
>
> Tomas

That worked great! All I had to do is copy the App.Config in the
\Codeplex-DLR-0.9\ folder over to ir.exe.config and add my path. Thanks!
This topic is locked and can not be replied to.