Hello,

I have built a QtRuby application, and I've been trying to "release" it for a few days. My requirements target Windows + Mac OS X primarily, and Linux too preferably. My users can not be required to download or install any extra dependencies for the application, so it _MUST_ be self-contained, ie, a binary, a bundle, a package, you name it.

I have searched and read everything I could come across that relates to this process, and here's what I've tried:

  1. Crate @ http://github.com/copiousfreetime/crate
    I tried to adapt the 1 example I found throughout the whole internet to my needs, but I failed. The author's example is very basic, it covers bundling a simple SSL/authentication script, and by simple I mean it requires few to none dependencies (ruby gems, or static libraries as Qt is in my case).

  2. Ocra @ http://ocra.rubyforge.org/
    Ocra targets Windows only, it does not meet my requirements, thus I skipped it.

  3. tar2rubyscript & rubyscript2exe by Erik Veen @ http://www.erikveen.dds.nl/tar2rubyscript/
    Ok this one looked like a candidate, and I spent most of my time trying to make it work, it almost did, but not really; I will include a more descriptive explanation of the problems I came across using rubyscript2exe below. 
In the first "step" of the RBA process, and that is tar2rubyscript, I succeed. My application is bundled into an albeit huge 37mbytes .rb file, and I can `ruby my_application.rb` and it runs OK. The problems lie in the 2nd stage, and that is converting that tar into an executable; here is my console output:

kandie:~/Workspace/Experiments/Ruby/deployment$ rubyscript2exe.rb Kaboomp3.rb 
Tracing Kaboomp3 ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+                              kaBooMP3                             +
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ initializing Organizer
+ Organizer: ready to blow up!
+ initializing Qt
+ loading resource key: master from file: resources.rcc
+ mounting models
+ loading controllers
Gathering files...
/tmp/tar2rubyscript.d.46763.1/rubyscript2exe/require2lib.rb:60:in `gatherlibs': undefined method `list' for Gem::Specification:Class (NoMethodError)
        from /tmp/tar2rubyscript.d.46763.1/rubyscript2exe/require2lib.rb:30
/tmp/tar2rubyscript.d.46763.1/rubyscript2exe/require2lib.rb:151:in `require2lib_load': can't convert Qt::File into String (TypeError)
        from /tmp/tar2rubyscript.d.46763.1/rubyscript2exe/require2lib.rb:151:in `load_without_new_constant_marking'
        from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:145:in `load'
        from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
        from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:145:in `load'
        from /tmp/tar2rubyscript.d.46764.1/Kaboomp3/lib/kaboomp3/utility.rb:57:in `load_view'
        from /tmp/tar2rubyscript.d.46764.1/Kaboomp3/kaboomp3.rb:102:in `setup'
        from /tmp/tar2rubyscript.d.46764.1/Kaboomp3/kaboomp3.rb:127:in `initialize'
        from /tmp/tar2rubyscript.d.46764.1/Kaboomp3/kaboomp3.rb:34:in `new'
        from /tmp/tar2rubyscript.d.46764.1/Kaboomp3/kaboomp3.rb:34:in `instance'
        from /tmp/tar2rubyscript.d.46764.1/Kaboomp3/kaboomp3.rb:139
        from /private/tmp/tar2rubyscript.d.46764.1/Kaboomp3/init.rb:2:in `require'
        from /private/tmp/tar2rubyscript.d.46764.1/Kaboomp3/init.rb:2
        from /tmp/tar2rubyscript.d.46763.1/rubyscript2exe/require2lib.rb:151:in `require2lib_load'
        from /tmp/tar2rubyscript.d.46763.1/rubyscript2exe/require2lib.rb:151:in `load'
        from Kaboomp3.rb:610
        from Kaboomp3.rb:559:in `newlocation'
        from Kaboomp3.rb:487:in `newlocation'
        from Kaboomp3.rb:454:in `newlocation'
        from Kaboomp3.rb:487:in `newlocation'
        from Kaboomp3.rb:559:in `newlocation'
        from Kaboomp3.rb:603
Couldn't execute this command (rc=256):
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -r 'enumerator.so' -I '/tmp/tar2rubyscript.d.46763.1/rubyscript2exe' -I '/tmp/tar2rubyscript.d.46763.1' -I '/Library/Ruby/Site/1.8' -I '/Library/Ruby/Site/1.8/powerpc-darwin10.0' -I '/Library/Ruby/Site/1.8/universal-darwin10.0' -I '/Library/Ruby/Site' -I '/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/vendor_ruby/1.8' -I '/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/vendor_ruby/1.8/universal-darwin10.0' -I '/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/vendor_ruby' -I '/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8' -I '/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/powerpc-darwin10.0' -I '/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0' -I '.' -I '/Volumes/kandie/Workspace/Experiments/Ruby/deploy' -I '/private/tmp/tar2rubyscript.d.46763.1/rubyscript2exe' -I '/private/tmp/tar2rubyscript.d.46763.1/rubyscript2exe/lib' -I '/private/tmp/tar2rubyscript.d.46763.1/rubyscript2exe' -I '/private/tmp/tar2rubyscript.d.46763.1/rubyscript2exe/lib' -r '/tmp/tar2rubyscript.d.46763.1/rubyscript2exe/require2lib.rb' 'Kaboomp3.rb'   
Stopped.

I need to emphasize this line `can't convert Qt::File into String (TypeError)` which is generated in my helper method `load_view` which code is:

    def load_view(path, parent, loader)
      sheet = Qt::File.new(path)
      sheet.open(Qt::File::ReadOnly)
      view = loader.load(sheet, parent)
      sheet.close
      
      view
    end

loader is a Qt::UiLoader instance.

Ok, so things break on that line, `view = loader.load(sheet, parent)` and I just can't tell why rubyscript2exe is trying to convert `sheet` which is a Qt::File into a string. I can't see the correspondence. The things that I've tried doing:

  • I thought there might be some name clash / conflict in my code.. so i renamed my load_view() method to something more specific, no use
  • I wondered if at some point rubyscript2exe was trying to do myQtFile.to_s to do whatever processing it might be doing, so I added a to_s method to Qt::File class, which returns the attribute fileName (the actual file path) that didn't work either
  • I removed that line altogether; I stopped loading views, et voila, it worked, but hey I've got no UI views now >.>
To add to my curiosity, what's up with that line that has to do with active_record up there? AR is a dependency in my project, indeed, I'm using it with Sqlite3, but it's not even remotely connected to the part where i load my views...

I'm so confused and in dire need of help, as this is a school project which deadline is due next week, and should I fail to meet it, I will fail the course.

How can I package my application?

I thank you for reading through this and for your time.
--
There are 10 types of people, those who understand binary, and those who don't.