Convert .rb to .exe

1,082 views
Skip to first unread message

Fagner Souto

unread,
Jun 2, 2014, 1:06:41 PM6/2/14
to rubyin...@googlegroups.com
Hy everyone!

      I would like to know if someone know how to convert .rb to .exe with ruby 2.0.

tks

Luis Lavena

unread,
Jun 2, 2014, 6:24:22 PM6/2/14
to rubyin...@googlegroups.com
Hello Fagner and welcome,

Please see my response inline.

On Mon, Jun 2, 2014 at 2:06 PM, Fagner Souto <fagner...@gmail.com> wrote:
Hy everyone!

      I would like to know if someone know how to convert .rb to .exe with ruby 2.0.


This is a quite common question asked, how to generate a standalone executable of your Ruby script.

There are several approaches and each one have its complexities, downsides and others.

A common one is usage of Ocra:


Which wraps your script, it's dependencies and Ruby into a single package that gets self-extracted on invocation.

Pros: easy to get started, simpler to get working and works across different versions of Ruby.

Cons: attempt to use with applications that open ports (like a web server) will trigger Windows Firewalls alerts on every execution.

Extracting the contents of Ruby, gems and other dependencies on every run might result in the perception of slow startup/execution.

--

Exerb:


Is a port of Exerb, a Japanese tool that is tailored at packaging *just* enough code to produce a native executable. It doesn't extract contents into temporary folders like Ocra, but requires a higher understanding of Ruby, compilers and how gems work to produce a standalone executable.

Is not very common compared to Ocra, but still a valid option.

I recommend you start with something like Ocra right now (since I don't know your requirements) and if you need something more customized, then you can start researching Exerb.

Regards,
-- 
Luis Lavena
AREA 17
-
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry

BallenaEnFuego

unread,
Jun 6, 2014, 10:40:28 AM6/6/14
to rubyin...@googlegroups.com

Hi Luis,

Have you tried releasy (https://github.com/Spooner/releasy/)? I haven't, but according to the docs, it gives more options for Windows packages than the Ocra approach.

Luis Lavena

unread,
Jun 6, 2014, 7:27:22 PM6/6/14
to rubyin...@googlegroups.com
Hello,

On Fri, Jun 6, 2014 at 11:40 AM, BallenaEnFuego <eta...@gmail.com> wrote:

Hi Luis,

Have you tried releasy (https://github.com/Spooner/releasy/)? I haven't, but according to the docs, it gives more options for Windows packages than the Ocra approach.


I have no experience with releasy, but seems to be a installer and not a packager.

Seems similar to Chef omnibus which bundles Ruby, your gems and everything into an installer, not generating a single executable that can be executed without installation.

For a real-life example of Chef omnibus installer, see Vagrant, which uses Ruby, gems and other stuff to provide a simple command line tool, but doesn't package everything into a single exe.

Cheers,
-- 
Reply all
Reply to author
Forward
0 new messages