Development/Tutorials/Deploying Qt Ruby Applications as a Debian packages for Kubuntu

From KDE TechBase
Revision as of 21:13, 29 June 2011 by Neverendingo (talk | contribs) (Text replace - "<code bash=" to "<syntaxhighlight lang=")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Deploying Qt Ruby Applications as a Debian packages for Kubuntu

NNB: This is a draft document!!! The tutorial is not fit for use yet!

Introduction

To share your wonderful application with others you need to have package it up in a standard format. Packaging up Ruby applications for Linux distributions is something that is historically a bit of a controversial subject. One reason for this is that the Debian-based package management software in Kubuntu, apt, fills a similar role as rubygems, the package management software for Ruby across all Operating Systems. In Linux distros, the File Hierarchy Standards (FHS) mandates a layout for applications to adhere to so that an application's libraries, configs and documentation go in the right place. This is sometimes difficult for Ruby applications. However, fear not! Here's your guide to getting from developers Ruby app to a Debian package. We are going to build from scratch.


But first a special thanks...

... to Horst Jens for this wonderful video on packaging a simple Python application, which we've used as the basis for our Qt Ruby packaging efforts here Ubuntu: Making a .deb package out of a python program. It's highly recommended that you check out this video to help you understand what's going on. You can watch it before or after using this article. Or refer to it from time to time.

Our starting point

We will start with the application that we have left over as part of another article in the KDE Techbase Ruby series at Developing Qt4 Applications using Qt Designer and Ruby on Kubuntu. If you don't want to go to the hassle of running through that guide you can download the source code here as a tarred zip file ***PROVIDE LINK***.


Install the Appropriate Packages

Fortunately there's tools to help you out on your mission. The dh-make suite on Kubuntu contains utilities to help you build your Debian package. Install as follows

sudo aptitude install dh-make

Get Your Application Structure into Shape

Ok, so as we said earlier the FHS mandates a particular structure for our application. We need to put our app on a diet and fit it into this structure! I'm not a 100% sure on this bit it works but will can flesh it out as this article matures. I have a simple app called benchmarksman and this is the structure I've used to try to be FHS compliant

      • TODO*** CHANGE THIS CODE SAMPLE TO USE THE APP FROM THE PREVIOUS ARTICLE
bin/
   benchmarksman             # My top level file that kicks off the app.
lib/
   benchmarksman/
       breaker.rb            # Holds a class Breaker that does domain logic.
       application/
          main.rb            # Once the app is kicked off this is called
       ui/                   # Directory holding Qt4 Designer files.
          dashboard.ui       # The Qt4 Designer file (can prob nuke this!).
          dashboard_ui.rb    # The proxy rb file generated by rbuic4.
       view/                 # Directory holding presentation logic classes.
          dashboard.rb       # Subclasses dashboard_ui.rb - my presentation.


Useful Resources

Obsolete Notes

  • Fortunately there's tools to help you out on your mission. The ruby-pkg-tools suite on Kubuntu contains utilities to help you build your Debian packagd. More info on it is available at this link.
  • Download setup.rb - A script that does the hard work so you don't have to (do too much!) =