Obfuscating rails code with jruby


#1

Well im trying to turn my .rb files (for example
application_controller.rb) into .class files (java byte files) to
obfuscate them.

I can do that by running javac application_controller.rb from the
command line and it gives me application_controller.class which is
pretty obfuscated.

According to some older documentation I should be able to delete the
application_controller.rb and jRuby will just use the .class file at
runtime - https://github.com/jruby/jruby/wiki/RailsAOT

However that doesnt work at all. So then I tried using a java_import
method to load that class like this -
https://www.ruby-forum.com/topic/216572#939791

But I get an error saying ‘cannot import application_controller as
application_controller’ Im guessing because ruby wants camel case class
names and I can see by decompiling the byte code that the java class is
named application_controller.

Basically, I just need to figure out a way to obfuscate the source to
protect it.

ALSO, I have looked at using warble to generate a .war, but we already
have a solid IIS and puma environment using jruby that I cant really
mess with.