Thibaut Barrère
2009-Jan-09 10:33 UTC
[Ironruby-core] Compiling .rb files vs. embedding and hosting ?
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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090109/ac4ab89c/attachment.html>
Jimmy Schementi
2009-Jan-09 19:42 UTC
[Ironruby-core] Compiling .rb files vs. embedding and hosting ?
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
> -----Original Message-----
> From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-
> bounces at rubyforge.org] On Behalf Of Thibaut Barr?re
> Sent: Friday, January 09, 2009 2:34 AM
> To: ironruby-core
> Subject: [Ironruby-core] Compiling .rb files vs. embedding and hosting
> ?
>
> 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
Thibaut Barrère
2009-Jan-09 20:16 UTC
[Ironruby-core] Compiling .rb files vs. embedding and hosting ?
Hi Jimmy, thanks for the feedback (and the outlook snippet :-)! I''ll try that. cheers -- Thibaut
Tomas Matousek
2009-Jan-09 21:30 UTC
[Ironruby-core] Compiling .rb files vs. embedding and hosting ?
The last 4 lines of the snippet could be slightly simplified:
var engine = IronRuby.Ruby.CreateEngine();
engine.Execute(code);
Tomas
-----Original Message-----
From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at
rubyforge.org] On Behalf Of Jimmy Schementi
Sent: Friday, January 09, 2009 11:43 AM
To: ironruby-core at rubyforge.org
Subject: Re: [Ironruby-core] Compiling .rb files vs. embedding and hosting ?
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
> -----Original Message-----
> From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-
> bounces at rubyforge.org] On Behalf Of Thibaut Barr?re
> Sent: Friday, January 09, 2009 2:34 AM
> To: ironruby-core
> Subject: [Ironruby-core] Compiling .rb files vs. embedding and hosting
> ?
>
> 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
_______________________________________________
Ironruby-core mailing list
Ironruby-core at rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core
Thibaut Barrère
2009-Jan-30 08:13 UTC
[Ironruby-core] Compiling .rb files vs. embedding and hosting ?
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 <Tomas.Matousek at microsoft.com> wrote:> The last 4 lines of the snippet could be slightly simplified: > > var engine = IronRuby.Ruby.CreateEngine(); > engine.Execute(code); > > Tomas > > -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Jimmy Schementi > Sent: Friday, January 09, 2009 11:43 AM > To: ironruby-core at rubyforge.org > Subject: Re: [Ironruby-core] Compiling .rb files vs. embedding and hosting ? > > 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 > >> -----Original Message----- >> From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core- >> bounces at rubyforge.org] On Behalf Of Thibaut Barr?re >> Sent: Friday, January 09, 2009 2:34 AM >> To: ironruby-core >> Subject: [Ironruby-core] Compiling .rb files vs. embedding and hosting >> ? >> >> 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 > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core >