Forum: IronRuby Compiling .rb files vs. embedding and hosting ?

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.
91eb330fb36d1e03c856574dfb77d2bc?d=identicon&s=25 Thibaut Barrère (thbar)
on 2009-01-09 12:17
(Received via mailing list)
Hello,
I'm starting to integrate IronRuby files into a VisualStudio C# project,
mainly to write easy-to-maintain GUI builders.

As I don't want to have .rb files lying around this deployment, I had
that
idea about embedding all the files inside an assembly, loading them at
run
time through resource manager and passing them to the IronRuby host I
would
start from C#.

While that would work, it would be even simplier to have these .rb files
compiled to some assembly.

Is there a trick to compile a bunch of .rb files to an assembly today ?

thanks!

-- Thibaut
E1deaac6561498a0e7472e6268ea9ccc?d=identicon&s=25 Jimmy Schementi (Guest)
on 2009-01-09 21:08
(Received via mailing list)
Embedding the files as resources would be your best bet, as we don't
have compilation to an assembly working today.

Basically (compiled with outlook ...):

var assembly = Assembly.GetExecutingAssembly();
var textStreamReader = new
StreamReader(assembly.GetManifestResourceStream("foo.rb"));
var code = textStreamReader.ReadToEnd();
textStreamReader.Close();

var runtime = new ScriptRuntime();
var ruby = IronRuby.Ruby.GetEngine(runtime);
var source = ruby.CreateScriptSourceFromString(code);
var result = source.Execute();

Compilation is something we want to support though.

~js
91eb330fb36d1e03c856574dfb77d2bc?d=identicon&s=25 Thibaut Barrère (thbar)
on 2009-01-09 21:45
(Received via mailing list)
Hi Jimmy,

thanks for the feedback (and the outlook snippet :-)!

I'll try that.

cheers

-- Thibaut
Cb51033949ffccd982ae32c9f890f25a?d=identicon&s=25 Tomas Matousek (Guest)
on 2009-01-09 22:30
(Received via mailing list)
The last 4 lines of the snippet could be slightly simplified:

var engine = IronRuby.Ruby.CreateEngine();
engine.Execute(code);

Tomas
91eb330fb36d1e03c856574dfb77d2bc?d=identicon&s=25 Thibaut Barrère (thbar)
on 2009-01-30 09:14
(Received via mailing list)
Hi,

just some words of feedback: it works perfectly :)

I'm beginning to start using an embedded IronRuby engine to create my
windows forms programmatically inside a C# application, rather than
from the designer.

thanks, I'll keep you guys posted on my findings!

Thibaut


On Fri, Jan 9, 2009 at 10:30 PM, Tomas Matousek
This topic is locked and can not be replied to.