Forum: IronRuby Is it possible to generate DLLs?

Posted by Bassel Samman (mercedes6s)
on 2010-01-22 19:23
Hello guys,
    we're looking to adopt IronRuby within our project.  It's been great
to test with since we're all ex-Ruby and/or ex-Rails guys and this makes
everything simpler.  We were able to work with windows forms and we can
do everything we want with it so far without a problem.  The one thing
that remains is that we are not allowed to send the actual source files
as they are to the customer.  I assume there is a simple way we can do
this, but I can't find any documentation on that or maybe I missed
something.  Is there a way I can turn the ruby classes into DLLs so we
can package them up and ship them?  That would pretty much seal the deal
to get IronRuby approved for our project.

thanks,

Bassel
Posted by Bassel Samman (mercedes6s)
on 2010-01-22 21:30
Actually, never mind.  Looks like precompilation is not supported yet. 
Googling shows they may work on it post 1.0.  On the other hand, one of 
the developers came up with a workaround that will work for us since our 
needs are minimal.  We are just going to zip and encrypt for now and we 
can unzip and run in memory from a small C# app.  Also, if someone 
really needs a DLL you can use rubydotnet.
Posted by David Lake (rifraf)
on 2010-01-23 13:02
Bassel Samman wrote:
> Actually, never mind.  Looks like precompilation is not supported yet. 
> Googling shows they may work on it post 1.0.  On the other hand, one of 
> the developers came up with a workaround that will work for us since our 
> needs are minimal.  We are just going to zip and encrypt for now and we 
> can unzip and run in memory from a small C# app.  Also, if someone 
> really needs a DLL you can use rubydotnet.

I've found it easiest to put Ruby scripts into embedded resources in the 
DLL then read them out from there. You can optionally encrypt them as 
part of the build process and decrypt them before running them so that 
they cannot be spied upon. I use this system a lot (with Ruby.Net, but 
it will work fine with IronRuby too).

As an added aid during development, the code that I use to get a 
resource 'foo.rb' from the DLL will do a quick check on disk at location 
<dll_location>\<dll_name> for a plain-text version of 'foo.rb'. If it 
finds one, it loads it in preference. This way you don't need to rebuild 
the DLL during development - only when ready to release.
Posted by Shay Friedman (shayfriedman)
on 2010-01-23 15:14
(Received via mailing list)
Good idea.

However, I'd remove the file check before the production build (use #if
DEBUG or something similar).
Having it on the client computers generates 2 main problems:
1. Performance - you're doing one or multiple file system calls in vain.
2. Security - one can figure out about this little mechanism and put a
malicious foo.rb file in the correct folder, so your application uses 
and
executes it.

Thanks for sharing,
Shay.
--------------------------------------------------------
Shay Friedman | .NET Technologies Expert | Author of IronRuby Unleashed 
|
Sela Technology Center
Blog: http://IronShay.com | Twitter: http://twitter.com/ironshay
Posted by Orion Edwards (Guest)
on 2010-01-23 23:56
(Received via mailing list)
If you've ever run reflector over a .NET dll, you'll realise that you're 
pretty much shipping the source to every C# or VB.net app you write -
so going along with this I'd recommend just putting the ruby files in a 
zip, renaming the zip to .blah, and calling it a day
Posted by Bassel Samman (mercedes6s)
on 2010-01-24 16:31
Thanks to everyone for their responses.  We did something similar and 
things seem to be going OK with management.  Also, Orion, the whole 
point is we can't just ship source.  I agree you can do a lot of things 
to get to source from compiled formats, but I don't want to get into the 
whole argument of shipping source just won't fly in the Enterprise 
world.  Long story short, I think this would make our life easier and 
make it easier to convince management that IronRuby is a viable option.
Posted by Orion Edwards (Guest)
on 2010-01-24 20:29
(Received via mailing list)
Sure :-) I realise the world of enterprises is not neccessarily the 
world of
reason or logic :-)

At any rate, I remember some vague mentionings on the list about a 
platform
abstraction layer and it's being able to read files directly out of 
zips,
which sounds like it would also be useful... was that a silverlight 
thing or
am I confused?
Posted by Bassel Samman (mercedes6s)
on 2010-01-25 03:04
Orion Edwards wrote:
> Sure :-) I realise the world of enterprises is not neccessarily the 
> world of
> reason or logic :-)
> 
> At any rate, I remember some vague mentionings on the list about a 
> platform
> abstraction layer and it's being able to read files directly out of 
> zips,
> which sounds like it would also be useful... was that a silverlight 
> thing or
> am I confused?

Nope, no SilverLight here, just a desktop app with MSCharts, win forms 
and a whole lot of IronRuby metaprogramming goodness.
Posted by Ivan Porto carrero (casualjim)
on 2010-01-25 08:26
(Received via mailing list)
using a zip format blocks you from using it in certain ways like adding 
it
as a reference to visual studio.
Nobody says your dll needs to contain just ruby code. It can contain 
thin C#
wrappers for example.
---
Met vriendelijke groeten - Best regards - Salutations
Ivan Porto Carrero
Blog: http://flanders.co.nz
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)
Posted by Jimmy Schementi (Guest)
on 2010-01-26 09:52
(Received via mailing list)
After 1.0 we’ll be making IronRuby integrate better with its “static” 
world. I’m not sure the current state of precompiling, but I’m pretty 
sure we’re not even testing it.

~Jimmy

From: ironruby-core-bounces@rubyforge.org 
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of Ivan Porto 
Carrero
Sent: Sunday, January 24, 2010 11:21 PM
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] Is it possible to generate DLLs?

using a zip format blocks you from using it in certain ways like adding 
it as a reference to visual studio.
Nobody says your dll needs to contain just ruby code. It can contain 
thin C# wrappers for example.
---
Met vriendelijke groeten - Best regards - Salutations
Ivan Porto Carrero
Blog: http://flanders.co.nz
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)


On Mon, Jan 25, 2010 at 3:04 AM, Bassel Samman 
<lists@ruby-forum.com<mailto:lists@ruby-forum.com>> wrote:
Orion Edwards wrote:
> am I confused?
Nope, no SilverLight here, just a desktop app with MSCharts, win forms
and a whole lot of IronRuby metaprogramming goodness.
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org<mailto:Ironruby-core@rubyforge.org>
http://rubyforge.org/mailman/listinfo/ironruby-core
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.