# Recommended cross platform deployment methods?

**URL:** <https://www.ruby-forum.com/t/recommended-cross-platform-deployment-methods/151459>\
**Category:** wxRuby\
**Created:** [October 21, 2008, 9:09pm UTC](https://www.ruby-forum.com/t/recommended-cross-platform-deployment-methods/151459 "2008-10-21T21:09:55Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![marke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/6bbea6/32.png) [@marke](https://www.ruby-forum.com/u/marke)\
**Post date:** [October 21, 2008, 9:09pm UTC](https://www.ruby-forum.com/t/recommended-cross-platform-deployment-methods/151459/1 "2008-10-21T21:09:55Z")

</div>

Hey all,

I’m just getting started with wxRuby but I really like it. I have felt  
the joy of writing a simple app (using DialogBlocs & xrcise) and running  
it on Windows and Linux. Ahh. Peace.

Oh, and it didn’t suck like my experiences with Java doing the same  
exact simple app. 🙂

So, my question is, is there a recommended deployment method for  
multiple platforms?

Windows:  
I can create a shortcut to run the application with rubyw so no console  
window shows up. How can I ensure the correct versions of Ruby and  
wxRuby? Can I run it without forcing the user to install either? (Binary  
versions?)

Oh, and I know about script2exe for windows.

Linux:  
I tested on Kubuntu KDE 4.1.2. The same questions about ruby and wxRuby  
versions being installed. How do I create shortcuts to run the  
application using ruby with the comparable “rubyw.exe” option.

Thanks!  
-MarkE

---

<div class="post-metadata">

**Author:** ![marke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/6bbea6/32.png) [@marke](https://www.ruby-forum.com/u/marke)\
**Post date:** [October 22, 2008, 4:07am UTC](https://www.ruby-forum.com/t/recommended-cross-platform-deployment-methods/151459/2 "2008-10-22T04:07:29Z")

</div>

Well, you already know about rubyscript2exe, which works on all 3  
platforms. That’s about the only thing I can suggest for it.

On Linux: You create a shortcut, which is basically an INI Type file,  
with  
the extension .desktop, EG: MyProg.desktop, and in it, is the following  
info:

[Desktop Entry]  
Version=1.0  
Exec=/home/eumario/bin/ie6  
Icon=/home/eumario/.ies4linux/ies4linux.png  
Name=Internet Explorer 6.0  
GenericName=Web Browser  
Comment=MSIE 6.0 by IEs4Linux  
Encoding=UTF-8  
Terminal=false  
Type=Application  
Categories=Application;Network;

This is just a copy of my IEs4Linux. But you can use any name you want  
in  
the Name field, and it doesn’t have to match what you named the actual  
file,  
and the name is what will be displayed. It’s not like Microsoft, where  
there is a proprietary format to the shortcut. 😉

hth,

Mario

---

<div class="post-metadata">

**Author:** ![marke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/6bbea6/32.png) [@marke](https://www.ruby-forum.com/u/marke)\
**Post date:** [October 22, 2008, 9:36am UTC](https://www.ruby-forum.com/t/recommended-cross-platform-deployment-methods/151459/3 "2008-10-22T09:36:24Z")

</div>

There’s another interesting way to explore to be able to generate  
executable  
into different platform:

Look at the way shoes do it:

[http://hackety.org/2008/06/19/stampingExesAndDmgs.html](http://hackety.org/2008/06/19/stampingExesAndDmgs.html)

It would be great having that for wxruby applications as well.

regards.

bio.

---

<div class="post-metadata">

**Author:** ![marke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/6bbea6/32.png) [@marke](https://www.ruby-forum.com/u/marke)\
**Post date:** [October 22, 2008, 9:51am UTC](https://www.ruby-forum.com/t/recommended-cross-platform-deployment-methods/151459/4 "2008-10-22T09:51:05Z")

</div>

I may look at this solution a bit more closely, and see about creating a  
solution that will create these packages for general Ruby apps, not just  
wxRuby, but any Ruby app, and create one for Linux as well.

---

<div class="post-metadata">

**Author:** ![marke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/6bbea6/32.png) [@marke](https://www.ruby-forum.com/u/marke)\
**Post date:** [October 22, 2008, 11:47am UTC](https://www.ruby-forum.com/t/recommended-cross-platform-deployment-methods/151459/5 "2008-10-22T11:47:24Z")

</div>

> Thanks for the link, I’ll definitely be looking at this as a possible  
> solution to many problems with Ruby App Distribution.

Thank you (all the team) for your time and effort.

bio.

---

<div class="post-metadata">

**Author:** ![marke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/6bbea6/32.png) [@marke](https://www.ruby-forum.com/u/marke)\
**Post date:** [October 22, 2008, 5:01pm UTC](https://www.ruby-forum.com/t/recommended-cross-platform-deployment-methods/151459/6 "2008-10-22T17:01:43Z")

</div>

Mario S. wrote:

> Well, you already know about rubyscript2exe, which works on all 3  
> platforms. That’s about the only thing I can suggest for it.
> 
> On Linux: You create a shortcut, which is basically an INI Type file,  
> with  
> the extension .desktop, EG: MyProg.desktop, and in it, is the following  
> info:

Mario, thanks for the intro to shortcuts in Linux. 🙂 I should have  
known it would be more straight forward and cleaner.

-MarkE

---

<div class="post-metadata">

**Author:** ![marke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/6bbea6/32.png) [@marke](https://www.ruby-forum.com/u/marke)\
**Post date:** [October 22, 2008, 5:03pm UTC](https://www.ruby-forum.com/t/recommended-cross-platform-deployment-methods/151459/7 "2008-10-22T17:03:24Z")

</div>

Fabio P. wrote:

> There’s another interesting way to explore to be able to generate  
> executable  
> into different platform:
> 
> Look at the way shoes do it:
> 
> [Balaksix : Link Slot777 Situs Slot Gacor Auto JP Sultan](http://hackety.org/2008/06/19/stampingExesAndDmgs.html)
> 
> It would be great having that for wxruby applications as well.

Fabio,

Thanks so much for sharing that link! That is the perfect direction! I  
see that it’s just getting started really, but it has a lot of promise.

-MarkE

---

<div class="post-metadata">

**Author:** ![marke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/6bbea6/32.png) [@marke](https://www.ruby-forum.com/u/marke)\
**Post date:** [October 22, 2008, 9:54am UTC](https://www.ruby-forum.com/t/recommended-cross-platform-deployment-methods/151459/8 "2008-10-22T09:54:03Z")

</div>

PS.

Thanks for the link, I’ll definitely be looking at this as a possible  
solution to many problems with Ruby App Distribution.

---

<div class="post-metadata">

**Author:** ![marke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/6bbea6/32.png) [@marke](https://www.ruby-forum.com/u/marke)\
**Post date:** [October 22, 2008, 5:08pm UTC](https://www.ruby-forum.com/t/recommended-cross-platform-deployment-methods/151459/9 "2008-10-22T17:08:22Z")

</div>

Mario S. wrote:

> PS.
> 
> Thanks for the link, I’ll definitely be looking at this as a possible  
> solution to many problems with Ruby App Distribution.

Mario,

I’m also interested in a more generic solution. I’m interested in  
rubygame, wxruby and other ruby projects. I’d love to tinker with it  
too.

I imagine a nice wxruby GUI for driving the build process too. 😉

But really, it would be great to be able to customize the following:

- where the files get installed to (Shoes installer put it in \Program  
Files\Common Files\Shoes\<version\>
- what files get installed (different gems, libraries like sdl, etc)
- The graphic to show
- The script files to deploy (optional just a directory, etc)

Seriously, let me know if I can help. I’m excited about this.

-MarkE

---

<div class="post-metadata">

**Author:** ![marke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/6bbea6/32.png) [@marke](https://www.ruby-forum.com/u/marke)\
**Post date:** [October 22, 2008, 10:53pm UTC](https://www.ruby-forum.com/t/recommended-cross-platform-deployment-methods/151459/10 "2008-10-22T22:53:53Z")

</div>

Mark E. wrote:  
[…]

> But really, it would be great to be able to customize the following:
> 
> - where the files get installed to (Shoes installer put it in \Program  
> Files\Common Files\Shoes\<version\>
> - what files get installed (different gems, libraries like sdl, etc)
> - The graphic to show
> - The script files to deploy (optional just a directory, etc)

After looking into the shoes installer a bit more…  
[http://github.com/why/shoes/tree/master/platform/msw](http://github.com/why/shoes/tree/master/platform/msw)  
[http://github.com/why/shoes/tree/master/platform/msw/stub.c](http://github.com/why/shoes/tree/master/platform/msw/stub.c)

It seems that the platform specific installer is being downloaded (from  
a hard coded location) and being run in “silent mode” where any install  
locations are defaulted and assumed.

The windows platform specific installer is written in C. Unfortunately,  
I’m not a C coder. Not to say I couldn’t tinker, but I don’t have true C  
skills for creating new code.

Anyway, that’s my quick report.

-MarkE

---

<div class="post-metadata">

**Author:** ![marke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/6bbea6/32.png) [@marke](https://www.ruby-forum.com/u/marke)\
**Post date:** [October 23, 2008, 10:35pm UTC](https://www.ruby-forum.com/t/recommended-cross-platform-deployment-methods/151459/11 "2008-10-23T22:35:46Z")

</div>

Alex F. wrote:  
[…]

> For the time being, all this is in hard-coded rakefiles specific to one  
> application. But I think it would not be too hard to make it more  
> general, so that the rakefiles could be generated. But it’s not  
> something I really want to get into building myself. But it’s worth  
> bearing in mind that all the bits and pieces are out there already to  
> produce 100% professional standard installers.
> 
> alex

Alex,

Thanks for your input. I had actually downloaded and played with Weft as  
an example of a DB driven wxRuby app. I was impressed by the installer,  
application shortcuts and the overall small size (about 2MB).

So, thank you for elaborating on your process.

I agree that a more generalized approach could be developed. Thanks for  
pointing out many of the pieces already out there to be had!

-MarkE

---

<div class="post-metadata">

**Author:** ![marke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/6bbea6/32.png) [@marke](https://www.ruby-forum.com/u/marke)\
**Post date:** [October 23, 2008, 5:45pm UTC](https://www.ruby-forum.com/t/recommended-cross-platform-deployment-methods/151459/12 "2008-10-23T17:45:04Z")

</div>

Mark E. wrote:

> - The graphic to show
> - The script files to deploy (optional just a directory, etc)

Just to come in late on this discussion. I think perhaps I’ve mentioned  
this stuff before on the list a while back, but I’ve spent a fair bit of  
time working up executables and installers for Windows and Mac (I’ve  
done less with Linux).

rubyscript2exe is OK, but it’s far from perfect for wxRuby apps. Some of  
this is down to the large size of the wxruby binary. I’ve had trouble  
getting it to generate working exes on Mac. It had recently a bug (and  
maybe still has) a bug that included some libraries, including  
wxruby2.so twice over - which is a big hit in terms of the exe size.  
Having to unzip at each execution is also a bit messy and noticeably  
slows startup time. And it’s not intended as a solution as an installer.

Interested to read about the Shoes stuff, but I don’t really like net  
installers. I’m fine with package managers, where a huge amount of work  
has gone into dealing with connection failure, but I’m a bit uneasy  
about a roll-your-own solution. If it’s not impolite, I think \_why’s  
work is perhaps the most creative in the ruby world, but not the best  
maintained over time (I’m thinking of redcloth here).

I got round this by using platform specific solutions. The basic process  
is:

1. Do a trace run of the app to discover all of its library dependencies
2. Assemble all of these libraries, plus the ruby interpreter and the  
ruby lib in a single place
3. Create a runnable app (this is only necessary on Mac)
4. Create an installer (a DMG on Mac, a setup.exe on Windows)

A bit more detail

1. is covered by this script here:  
[http://weft-qda.rubyforge.org/svn/trunk/weft-qda/rake/assemble\_libraries.rb](http://weft-qda.rubyforge.org/svn/trunk/weft-qda/rake/assemble_libraries.rb)

2. This rake file runs the script; use rbconfig.rb (part of the stdlib)  
to find the ruby executable and the dlls / bundles it depends on:  
[http://weft-qda.rubyforge.org/svn/trunk/weft-qda/rake/rake\_assemble.rb](http://weft-qda.rubyforge.org/svn/trunk/weft-qda/rake/rake_assemble.rb)

These rake files define additional dlls that need to be included (eg for  
sqlite3) and find the ruby stuff  
[http://weft-qda.rubyforge.org/svn/trunk/weft-qda/rake/rake\_mswin.rb](http://weft-qda.rubyforge.org/svn/trunk/weft-qda/rake/rake_mswin.rb)  
[http://weft-qda.rubyforge.org/svn/trunk/weft-qda/rake/rake\_osx.rb](http://weft-qda.rubyforge.org/svn/trunk/weft-qda/rake/rake_osx.rb)

1. Use Platypus ([Platypus - Create Mac apps from command line scripts |](http://www.sveinbjorn.org/platypus)) to turn a script  
file (eg an .rb or a .sh) into a runnable, nicely named and iconed .app  
bundle on OS X. Again this can be automated with rake

2. Use NSIS to create a cute installer on Windows, this requires  
creating a .nsi file to define the steps in the installer. This is a bit  
fiddly but it means you can include whatever additional files you want  
(eg documentation, app icons) and create whatever shortcuts you want (eg  
uninstallers). An example is here:  
[http://weft-qda.rubyforge.org/svn/trunk/weft-qda/qda.nsi](http://weft-qda.rubyforge.org/svn/trunk/weft-qda/qda.nsi)

For OS X, Apple’s own hdiutil command-line tool will create a .dmg that  
can be downloaded, expanded, so the user simply copies the .app file  
into their Applications folder. This is the standard way. Again, I  
automate this in the rakefile.

For the time being, all this is in hard-coded rakefiles specific to one  
application. But I think it would not be too hard to make it more  
general, so that the rakefiles could be generated. But it’s not  
something I really want to get into building myself. But it’s worth  
bearing in mind that all the bits and pieces are out there already to  
produce 100% professional standard installers.

alex
