Distributing Ruby applications

Hello Rubyists,

I was hoping to hear some thoughts on the distribution of applications
made with Ruby. Say I make a GUI app with wxRuby. I am not guaranteed
that the user will have wxRuby, or even have Ruby at all. I want to make
it as easy as possible for other people to run it.

I thought that I could distribute my app as a zip file which would
contain a copy of ruby for the intended platform, as well as all the
libraries, and of course my Ruby program. The zip would also contain a
shell script which would set up the appropriate Ruby environment and run
the application. Something like this:

#/bin/sh

···

myprogram – This is the file that the user actually runs.

RUBYLIB=".“
PATH=”."

ruby my_ruby_prog.rb

I’m sure that it’s possible to do something like that for Windows also.

The user would simply unzip the file and click on “myprogram”, which is
the above shell script. So it would be a zero-install program.

Would this work the way I expect?

My distribution zip file could contain a directory for every platform that
is supported.

Thoughts?

Daniel Carrera | PGP: 6643 8C8B 3522 66CB D16C D779 2FDD 7DAC 9AF7 7A88
Math PhD. UMD | http://www.math.umd.edu/~dcarrera/pgp.html

Weekly Smile:
There are 10 types of people in the world…
Those who understand binary - and those who don’t.

Daniel Carrera wrote:

Hello Rubyists,

I was hoping to hear some thoughts on the distribution of applications
made with Ruby. Say I make a GUI app with wxRuby. I am not guaranteed
that the user will have wxRuby, or even have Ruby at all. I want to make
it as easy as possible for other people to run it.

I thought that I could distribute my app as a zip file which would
contain a copy of ruby for the intended platform, as well as all the
libraries, and of course my Ruby program. The zip would also contain a
shell script which would set up the appropriate Ruby environment and run
the application. Something like this:

#/bin/sh

myprogram – This is the file that the user actually runs.

RUBYLIB=“.”
PATH=“.”

ruby my_ruby_prog.rb

I’m sure that it’s possible to do something like that for Windows also.

I already do this for the Windows distribution of FreeRIDE, except that I
use the NSIS installer instead of a zip file. This gives me more control
than I can get with a zip file.

Curt

···

The user would simply unzip the file and click on “myprogram”, which is
the above shell script. So it would be a zero-install program.

Would this work the way I expect?

My distribution zip file could contain a directory for every
platform that
is supported.

Thoughts?

Daniel Carrera | PGP: 6643 8C8B 3522 66CB D16C D779 2FDD 7DAC 9AF7 7A88
Math PhD. UMD | http://www.math.umd.edu/~dcarrera/pgp.html

Weekly Smile:
There are 10 types of people in the world…
Those who understand binary - and those who don’t.

For Windows, I would highly suggest the exerb package.

http://exerb.sourceforge.jp/index.en.html

Very, very nice.

Nathaniel

<:((><

···

Daniel Carrera [mailto:dcarrera@math.umd.edu] wrote:

I was hoping to hear some thoughts on the distribution of applications
made with Ruby. Say I make a GUI app with wxRuby. I am not guaranteed
that the user will have wxRuby, or even have Ruby at all. I want to make
it as easy as possible for other people to run it.

You know what would be cool? If one wrote an installer with wxRuby which
could get run from the configuration script.

#!/bin/sh

installer.sh

RUBYLIB=".“
PATH=”."

ruby installer.rb

Then THAT could install Ruby togeter with all the appropriate libraries
and stuff.

I once saw a self-extracting Linux program that was essentially a bash
script with a pile of binary data packed at the end. If I could just
remember how they did that…

Well, I’ll keep thinking.

···


Daniel Carrera | PGP: 6643 8C8B 3522 66CB D16C D779 2FDD 7DAC 9AF7 7A88
Math PhD. UMD | http://www.math.umd.edu/~dcarrera/pgp.html

Weekly Smile:
There are 10 types of people in the world…
Those who understand binary - and those who don’t.

Daniel Carrera wrote:

Thoughts?

This is a topic I’m always interested in – wanted to plug this page:

http://www.rubygarden.org/ruby?DistributeARubyAppInASingleExecutable

···

Chris
http://clabs.org/blogki

Windows is not the only platform I would be interested in supporting. In
fact, Mac OS X and Linux would rank higher in my list. I guess I can use
exerb for the Windows version, but I’m still interested in what I can do
for most operating systems.

···

On Fri, Aug 08, 2003 at 09:50:40AM +0900, Nathaniel Talbott wrote:

For Windows, I would highly suggest the exerb package.

http://exerb.sourceforge.jp/index.en.html

Very, very nice.


Daniel Carrera | PGP: 6643 8C8B 3522 66CB D16C D779 2FDD 7DAC 9AF7 7A88
Math PhD. UMD | http://www.math.umd.edu/~dcarrera/pgp.html

Weekly Smile:
There are 10 types of people in the world…
Those who understand binary - and those who don’t.

What is NSIS? Is that something I can use in most platforms?

···

On Fri, Aug 08, 2003 at 09:45:39AM +0900, Curt Hibbs wrote:

I’m sure that it’s possible to do something like that for Windows also.

I already do this for the Windows distribution of FreeRIDE, except that I
use the NSIS installer instead of a zip file. This gives me more control
than I can get with a zip file.


Daniel Carrera | PGP: 6643 8C8B 3522 66CB D16C D779 2FDD 7DAC 9AF7 7A88
Math PhD. UMD | http://www.math.umd.edu/~dcarrera/pgp.html

Weekly Smile:
There are 10 types of people in the world…
Those who understand binary - and those who don’t.

You might get some ideas from ‘man shar’. shar only works with plain text,
but I guess you could have a uuencoded tar file or somesuch.

Regards,

Brian.

···

On Fri, Aug 08, 2003 at 12:49:14PM +0900, Daniel Carrera wrote:

I once saw a self-extracting Linux program that was essentially a bash
script with a pile of binary data packed at the end. If I could just
remember how they did that…

I once saw a self-extracting Linux program that was essentially a bash
script with a pile of binary data packed at the end. If I could just
remember how they did that…

Well, I’ll keep thinking.

http://www.megastep.org/makeself/

Try that.

Daniel Carrera wrote:

You know what would be cool? If one wrote an installer with wxRuby which
could get run from the configuration script.

#!/bin/sh

installer.sh

RUBYLIB=“.”
PATH=“.”

ruby installer.rb

Then THAT could install Ruby togeter with all the appropriate libraries
and stuff.

That would be really cool!

I have a desktop GUI app that I’ve been wanting to create for years that I’m
going to start on once wxRuby is ready, and a nice cross-platform Ruby-App
installer would be a nice adjunct to that project – unless someone else
does it first. :slight_smile:

Curt

Nathaniel Talbott wrote:

For Windows, I would highly suggest the exerb package.

http://exerb.sourceforge.jp/index.en.html

Very, very nice.

Alrighty - I’m finally getting around to checking it out. I’m trying to
squeeze this in the cracks of time on the day job – is there a ‘getting
started with exerb’ doc or email discussion anywhere? It appears I need
to make an .rbc file, but I’m a little sketchy on it. I’ll continue
diving in, but some advance pointers would be nice if anyone’s got anything.

···

Chris
http://clabs.org/blogki

While we’re on the topic - AAP project (www.a-a-p.org) has ambition to become
multi-platform tool handling all kinds of stuff - (un)install is just one of them.

Too bad it’s not in Ruby :frowning:

Sincerely,
Gour

···

Chris Morris (chrismo@clabs.org) wrote:

Daniel Carrera wrote:

Thoughts?

This is a topic I’m always interested in – wanted to plug this page:

http://www.rubygarden.org/ruby?DistributeARubyAppInASingleExecutable


Gour
gour@mail.inet.hr
Registered Linux User #278493

Daniel Carrera wrote:

I’m sure that it’s possible to do something like that for
Windows also.

I already do this for the Windows distribution of FreeRIDE,
except that I
use the NSIS installer instead of a zip file. This gives me more control
than I can get with a zip file.

What is NSIS? Is that something I can use in most platforms?

It is an open-source installer for Windows only. It can be found at:

http://nsis.sourceforge.net/site/index.php

Curt

···

On Fri, Aug 08, 2003 at 09:45:39AM +0900, Curt Hibbs wrote:

There are docs in the exerb distribution that outline the basics of it. The
sourceforge page of the project has the one-liner you need to make an
initial recipe file:

$ ruby -r exerb/mkrbc foo.rb

Works quite well. I have had trouble using YAML with exerb, but haven’t had
a chance to investigate it further. Other than that, everything I’ve tried
has worked fine, and I haven’t even had to hand-edit the generated recipe
file.

The one thing I did that was a bit more complex was to build a new rbx file
for 1.8.0… but even that wasn’t too tough.

HTH,

Nathaniel

<:((><

···

Chris Morris [mailto:chrismo@clabs.org] wrote:

Nathaniel Talbott wrote:

For Windows, I would highly suggest the exerb package.

Alrighty - I’m finally getting around to checking it out. I’m trying to
squeeze this in the cracks of time on the day job – is there a ‘getting
started with exerb’ doc or email discussion anywhere? It appears I need
to make an .rbc file, but I’m a little sketchy on it. I’ll continue
diving in, but some advance pointers would be nice if
anyone’s got anything.

Chris Morris wrote:

Nathaniel Talbott wrote:

For Windows, I would highly suggest the exerb package.

http://exerb.sourceforge.jp/index.en.html

Very, very nice.

Alrighty - I’m finally getting around to checking it out. I’m trying to
squeeze this in the cracks of time on the day job – is there a ‘getting
started with exerb’ doc or email discussion anywhere? It appears I need
to make an .rbc file, but I’m a little sketchy on it. I’ll continue
diving in, but some advance pointers would be nice if anyone’s
got anything.

I’m very interested in this as well, but I don’t currently have any time to
try it out. So, please continue to post your experience in getting it to
work in this thread. I will save it for later use.

Thanks,
Curt

Curt Hibbs wrote:

Daniel Carrera wrote:

What is NSIS? Is that something I can use in most platforms?

It is an open-source installer for Windows only. It can be found at:

http://nsis.sourceforge.net/site/index.php

It’s quite tasty, too, though I would highly recommend getting the free
IDE/form builder thing, HS NIS Edit:

Makes it much easier to gget started build scripts and creating custom
installer screens.

James

···

Curt

Curt Hibbs wrote:

I’m very interested in this as well, but I don’t currently have any time to
try it out. So, please continue to post your experience in getting it to
work in this thread. I will save it for later use.

First off, download the main tar.gz (currently
http://downloads.sourceforge.jp/exerb/4788/exerb-2.6.6.tar.gz), AFAIK,
this is the only download that includes the exerb/mkrbc.rb file. I
started with the
http://downloads.sourceforge.jp/exerb/4348/exerb-win32-2.6.5.0.zip
download, which has only what you need, if you can build your own .rbc
file yourself.

So – download exerb-2.6.6.tar.gz
http://downloads.sourceforge.jp/exerb/4788/exerb-2.6.6.tar.gz, run the
install.rb file.

Then run ruby -r exerb/mkrbc yourscripthere.rb

This will actually execute your script and identify dependencies. It
creates both a .mak and an .rbc file. The .mak doesn’t seem necessary
for my needs – my guess it’s used to build your final .exe by also
compiling fresh exerb binaries as well, but you don’t need to do that.

The .rbc file I got looked like this:

# generated by mkrbc.rb
kcode    none
script    extraction.trace.rb
script    cl/util/console.rb   
c:/ruby/lib/ruby/site_ruby/1.8/cl/util/console.rb
script    sn/util/ado.rb   
c:/ruby/lib/ruby/site_ruby/1.8/sn/util/ado.rb
script    sn/util/db.rb    c:/ruby/lib/ruby/site_ruby/1.8/sn/util/db.rb
library    win32ole.so    c:/ruby/lib/ruby/1.8/i386-mswin32/win32ole.so

I wanted to move my .rbc file out of the directory it was made in, so I
added a full path to extraction.trace.rb:

# generated by mkrbc.rb
kcode    none
script    extraction.trace.rb    c:/dev/projects/tbe/extraction.trace.rb
script    cl/util/console.rb   
c:/ruby/lib/ruby/site_ruby/1.8/cl/util/console.rb
script    sn/util/ado.rb   
c:/ruby/lib/ruby/site_ruby/1.8/sn/util/ado.rb
script    sn/util/db.rb    c:/ruby/lib/ruby/site_ruby/1.8/sn/util/db.rb
library    win32ole.so    c:/ruby/lib/ruby/1.8/i386-mswin32/win32ole.so

Then I went back to the directory I installed the
exerb-win32-2.6.5.0.zip in (sorry if this is a little out of order
here…), copied in the extraction.trace.rbc file, and ran the
exerb-win32.exe file. This (no doubt an .exe made from exerb itself) exe
gives me a GUI where I can choose which .rbx file to use, which .rbc
file to use and the name of my resulting .exe.

The .rbx choices:

ruby168c.rbx    this option is console app, single file, large
ruby168crt.rbx  this option is console app, dependent on
exerb265.dll (included in exerb-win32-2.6.5.0.zip), smaller .exe
ruby168g.rbx    same options as before, GUI app I assume.
ruby168grt.rbx  --

My first build from the exerb-win32.exe failed, parsing error. I looked
into the .rbc – the full path I added needed a tab delimiter to be
consistent with the other lines generated. I changed that and wha-lah.
Out comes an .exe.

Only problem now is my .exe is segfaulting when trying out some win32ole
stuffs:

C:\Downloads\exerb-win32-2.6.5.0>extraction.trace.exe
sn/util/ado.rb:1: [BUG] Segmentation fault
ruby 1.6.8 (2002-12-24) [i586-mswin32]

abnormal program termination

But, this may be expected – newer 1.8 win32ole.so running with older
1.6.8. I’ll hit up Nathaniel for his 1.8.0.rbx.

So far – so good. Seems like stopping down to mess with this is worthwhile.

···

Chris
http://clabs.org/blogki

Nathaniel Talbott wrote:

The one thing I did that was a bit more complex was to build a new rbx file
for 1.8.0… but even that wasn’t too tough.

Could you slide me a copy? :slight_smile:

···

Chris
http://clabs.org/blogki

james_b james_b@neurogami.com wrote in news:3F331CC3.2060405
@neurogami.com:

NSIS Wiki

There is also Inno Setup:

http://www.jrsoftware.org/isinfo.php

Includes option for full scripting (Pascal like).

···


Robert Cowham