Jul 8, 2009

D-Bus and Ruby

There isn't a canonical D-Bus library for Ruby. I found four projects, two of which are interesting.

First, the two losers:
* dbus-ruby: It wraps the C bindings. It is dead (last release in January 2005).
* pr-dbus: No releases, last SVN commit in April 2007, entirely in Ruby.

Now for the contenders. Both are packaged as RPMs in the OBS YaST:Web project.
The developers know about each other but in 2007 they did not want to merge the projects. The developers are not active but patches do appear.

* ruby-dbus
  • LGPL
  • no test suite (but I've started one together with bug fixes: Github clone)
  • can export services
  • cumbersome API (explicit introspection calls needed, explicit types for variants needed, return value must be an array)
BTW Klaus has two posts about writing a client and a server with ruby-dbus.

* rbus
  • GPL
  • test suite (RSpec, needs a patch)
  • cannot export services
WebYaST is using ruby-dbus so far, but I am looking at rbus too because of the tests and and the nicer API.

3 comments:

kkaempf said...

I do not think the API of ruby-dbus is particularly cumbersome and it definitely does not need explicit introspection calls.

You use 'introspect' to get to the hash of interfaces. The hash values are the proxy objects.

In rbus its 'get_object' and 'interface!', not very Ruby-like ;-)

Arnaud Cornet said...

I think I did explicit introspection because dbus objects are not necessarily introspectable. Maybe that's not relevent anymore. I mostly aggree that API is not ideal, I remember that I felt better with the internal message parsing/encoding code that the external API. Indeed quite annoying for a library.

Another (very) bad thing about ruby-dbus is that it is not thread aware. I guess if I were motivated I would take the parsing/encoding code and try to think of a better thread safe API.

That's very nice to see some activity arround ruby/dbus after all this time. I felt quite lonely when I wrote the stupid thing ;)

Anonymous said...

Rbus is awesome, congratulations to Kristoffer Lundén because the work I was not accomplishing with the other implementations I did with it.