-
Notifications
You must be signed in to change notification settings - Fork 3
Home
This repository shows how to create standalone .Net applications written in Ruby.
You can package up Ruby applications as ordinary .Net executables without having to ship a collection of plain-text Ruby source files and the associated standard Ruby libraries.
If you want proof, look at the single file IRSinatra.exe
which demonstrates a fully operational Sinatra example program. It needs no other files – you just need the IronRuby runtime DLLs to be available on the PC.
Your source Ruby files are embedded directly into your executable, and you can use require
, load
, File.open
etc just as if the files were on disk.
No-one need ever know… (including your IT department).
Example:
EmbeddedRuby er = new EmbeddedRuby();
er.Mount("Applications");
exitcode = er1.Run("main.rb");
Note: You may also want to take al look at IronRubyAppPackager. This is a packaging solution that integrates IronRubyEmbeddedApps and Serfs into a (nearly) single-step solution for creating .exe files. It uses GZip compression on the embedded resources to keep files (a) small and (b) obscured.
To create an Embedded Ruby application, you just need the following components:
IronRuby is the Open Source version of Ruby for .Net
Serfs is a “Simple Embedded Resource File System” for .Net. It provides access to files embedded in .Net assemblies. Files can be encoded for privacy.
IREmbeddedApp provides a wrapper for IronRuby and Serfs, and a bootstrap that patches the appropriate Ruby methods so that they can read files from embedded resources.
This repository contains the following parts
- IREmbeddedApp : The core IREmbeddedApp dll.
- ExampleApps : An example command-line program showing how to run Ruby programs. See Examples
-
IREmbeddedLibraries : A DLL containing a copy of the standard Ruby 1.8 libraries (including
rubygems
,rexml
etc), plusrack-1.1.0
andsinatra-1.0
. This can be optionally included in an application if you need library support. - IRSinatra : A fully working Sinatra application with 2 flavours, one with libraries in individual DLLs, one with them all merged into the .exe: Merging assemblies
- IRTestResources : An example DLL containing no code, just embedded resources (optparse, test::unit and flexmock taken directly from an ordinary Ruby install).