Distributing apps on Windows

I know this was talked about briefly a while ago, but
I wasn’t paying attention :wink: I need to distribute my
application to a wide audience of non-technical
Windows users. What is the best way to go?

I’ve made gems (it’s all pure ruby) so for Linux
people it’s pretty easy just to install ruby, ruby-gnome
and then install the gems. But for Windows
users, I’d like to avoid the 23 meg “Single Click
Ruby” download. Also, I’m not sure how to install
the latest ruby-gnome bindings on Windows even
myself.

I took a look at tar2rubyscript and rubyscript2exe,
and they look useful, but I’m still left with no easy
way to get ruby-gnome installed.

I seem to remember that Mathieu mentioned a
potential solution (Hi!, BTW – Yes, I’m finally releasing
a new version of JLDrill :slight_smile: )

I don’t necessarily mind asking the users to install
ruby and ruby-gnome so if I can find an easy way to
do that (and a slightly less kitchen-sink install for
ruby) and an easy way to install my gems, then
that would be fine too.

     Thanks in advance for any help!
               MikeC

P.S. And after all that, I also want an easy way to
do the same for OSX. But Windows is higher priority
right now.

Hi Mike! Nice to see an email from you. :slight_smile:

My approach for my program was a little bit of a brute-force approach:
package everything necessary into one big zip file. This includes
Ruby, GTK, and RG2. The user can unpack the zip file anywhere on his
computer.

  1. I uninstalled Ruby and GTK to make sure that my package would work
    even if the user doesn’t have them installed.

  2. I made an executable whose role is to run the command “rubyw
    /path/to/myapp.rb”. You can see it as a “process launcher”. I made an
    executable because this is the only way I found to hide the command
    prompt that is displayed if you use a .bat file.

  3. myapp.rb updates the ruby load path and the windows path to include
    the path of ruby dependencies and GTK dlls. I concatenated #{Dir.pwd}
    with relative paths so that this works anywhere.

  4. For the dlls that GTK loads at runtime, I replaced absolute paths
    with relative paths in the GTK configuration files generated by the
    gladewin32 installer.

Pros and cons of my approach:

  • The final package can be pretty big! However you can gain a lot of
    space by removing unnecessary libs from the Ruby stdlib and removimg
    po files from GTK2. (I didn’t try to reduce the size in my case)

  • The load is much faster than a program generated by rubyscript2exe.
    This is because rubyscript2exe unpacks the content embedded in to the
    .exe file at every start while with my approach all the content is
    already on the hard disk.

  • When I need to do a new release of my software, unless I want to
    upgrade Ruby or GTK, I take the previous release, replace my
    application folder and that’s it!

  • Since installing the software is simply a matter of unzipping the
    package, this may be confusing for people who would expect an
    installer (this pretty much the standard way of installing software in
    Windows). Plus, menu and desktop shortcuts are not created. Therefore
    it may be interesting to combine this approach with a NSIS installer.

You can take a look at my package as an example
http://www.mblondel.org/files/fantasdic/fantasdic-1.0-beta6-mswin32.zip

In particular have a look at fantasdic/win32/

Mathieu

2008/9/13 Mike C. [email protected]:

  1. I made an executable whose role is to run the command “rubyw
    /path/to/myapp.rb”. You can see it as a “process launcher”. I made an
    executable because this is the only way I found to hide the command
    prompt that is displayed if you use a .bat file.

Hi:

this is the same i do, but the exe what kind of API use to launch the
rubyw??

Perhaps the g_spawn??

regards.

2008/9/15 Martin (OpenGeoMap) [email protected]:

Hi:

this is the same i do, but the exe what kind of API use to launch the
rubyw??

Perhaps the g_spawn??

I use “CreateProcess” from the windows API.

http://svn.gnome.org/viewvc/fantasdic/trunk/win32/fantasdic.c?revision=218&view=markup

Mathieu

hi:

I use “CreateProcess” from the windows API.

http://svn.gnome.org/viewvc/fantasdic/trunk/win32/fantasdic.c?revision=218&view=markup

Mathieu

Thanks. I used the system function and mingw compiler with the windows
option, but the console was there hehe.

In the respect to find the dependencies i use the rubyscript2exe and
after extract this files:

When the exe start the file is unzip here:
C:\Documents and Settings\mrodriguez\eee

In that folder you can extract all files like this:

/application/.exe --eee-justextract

the problem is the extensions’ dependencies in DLLs. You need copy the
etc, lib/pango and shared by hand to this folder .

Here the explain to use the exe, but i see that really slowly for real
projects:
http://ruby-gnome2.sourceforge.jp/hiki.cgi?tips_rubyscript2exe

and finally i launch the app like this:

bin\rubyw.exe -r .\bootstrap.rb -T1 empty.rb .\app/application/.rb

I used in a project using pdf-writer, gtk and sqlite. rubyscript2exe
work perfect in all less in the GTK extensions’ dependencies

Regards.

Unless I missed something, this seems like a great solution or?

When I am on windows I mostly just care that things work. I dont mind if
they are bundled in a huge .exe or .zip or something at all. :slight_smile: