In article <IgWpc.42776$TT.6423 / news-server.bigpond.net.au>, Dave Burt <burtdav / hotmail.com> wrote: >I'll skip what Gavin has already covered and I agree with. > >> * This is going to be commercial software, and I do NOT intend to give >> away the source code. Is their a way that Ruby programs can be >> securely compiled so that the source code is inaccessible? > >It seems to me that the language lends itself to being quite well >obfuscated, but Ruby users at the moment are largely developers and >open-source fans, so there isn't such a thing (AFAIK) as an obfuscator, yet. >Could be fun to write, for an experienced rubyist. I can easily imagine that one could write a crypto_require or obfuscated_require method that does what the built-in require does, but first applies some decryption algorithm of your choice to the required file. This wouldn't be that difficult to do. > >If you want "secure compilation", I believe this limits you to using C or >C++. Java and .NET, for example, "compile" into bytecode for a virtual >machine that is tailored to run them, and decompilers are readily available >that will produce quite legible source. Although, with something like >Perl/Tk, you may be able to use their B::C module/perlcc program (see >perlcompile manpage) to compile to native code via C. > >Finally, comments are a significant part of the value of source code. When >you compile your .NET or Java app, you will strip the comments. In lieu of >an obfuscator, a simple script to strip the comments before packaging your >app is half-way there. > >> * For that matter, is there a way that Ruby programs can be compiled >> as binary executables? On Windows, Linux, and Mac? > >Not that I know of. But there should be. > Actually, it seems like you culd just emed Ruby into a very simple C program that essentially just starts the ruby interpreter and does a rb_require of your script. You shouldn't even need to learn any C code as I'm sure someone here would be willing to supply the C main function for doing this (it should be less than a page). ;-) Phil