[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Compiling a Ruby app

Sharagoz --

3/2/2009 2:14:00 PM

Hi
Does there exist a compiler for compiling Ruby apps?
I dont like the idea of being forced to distribute apps open source.
My first concern is that distribution, at least on the windows platform,
will differ a lot from what users are used to.
My second concern is protecting source code.
I realize that everything that can be compiled can also be decompiled,
but I would like it to take a little more effort for average Joe to
view/edit source code than to simply right-click on somefile.rb and
opening it in wordpad.

I know about "rubyscript2exe", which solves the first part of the
problem, but not the second.

-S
--
Posted via http://www.ruby-....

21 Answers

Roger Pack

3/2/2009 6:54:00 PM

0

Sharagoz -- wrote:
> Hi
> Does there exist a compiler for compiling Ruby apps?
I believe there is a way to do this through using jruby, though I've
never done it.
Cheers!
-=r
--
Posted via http://www.ruby-....

David Masover

3/3/2009 10:10:00 AM

0

Sharagoz -- wrote:
> My second concern is protecting source code.
> I realize that everything that can be compiled can also be decompiled,
>

That is not entirely true. Or rather, it can be "decompiled", all right,
but not into anything resembling the original source code.

> but I would like it to take a little more effort for average Joe to
> view/edit source code than to simply right-click on somefile.rb and
> opening it in wordpad.

The main question you need to ask yourself is, why don't you want Joe to
do that?

If your goal is to prevent others from taking your code, repackaging it,
and selling it as their own, that's fine, although there are better ways
of doing it -- like legal measures.

If your goal is to prevent users from doing something they want to do --
for example, if this is a form of copy protection -- you should realize
two things:

- Someone (not Average Joe) will reverse engineer it, and publish a crack.
- Average Joe will be able to find that crack.

That is true with or without source code. It's not a "might", it's a "will".

But yes, if it's not possible now, I believe it will be possible to
compile JRuby.

But there is a reason the obvious solution is to never give your users a
program at all -- instead, build it as a web app, and host it yourself.

Sharagoz --

3/3/2009 10:49:00 AM

0

Thanks for the input.

So there is no way to compile a "regular" ruby app, you'd have to go for
Jruby?
I've seen projects like "Brite", "YARV" and "Rubinius" mentioned that
seems to be "compiler related" projects. (Excuse the poor terminology).
Will any of those do the job?

Im not concerned about reverse engineering or cracks being made for my
software. All I want is to be able to distribute it the traditional way
like most commercial software is (at least on the windows platform).
Open source makes code stealing too easy.

I find it strange that there isnt a compiler readily available for Ruby.
Is there a technical reason why there shouldnt be one?
Is it because Ruby is ment to be pure open source and never used in the
commercial sector?

I use Ruby on Rails for web apps, and its an excelent framework to work
in.
Sometimes though, client apps are a better solution and I was hoping I
could use Ruby for that purpose because I've grown fond of Ruby through
RoR.
--
Posted via http://www.ruby-....

Rick DeNatale

3/3/2009 1:23:00 PM

0

[Note: parts of this message were removed to make it a legal post.]

On Tue, Mar 3, 2009 at 5:09 AM, David Masover <ninja@slaphack.com> wrote:

> Sharagoz -- wrote:
>
>> My second concern is protecting source code.
>> I realize that everything that can be compiled can also be decompiled,
>>
>>
>
> That is not entirely true. Or rather, it can be "decompiled", all right,
> but not into anything resembling the original source code.


Actually closer than you might think:

require 'rubygems'
require 'ruby2ruby'

class Foo
def bar
a = 1
b = 2
a + b
end
end

puts Ruby2Ruby.translate(Foo)

produces:

class Foo < Object
def bar
a = 1
b = 2
(a + b)
end
end

--
Rick DeNatale

Blog: http://talklikeaduck.denh...
Twitter: http://twitter.com/Ri...
WWR: http://www.workingwithrails.com/person/9021-ric...
LinkedIn: http://www.linkedin.com/in/ri...

Florian Gilcher

3/3/2009 1:36:00 PM

0


On Mar 3, 2009, at 11:09 AM, David Masover wrote:

> Sharagoz -- wrote:
>> My second concern is protecting source code.
>> I realize that everything that can be compiled can also be
>> decompiled,
>>
>
> That is not entirely true. Or rather, it can be "decompiled", all
> right, but not into anything resembling the original source code.


Almost every kind of Bytecode is surprisingly well decompilable.

BTW: Open Source has nothing to do with the code being viewable.
Battlefield 2 and Eve Online for example contain large portions of
viewable code, but none of it is open source.

If Bytecode is enough for you: A patched Ruby 1.9-Interpreter is able
of loading Bytecode (it is off, due to likely changes in the Bytecode
format). Exporting is already available. I don't think there are
readymade solutions available, but you could construct something out
of it.

Regards,
Florian

--
Florian Gilcher

smtp: flo@andersground.net
jabber: Skade@jabber.ccc.de
gpg: 533148E2


John Wells

3/3/2009 1:52:00 PM

0

On Tue, Mar 3, 2009 at 5:09 AM, David Masover <ninja@slaphack.com> wrote:
> Sharagoz -- wrote:
>>
>> My second concern is protecting source code.
>> I realize that everything that can be compiled can also be decompiled,
>>
>
> That is not entirely true. Or rather, it can be "decompiled", all right, but
> not into anything resembling the original source code.
>
>> but I would like it to take a little more effort for average Joe to
>> view/edit source code than to simply right-click on somefile.rb and
>> opening it in wordpad.
>
> The main question you need to ask yourself is, why don't you want Joe to do
> that?
>
> If your goal is to prevent others from taking your code, repackaging it, and
> selling it as their own, that's fine, although there are better ways of
> doing it -- like legal measures.

You know, I see this argument repeated from time to time on the ruby
mailing list and I have to disagree. Legal measures are a (expensive)
way of defending your intellectual property, but preventing access is
the easiest and by far the cheapest. Any time you have to do something
with the word "legal" in it, it's costing you hourly money. For a
small shop, this can often be debilitating.

The only time legal measures would be pointed out as a better option
than prevention...is when the option for prevention doesn't exist...

John

Florian Gilcher

3/3/2009 3:22:00 PM

0


On Mar 3, 2009, at 2:51 PM, John Wells wrote:

> On Tue, Mar 3, 2009 at 5:09 AM, David Masover <ninja@slaphack.com>
> wrote:
>> Sharagoz -- wrote:
>>>
>>> My second concern is protecting source code.
>>> I realize that everything that can be compiled can also be
>>> decompiled,
>>>
>>
>> That is not entirely true. Or rather, it can be "decompiled", all
>> right, but
>> not into anything resembling the original source code.
>>
>>> but I would like it to take a little more effort for average Joe to
>>> view/edit source code than to simply right-click on somefile.rb and
>>> opening it in wordpad.
>>
>> The main question you need to ask yourself is, why don't you want
>> Joe to do
>> that?
>>
>> If your goal is to prevent others from taking your code,
>> repackaging it, and
>> selling it as their own, that's fine, although there are better
>> ways of
>> doing it -- like legal measures.
>
> You know, I see this argument repeated from time to time on the ruby
> mailing list and I have to disagree. Legal measures are a (expensive)
> way of defending your intellectual property, but preventing access is
> the easiest and by far the cheapest. Any time you have to do something
> with the word "legal" in it, it's costing you hourly money. For a
> small shop, this can often be debilitating.
>
> The only time legal measures would be pointed out as a better option
> than prevention...is when the option for prevention doesn't exist...
>
> John
>

My argument is usually a different one: is your code sufficiently
interesting and reusable enough to be stolen?

Usally, programs are stolen entirely, not in parts. No part of code
blurring can fix that.

There are solutions to this (code obfuscation, removing comments,
etc.) that make it harder for uninitated thieves, but a lot of people
just don't see a need for them. So, no one implements them. If you see
the need: go ahead.

It is a problem of introspective languages since day 1: if the program
knows everything about itself, everyone can make the program speak
about itself.

Regards,
Florian


--
Florian Gilcher

smtp: flo@andersground.net
jabber: Skade@jabber.ccc.de
gpg: 533148E2


Kyle Schmitt

3/3/2009 4:03:00 PM

0

Err, not to attempt to de-rail a good open vs closed argument, but
lets look at what the guy said,

"Im not concerned about reverse engineering or cracks being made for my
software. All I want is to be able to distribute it the traditional way
like most commercial software is"

It sounds to me like the main thing he wants to make a self contained
installer that bundles up everything needed for the app to run, so
it's transparent to the user whether it's ruby, C#, python or Java.

That's rather admirable, especially considering that even some
Microsoft downloads have dependencies that aren't auto-installed.

What are the ways do do that? From hardest to easiest:
A) Have the installer check for a compatible ruby then install if
necessary (I used to make installers for work, this method may really
suck unless someone has already made a template, or the installer
software already supports it)
B) Install just enough of a ruby distro local to the applications
directory (lots of legwork for you, but maybe worth it)
C) Compile the application with JRuby, install the requisite JRuby
jars (there's only one or two, right?), and have the installer install
Java if necessary (relatively easy, since there are lots of templates
and installers that already support installing Java, if necessary)
D) Compile the application using ruby2c or ruby2cext or something
similar, and distribute the program with a static ruby.exe + one huge
honkin .so that it loads.
E) Magically compile the application to a native windows binary.....


I'd say A is in many ways best, since the user then has a full ruby
stack ever-after, but C looks really _really_ inviting too.

--Kyle

Kyle Schmitt

3/3/2009 4:04:00 PM

0

Note on option B, "Shoes" by why the lucky stiff works this way.
There may be notes on the shoes website about how the installer was
made. Or he may just share the files for making the installer if you
ask.

Florian Gilcher

3/3/2009 6:06:00 PM

0


On Mar 3, 2009, at 5:02 PM, Kyle Schmitt wrote:
>
> "Im not concerned about reverse engineering or cracks being made for
> my
> software. All I want is to be able to distribute it the traditional
> way
> like most commercial software is"

In the first post, he also said that he wanted to protect his source
code.

But, i forgot:

http://rawr.ruby...

is a good option to do that.

Regards,
Florian

--
Florian Gilcher

smtp: flo@andersground.net
jabber: Skade@jabber.ccc.de
gpg: 533148E2