A Launchpad Module for Ruby

At some point last year I started to write a Launchpad API client in Ruby, for the very simple reason that Kubuntu CI tooling is almost entirely written in Ruby and I wanted to avoid round tripping into Python to use launchpadlib for trivial things such as querying the version of a package in a PPA. Not only would that be slightly slower it also raises the ever so unfortunate problem of how to exchange data between Ruby and Python.

Perhaps someone else also can find it useful.

http://anonscm.debian.org/cgit/pkg-kde/ci-tooling.git/tree/lib/lp.rb

It is intentionally minimalistic in it’s design and validation. All JSON return data is parsed into an glorified OpenStruct with special method_missing handling which depending on how you call a non-existent method would either attempt an HTTP GET or HTTP POST on the Launchpad API. Since the underlying data is never actually wrapped into literal classes on the Ruby side it has surprisingly few lines of code.

Unfortunately this also means that there is absolutely no hand holding for anything. For the most part method calls result in exactly the same methods being called on the API endpoint. So, correctly reading and using the API documentation is pretty much a necessity. Otherwise something is most likely going to raise a supremely cryptic exception ;)

Calling a method on an object results in an HTTP GET on the self_link of that object. If the method is suffixed with a ! it will do a HTTP POST instead.

So, if I want to list all my Bazaar branches on Launchpad I’d first create a wrapper object for my user endpoint and then call:

me.getBranches

Which as you would expect returns an Array of ‘branch‘ type objects to use. Alternatively, if I wanted to change my account status I’d again use my user endpoint object and would need to do a POST operation on it (according the API):

me.setAccountStatus!(comment: 'Best be off then', status: 'Deactivated')

Notable difference being the exclamation point indicating that we want to POST the method call.

And that is pretty much all there is to know about the entire module.

Finally a short example:

require_relative 'lp'

url = 'https://api.launchpad.net/devel/~kubuntu-ci/+archive/ubuntu/unstable'

ppa = Launchpad::Rubber.from_url(url)
sources = ppa.getPublishedSources(status: 'Published', source_name: 'solid')
sources.each { |s| puts s.display_name }
  1. creates a Rubber object from a PPA url
  2. gets all published solid sources from that PPA
  3. ouputs the display_name of all returned source

Plasma 5 Weekly ISO Revisited

I am proud to announce that Plasma 5 weekly ISOs have returned today.

http://files.kde.org/snapshots/unstable-i386-latest.iso.mirrorlist

Grab today’s ISO while it is hot. And don’t forget to report the bugs you might notice.

Plasma 5 weekly ISOs bring you the latest and greatest Plasma right from the tip of development.

As some of you might have noticed the previous Plasma 5 weekly ISOs stopped updating a while ago. This was because we at Blue Systems were migrating to new system for distribution level integration. More on this to follow soon. Until then you’ll have to believe me that it is 300% more awesome :)