Guys,
We're considering Ruby here at work for a web application we would resell
to customers.
We're currently a Java shop, so distributing code in binary form (via
class files) is no problem. We get a few benefits: performance benefits
and IP protection (via bytecode obfuscation).
Is there any way to precompile ruby programs? How have you handled
similar scenarios? This is unfortunately a stopping point for us, as we
can't comfortably distribute our readable code to clients.
I appreciate any insight you can provide.
John
We have an internal tool with a lot of dependencies: wxRuby, SSL libraries etc, but the guys that use it don't want to stuff around installing all that on their machine to use our tool so we package it all up into an exe with exerb (http://exerb.sourceforge.jp/index.en.html\)
Works really well. The resulting executable is fairly large, but it works perfectly, performance is fine (hard to tell with our app, because it's not very cpu intensive).
HTH
David
John Wells wrote:
···
Guys,
We're considering Ruby here at work for a web application we would resell
to customers.
We're currently a Java shop, so distributing code in binary form (via
class files) is no problem. We get a few benefits: performance benefits
and IP protection (via bytecode obfuscation).
Is there any way to precompile ruby programs? How have you handled
similar scenarios? This is unfortunately a stopping point for us, as we
can't comfortably distribute our readable code to clients.
I appreciate any insight you can provide.
John
--
David Mitchell
Software Engineer
Telogis
NOTICE:
This message (including any attachments) contains CONFIDENTIAL
INFORMATION intended for a specific individual and purpose, and
is protected by law. If you are not the intended recipient,
you should delete this message and are hereby notified that any
disclosure, copying, or distribution of this message, or the
taking of any action based on it, is strictly prohibited.
this doesn't make me feel too comfortable
decompile java - Google Search
in particular
"It turns out, due to a quirk in the design of the Java Runtime system and
the relationship with its compilers, that Java code can be almost entirely
reconstructed, including the actual names of variables used by the original
programmer! The only things missing are the comments. This is an amazing
oversight in the architecture of Java. Why is it this way? I don't know. I'd
be interested in hearing more."
from
DaveNet : Decompiling Java
dated - but food for thought.
cheers.
-a
···
On Wed, 27 Apr 2005, John Wells wrote:
We're considering Ruby here at work for a web application we would resell to
customers.
We're currently a Java shop, so distributing code in binary form (via class
files) is no problem. We get a few benefits: performance benefits and IP
protection (via bytecode obfuscation).
Is there any way to precompile ruby programs? How have you handled similar
scenarios? This is unfortunately a stopping point for us, as we can't
comfortably distribute our readable code to clients.
I appreciate any insight you can provide.
--
email :: ara [dot] t [dot] howard [at] noaa [dot] gov
phone :: 303.497.6469
although gold dust is precious, when it gets in your eyes, it obstructs
your vision. --hsi-tang
===============================================================================
With nodewrap, you can store the code as an AST:
[pbrannan@zaphod tmp]$ cat test.rb
def foo
p 1 + 1
end
foo()
[pbrannan@zaphod tmp]$ ruby -rnwobfusc test.rb > test2.rb
[pbrannan@zaphod tmp]$ cat test2.rb
require 'nodewrap'
if RUBY_VERSION != "1.8.2" then
$stderr.puts "Wrong Ruby version; please use 1.8.2"
exit 1
end
begin_nodes = Marshal.load("\004\010[\000")
n = Marshal.load("\004\010u:\020Node::BLOCK\002c\002\004\010[\ai\004*\255\r {\026i\004z\255\r [\ni\003? \010\"\ftest.rb[\aTi\004\336\255\r [\aTi\004p\255\r 0i\004>\255\r [\ni\003?0!\"\ftest.rb[\aFF:\010foo0i\004\254\255\r [\ni\003?(\021\"\ftest.rb[\aTi\004\312\255\r [\aTi\004\266\255\r :\006+i\004p\255\r [\ni\003? \030\"\ftest.rb[\aTi\004\216\255\r [\aFF0i\004\336\255\r [\ni\003?\020\n\"\ftest.rbi\000i\372[\aFFi\0044\255\r [\ni\003?\370\"\"\ftest.rbi\t[\aTi\004>\255\r 0i\004\242\255\r [\ni\003?P\021\"\ftest.rbi\006[\aTi\004\254\255\r [\aFFi\004f\255\r [\ni\003?\030\030\"\ftest.rb[\aFF0[\aTi\004z\255\r i\004*\255\r [\ni\003? \010\"\ftest.rb[\aTi\004R\255\r [\aTi\004 \255\r 0i\004\230\255\r [\ni\003?0\021\"\ftest.rb[\aTi\004\242\255\r :\006p0i\004\\\255\r [\ni\003?P\n\"\ftest.rb[\aTi\004f\255\r ;\000i\ai\004\312\255\r [\ni\003?\320\021\"\ftest.rb[\aFi\00600i\004 \255\r [\ni\003? \"\ftest.rb[\aTi\0044\255\r [\aFF0i\004\216\255\r [\ni\003?\370\022\"\ftest.rbi\a[\aTi\004\230\255\r 0i\004R\255\r [\ni\003?\370\n\"\ftest.rbi\006[\aTi\004\\\255\r 0i\004\300\255\r [\ni\003?\320\021\"\ftest.rb[\aFi\00600i\004\266\255\r [\ni\003?P\021\"\ftest.rbi\006[\aTi\004\300\255\r [\aFF")
begin_nodes.each do |node|
node.eval(self)
end
n.eval(self)
[pbrannan@zaphod tmp]$ ruby test2.rb
2
The process is still somewhat reversible, but afaik no one has written a
tool yet to do this.
I should also note that the code is still experimental, and you should test
your code thoroughly after transforming it this way.
Paul
One problem, just realised the ruby source is stored verbatim inside the executable, so this might not be your best bet. However, seaching for "build ruby exe windows" on google turns up a few other candidates.
David
David Mitchell wrote:
···
We have an internal tool with a lot of dependencies: wxRuby, SSL libraries etc, but the guys that use it don't want to stuff around installing all that on their machine to use our tool so we package it all up into an exe with exerb (http://exerb.sourceforge.jp/index.en.html\)
Works really well. The resulting executable is fairly large, but it works perfectly, performance is fine (hard to tell with our app, because it's not very cpu intensive).
HTH
David
John Wells wrote:
Guys,
We're considering Ruby here at work for a web application we would resell
to customers.
We're currently a Java shop, so distributing code in binary form (via
class files) is no problem. We get a few benefits: performance benefits
and IP protection (via bytecode obfuscation).
Is there any way to precompile ruby programs? How have you handled
similar scenarios? This is unfortunately a stopping point for us, as we
can't comfortably distribute our readable code to clients.
I appreciate any insight you can provide.
John
--
David Mitchell
Software Engineer
Telogis
NOTICE:
This message (including any attachments) contains CONFIDENTIAL
INFORMATION intended for a specific individual and purpose, and
is protected by law. If you are not the intended recipient,
you should delete this message and are hereby notified that any
disclosure, copying, or distribution of this message, or the
taking of any action based on it, is strictly prohibited.
With nodewrap, you can store the code as an AST:
[...]
The process is still somewhat reversible, but afaik no one has written a
tool yet to do this.
I should also note that the code is still experimental, and you should test
your code thoroughly after transforming it this way.
Looks cool! The url, for the google-impaired:
http://rubystuff.org/nodewrap/
cheers,
Mark
···
On 4/27/05, Paul Brannan <pbrannan@atdesk.com> wrote: