Recommended cross platform deployment methods?


#1

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. :slight_smile:

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


#2

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. :wink:

hth,

Mario


#3

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

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

regards.

bio.


#4

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.


#5

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.


#6

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. :slight_smile: I should have
known it would be more straight forward and cleaner.

-MarkE


#7

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:

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


#8

PS.

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


#9

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. :wink:

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


#10

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/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


#11

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


#12

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

  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

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_osx.rb

  1. Use Platypus (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

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