"Compiling" Ruby

written by amcvega on November 21st, 2006 @ 04:36 PM

We mostly deal with server-side applications. However, every so often someone comes up to us and asks if we can create and install an application on their PC. This used to present us with a bit of a dilemma since server-side applications are by nature, not that easy to install. This is usally okay since you’re really only going to be doing it once. Client-side applications on the other hand have to be really easy setup to use. Here are some of the requirements for distrubting an app:
  1. You cannot have the customer setup their own database on their computer
  2. You can’t have the customer install their own webserver
  3. You definitely cannot have the customer install the compiler/interpreter that you need to run your application.
  4. You cannot have the customer click more than one thing. (Anymore than one click, and things start to get really messy)

We’ve discovered the first steps to a solution to this dilemma for our rails apps thanks to a fascinating project on distrubuting ruby applications and another one for rails applciations. It’s not perfect but it’s good enough until we hear something from the JRuby, XRuby, Rite, or YARV projects along the lines of an actual compiler for ruby.

They’re pretty straightforward guides to “compiling” your ruby application here are a few lessons learned in our foray into this brave new world:
  • Make sure you use a portable database solution like SQLite. Everything is stored in one file and you can easily ship it with your app
  • Take a second look at your applcation if it has file-upload features.
  • Thank the man. It’s people like him that make the world a better place.


  • Ronny on 19 Dec 03:36

    Miguel, I’ve had people asking me about compiling Ruby on Rails, but in a different setting; Say you have a proprietary server application that you’re going to run on your customers’ Linux servers, but you don’t want the customer to be able to (easily) view or change the code. Although most compiled code can be decompiled, this is not the point. They don’t want to make a 100% secure way of preventing the customer to view their code, they don’t have that today either. They want to create a border, to make their product a black box rather than a transparent one. If the customer crosses this border, decompiling it, there is no doubt that this is a violation. Is there a way you can compile ruby code so that it will run fine on the server, but the full source is not available unless you actively decompile it?

Post a comment