Packaging ruby gtk app - ruby

What is the least headache technique to package a gtk2/gtk3 app built with ruby for distribution as an executable, for windows, linux, macos?
I could not find any guides or helpers to resolve this for ruby gtk. Nor the ruby-gnome gem comes with a packager.
It is my understanding that gtk is cross-platform, so it should not be trivial to do this. Problem is I am unable to find anythin reliable to follow as an example and learn the steps.

I've come across the same problem as you and I've put the question directly to the GTK3 developers.
here is their answer.
Which means that if you choose to use GTK3 today with Ruby, you have to:
Deliver MSYS2 and Ruby with your GEM.
Deliver your gem and tell users to install themselves msys2 (with updates) and ruby and your gem with dependencies.

It seems that the core developers of ruby-gnome2 are unconcerned about app distribution outside the Ruby community.
For example, Mr. Sutou, one of the maintainers of ruby-gnome2, distributes his Ruby/Gtk presentation tool "Rabbit" only as a Ruby Gem.

Related

Can I use Ruby with Shoes for GUI for a multiple choice test app?

I'm trying to make a simple multiple choice question app. Is this possible on ruby?
I've tried using shoes but I don't know how to create multiple classes and a GUI that uses them.
I'm also trying to connect all of this to a database.
I'm having trouble in understanding how to connect all of this together.
According to the comments the main problem seems to be with using the mysql gem part.
Gem usage depends on the version of shoes you are using. For green_shoes you should be good with the standard gems, but it is unmaintained. Shoes 3.1 has problems with gems that have C extensions (such as mysql). Shoes 3.2 should work. With Shoes4 you can't install the normal Ruby gems with C extensions as it uses JRuby and C extension support in JRuby is disabled. You have to use different gems to connect to the database, functionality is the same. A starting point might be activerecord-jdbc.

How can I create debian package (*.deb) from ruby application written with qt4?

I found a lot of tutorials how to build application with Ruby and Qt, but i have no idea how anybody else will be able to run it! I am using Ubuntu 11.10, ruby 1.9.2 with rvm and:
rbqtapi -v output "QtRuby 2.0.5 using Qt-4.7.4"
P.S. I have no idea how to build *.deb, it will be my first desktop app, not web.
please have a look on http://shoesrb.com/ this is the best way I heard off for writing GUI apps.
Shoes has now not it's greatest time, but we put our best time to make it better, give it a try and someone will help you.
In case you are in need of assistance just ask as question on #shoes IRC channel on freenode servers.
If you're sold on QT, then you will need your users to install all the support libraries for QT (and anything else), then you can upload a rubygem to rubygems.org for your users to download.
Once, they've installed the support libraries, you'd only need to update your rubygem, which is fairly quick and easy for updates.
You may also wan to look at visualruby. It uses GTK. Then you'd install the GTK libraries instead of the QT ones.
http://www.visualruby.net
As far as .deb packages go, I tried to research the same thing with little success. The rubygems packaging system is designed to distribute ruby programs, so it is the best way to go. Also, you'll need to install different support libraries for different platforms. If you look at visualruby's install page, you can see how to install GTK for Linux and Windows.
Good Luck.

How to distribute frozen binary gems with Ruby application (not Rails)

I wrote a bunch of Ruby scripts that integrate different tools to create a "workflow for academics". A number of my friends have been very interested in trying this out, however they are held back by how hard it is to install or replicate my environment.
Although Ruby comes built-in with Mac OSX (the applications I integrate are all Mac applications, so unfortunately the solution can only work on Mac), I use a few binary gems, including Appscript (bridge to AppleScript). The problem is that this requires XCode, which my non-programmer friends do not have installed (and it seems a bit demanding to ask them to install 3GB of software to run a few kbs of code).
I tried freezing the gems by installing them with gem -i, into a subdirectory of the source (on github), and tried removing my entire central gems directory on my local computer - it worked fine, the scripts still ran, etc. However, when my friends tried running the scripts, they got error messages about missing library files etc.
So my two questions are:
* how specific are compiled binary gems? will they work on other Mac OSX versions? with other versions of Ruby? etc
* how can I find out exactly which binary files (located in central locations) a Ruby gem depends on, and package this with the source (and how do I tell the gem where to find these files in non-standard locations)
I know this might not be "standard procedure", and I should just package it as a gem and let my friends deal with the problems etc - but I'd really like to solve this, and I am sure there must be some way of doing this?
Thanks a lot
In my experience, compiled gems are not portable. They're dependent on the exact version of ruby and whatever other libraries they use. A better solution would be to have your friends install the "Command Line Tools" version of Xcode -- it's only 100-150 MB and includes everything you need to build gems (and other software). You'll need a (free) Apple Developer ID to download it though.
https://developer.apple.com/downloads?q=Command%20Line%20Tools

Ruby bindings for GTK+ 3?

I’ve spent some time learning Ruby, and I wanted to move over to some GUI programming. GNOME 3 is the environment most appealing to me at the moment, so I thought I would have a look at GTK+ 3. However, the GTK+ 3 documentation’s Getting Started examples in C were quite off-putting. Are there less scary Ruby bindings (and Hello World examples) available?
Edit: The GTK+ Language Bindings overview does not leave much room for hope.
After a quick chat on #ruby on freenode I learned that there are bindings for GTK+ 3 that are actively developmented:
https://github.com/mvz/ruby-gir-ffi
The project is still young. I'm looking forward to diving in and seeing what I can do too. Here's an introduction by the author: http://www.matijs.net/blog/2011/05/10/girffi-an-introduction
Right now there are gtk3 bindings. In fact there is a rubygem for gtk3. Just do:
$gem install gtk3
Ruby-GNOME2
Supports GTK+ 3 from version 1.2, released in January 2013.
Currently the Ruby Gnome project is only on GTK 2 but work has begun on GTK3 bindings. Take a look at this post on the Ruby Gnome2 forum: http://www.ruby-forum.com/topic/2715042#new (5th one down).
The project website has plenty of tutorials: http://ruby-gnome2.sourceforge.jp/
Installing it is pretty simple on Ubuntu:
sudo apt-get install libgtk2.0-dev
gem install gtk2
I'd start with this and move to GTK3 when there are stable bindings.
Ruby GIR bindings is interesting and I'll be keeping an eye on this but I don't think it'll be as simple to use as Ruby Gnome 2.
I don't know the situation around GNOME 3, sorry. But I do know the situation around KDE and QtRuby. Next stable release of KDE (in July) will contain updated version of QtRuby (it's in active development for now). You could try to start from now, but as for me, well, I'm waiting for the new version because of lack of some features, that I personally need.
There are some helpful IRC channels at Freenode, where you can ask for help: #qtruby, #kde-ruby, #kde-bindings.
Right now the main ruby-gnome project has no GTK 3 bindings.
The problem is lack of manpower.

How to distribute ruby software?

Hi i am serching for the best way to distribute ruby software (can be open or commercial) to clients:
- with less software installed on client (only ruby interpreter)
- without less user interaction for updates
Any idea? I can use gem but it needs to install rubygems and not fit with commercial software.
I recommend setting up a ruby project using Jeweler (http://github.com/technicalpickles/jeweler) and distributing on Gemcutter (http://gemcutter.org/) which is pretty much the standard for gem distribution.
You may also want to look at BitNami's RubyStack multi-platform installer if you're looking for an easy way to get Ruby, RubyGems and some common gems installed. They also make installable stacks for some common apps (e.g. Typo), but unfortunately they don't offer a way to build a custom installer for your Ruby application.
Are you looking for a way to distribute to the desktop or to a headless server?
For the desktop you could try RubyScript2Exe and also check out the article Distributing Ruby Applications
You might also want to consider using JRuby and packaging the software as a Java application.

Resources