I am exploring using RoR for an enterprise application that needs to be given out to customers, and the two criteria I am looking at are packaging and ease of deployment/upgrade, and protecting source code.
Can someone point me to some references for these two – how are RoR projects packaged and deployed, and if they can be compiled into binaries before distribution.
The way that you protect your Ruby code is usually by not giving it to anyone. If you provide software as a service, and you keep the secret sauce on your server, that's the ticket. If you want to sell the source code to your customers, guess what -- they can read it, because it's not a compiled language.
Ah…sorry about that. I haven’t used JRuby myself but am planning to.
I remember reading a long time ago that Thoughtworks have devised a method of code protection for their Mingle product, using JRuby. I don’t know how its done though.
But there’s gotta be a way, no? As I understand it, although the WAR file code can be viewed it can’t be changed. If it references some kind of encrypted Java class which needs an external licence file, perhaps that would do it? The licence file could include a customer hardware or name key etc.
Sorry, that's not true. A WAR file is just a packaged (equivalent to tar)
directory structure that's usually un-WAR'd on deployment. And you
can do anything you want with the contents at that point.
Are you familiar with the Servlet Spec? If not, I'd strongly recommend
reading it to understand how a Java web app (and hence a WAR file)
is structured.
The deployment part somewhat depends on what servlet container
you're using, so check the relevant docs. Alternatively you can use
something like capistrano with custom recipes.
I used to work for a company that did exactly this. We had an on
premise enterprise server we were selling and distributing to clients
written in ruby. Yes, we did WAR it all up too, but that's it what
you're looking for.
JRuby has the ability to *actually compile* your ruby code into
java .class files. This has some clear performance benefits since your
rb files aren't being interpreted at runtime anymore, but it also
gives you some obvious advantages when your distributing your code.
In my opinion it's the only decent way to distribute ruby. There's
loads of documentation on the topic if you look it up.
Also, one other quick word of advice: watch those license agreements
in your dependencies carefully.
Much of the awesome open source code we love and enjoy in the ruby
community has entire different rules when your distributing it vs
running it on a web server. Have your lawyers check it over good. The
good news is though that if JRuby also lets you leverage java
libraries in your ruby code so you can no doubt find what you need.
Which, it should be pointed out, can be easily de-compiled to reveal
a pretty decent representation of your source code
The OP should note that pretty much all companies distributing their
software to end users use licensing agreements to protect proprietary
IP, not just obfuscation (via e.g. compilation).
JRuby has the ability to actually compile your ruby code into
java .class files.
Which, it should be pointed out, can be easily de-compiled to reveal
a pretty decent representation of your source code
I am seasoned java developer and have used DJ decompiler and Jad pretty extensively myself. With largest level of obfuscation it takes decent expertise to figure out what those a/b/c/d variables represent and interpret the logic. With ruby even the starters can figure out everything, so I’d be happy if we can achieve at least the level of complexity of java bytecodes for my ruby source.
The OP should note that pretty much all companies distributing their
software to end users use licensing agreements to protect proprietary
IP, not just obfuscation (via e.g. compilation).
Point taken, this is a must, it’s just that it’s not sufficient. There are situations where some large enterprises require highest level of security for their data and they are sensitive about the vendor product being confidential as they know they are not without bugs And I am talking of practical reality and not some mathematically proven RSA algorithm which is open to the public to challenge