Ruby Compiling

thehobbster

The Kwisatz Haderach
Jul 26, 2010
4,445
94
0
www.tricklecheddar.com
I know I should search this and not post, but this section is somewhat dead so I'd rather help it liven up. Plus I don't think I'm using the right terminology.

In college I studied Fortran and C++ but never really "exported" the files. I think it was called compiling, but I can't find anything in my searching, so I'm concerned my jargon is wrong.

Basically, I'm wrapping up the "Learn Ruby the Hard Way" lessons and I'm at the tail end of my text based RPG game. I want to be able to send it to some of my buddies who played those back in the day without them having to run the ruby code in their terminal.

Is there a way to make it into an executable file for Mac and Windows so they can just double click it and run it in its own window? What is this called?

Thanks!
 


Hell yeah, man! Thanks for the hook up. I'll be reading that in a few after I finish the final battle against the boss. This is so epic! I'll share it here when it's done. I appreciate it.
 
Okay, I've been chasing this down for about 10 hours straight, trying different things. Learned that all of the "compilers" I will mention below don't compile, but create application bundles that have a ruby install in them. This sounds great, except that it creates a temporary directory with your source code, meaning your intellectual property isn't safe with this method. But here is my adventure so far:

The OCRA, "One click ruby application" works only for windows executables and has to be run on windows. I haven't tried this on my windows computer yet, I'm trying to sort out a Mac one first.

I installed the tar2rubyscript and rubyscript2exe but they broke with Ruby 1.9. Which means that guys "Allinoneruby" also broke. I found a couple of fixed, but they don't work and everyone has abandoned it in favor of Ocra, which isn't helping me at this point.

I've looked for cross platform compilers as well.

I've seen Crate, but can find zero information about how to actually use it.

I've seen Shoes, a shitty GUI that supposedly ends up being very limited.

The only thing I've seen people talk about that has been successful for them is making an application bundle in JRuby, but they all said this was extremely complicated and undesirable.

I'd like make an application bundle for Windows and Mac OSX (Darwin?), I don't really care about Linux, but I'd take it as an added bonus. I'd like my source code to not be viewable as well, so I could eventually sell software.

Anybody struggled with this and found a solution? I think I'm starting to see why most stuff is Windows only.
 
the reason you're having trouble finding a good solution is because there isn't really one for Ruby. It's simply not a good language for packaging up apps unfortunately, because of its scripting (and metaprogramming) nature.

If you're willing to go for only Mac apps, you can use RubyCocoa to make decently performant native looking apps. The Pragmatic Bookshelf | Programming Cocoa with Ruby might be a good place to start. Or this: https://peepcode.com/products/meet-macruby
 
Platypus seems to be able to package up Mac apps, and even encrypt the code (I don't think that would keep real programmers out of it, or even folks with somewhat of an idea in decrypting. I think its just base64 or whatever).

I figured I'd just go with Platypus on the Mac and then Ocra on Windows and offer two separate downloads.

Does that seem reasonable?
 
You're trying really hard to make ruby something it's not. If you're wanting something that's safe your best best is something like C or C++. Even dotNet apps are REALLY easy to reverse engineer without paying a lot of money for a program that obfuscates them. Then after you pay a crap load of money you realize their obfuscation algo is already well known and cracked so it's useless. Java is the same way from what I understand. The best you'll get out of a C or C++ app is some really shitty asm or really shitty c or c++ that's basically useless.
 
honestly, I have been your position and I have spent over a year looking for an answer.

It seems everything but .net, c, java, and vb are horrible for what your looking for. I spent a ton of time combing over python, ruby, php, flex, air, etc for this and wanna know what I found? All of them basically suck when trying to convert them to an app in some way. Lots of choices, half of them work, the half that do work have tons of issues, etc.

Pretty much they all suck honestly. With that, I decided to just run something with PHP on the desktop with some tools I found. I would have done Ruby or Python.. but since they suck compiled too.. I just use PHP.