January 6th 2009

Phusion releases DebGem.com into beta

Right after starting this blog, I already have the first topic to post about that implies both things I'm focusing on - Ruby and Ubuntu: As Peter Cooper announced on Ruby Inside, Phusion (of Passenger fame) have released a new service called DebGem. What this thing basically does is let you install all RubyForge and Github gems on Debian / Ubuntu machines via apt-get, which many people (me included) prefer over the duplicate handling which the original gem command requires, while still having access to latest as well as older versions (as opposed to the official repositories, which only hold outdated libs), plus it will install required lib dependencies for native builds, say imagemagick for rmagick. They also have a search set up so you can easily find the exact package name you have to type in when installing.

As Peter states though, there are two "catches":

  1. Native gems requiring a build are currently only available for Ubuntu 8.04 LTS (you might also want to check out the info on supported distros over at their starting page)
  2. The service is only free during beta. Phusions clear explanation to that can be found in the FAQ

Thankfully, I'm still on Ubuntu 8.04 on my laptop, so I was able to try it out. After getting through the config steps (basically just another repository in /etc/apt/sources.list with the catch that you have to raise apt's cache limit due to the huge amount of packages in the repo - Rubyforge without github already gives about 25000 packages) and doing an apt-get update, I was able to get nice datamapper auto-complete results:

colszowka@colszowka-laptop:$ sudo apt-get install libdatamapper
libdatamapper0.1.1-ruby1.8  libdatamapper0.3.2-ruby1.8  libdatamapper-all-ruby1.8   libdatamapper-ruby1.8       
libdatamapper0.2.5-ruby1.8  libdatamapper0.9.8-ruby1.8  libdatamapper-ruby   

The naming and version availablity scheme is explained in the FAQ as well. I won't copy and paste all of it, but basically when you install libdatamapper-ruby1.8, it will install all versions listed above.

This is because RubyGems supports parallel version installs. For example, RubyGems allows having both Rails 2.1.2 and 2.2.2 installed at the same time. Applications and libraries can depend on a specific version of a gem. Dpkg does not have a direct equivalent of this feature. So as a compromise, and in order to ensure that everything works out-of-the-box, we install latest versions of the minor version.

Unfortunately, even when I specified a certain version, say libdatamapper0.9.8-ruby1.8, to be installed, the gem dependencies would not get resolved properly, with DebGem requiring me to install a plethora of versions of the gems datamapper depends upon:

  dm-cli-all-ruby1.8 dm-cli-ruby1.8 dm-cli0.9.8-ruby1.8 hoe-all-ruby1.8 hoe-ruby1.8 hoe1.0.5-ruby1.8 hoe1.1.7-ruby1.8 hoe1.2.2-ruby1.8 hoe1.3.0-ruby1.8 hoe1.4.0-ruby1.8
  hoe1.5.3-ruby1.8 hoe1.6.0-ruby1.8 hoe1.7.0-ruby1.8 hoe1.8.2-ruby1.8 launchy-all-ruby1.8 launchy-ruby1.8 launchy0.1.2-ruby1.8 launchy0.2.1-ruby1.8 launchy0.3.2-ruby1.8
  libaddressable-all-ruby1.8 libaddressable-ruby1.8 libaddressable0.1.2-ruby1.8 libaddressable1.0.4-ruby1.8 libaddressable2.0.1-ruby1.8 libdata-objects-all-ruby1.8
  libdata-objects-ruby1.8 libdata-objects0.2.0-ruby1.8 libdata-objects0.9.9-ruby1.8 libdatamapper0.9.8-ruby1.8 libdm-aggregates-all-ruby1.8 libdm-aggregates-ruby1.8
  libdm-aggregates0.9.8-ruby1.8 libdm-core-all-ruby1.8 libdm-core-ruby1.8 libdm-core0.9.8-ruby1.8 libdm-is-tree-all-ruby1.8 libdm-is-tree-ruby1.8 libdm-is-tree0.9.8-ruby1.8
  libdm-migrations-all-ruby1.8 libdm-migrations-ruby1.8 libdm-migrations0.9.8-ruby1.8 libdm-observer-all-ruby1.8 libdm-observer-ruby1.8 libdm-observer0.9.8-ruby1.8
  libdm-serializer-all-ruby1.8 libdm-serializer-ruby1.8 libdm-serializer0.9.8-ruby1.8 libdm-timestamps-all-ruby1.8 libdm-timestamps-ruby1.8 libdm-timestamps0.9.8-ruby1.8
  libdm-types-all-ruby1.8 libdm-types-ruby1.8 libdm-types0.9.8-ruby1.8 libdm-validations-all-ruby1.8 libdm-validations-ruby1.8 libdm-validations0.9.8-ruby1.8
  libextlib-all-ruby1.8 libextlib-ruby1.8 libextlib0.9.9-ruby1.8 rake-all-ruby1.8 rake-ruby1.8 rake0.8.3-ruby1.8 rspec-all-ruby1.8 rspec-ruby1.8 rspec0.9.4-ruby1.8
  rspec1.0.8-ruby1.8 rspec1.1.11-ruby1.8 rubyforge-all-ruby1.8 rubyforge-ruby1.8 rubyforge0.4.5-ruby1.8 rubyforge1.0.1-ruby1.8

The estimated additional disk usage for libdatamapper0.9.8-ruby1.8 from DebGem was noted as 28.1 MB. Quite a bit, but I can only recommend not to try this out with apt-get install rails (which oddly enough does not fall into the libXYZ-ruby1.8 scheme) - 484 MB!

Though installation went well, unfortunately I was unable to access the newly installed gem, even though it should have registered with my current rubygems installation:

All DebGem packages register themselves as Ruby gems, thereby providing full compatibility with Ruby software that expect gems.
colszowka@colszowka-laptop:~$ gem list --local | grep 'datamapper'
colszowka@colszowka-laptop:~$ irb
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'dm-core'
LoadError: no such file to load -- dm-core

Obviously the reason for this is that I do have a manual Rubygems install, rather than the one from the (way outdated) Ubuntu repositories. Since I did not want to mess up my whole gems install, I decided to not go further and rather check this out in a virtual machine on a fresh install as soon as possible, so until then I can only tell that the installed libraries ended up in /var/lib/gems/1.8/gems/ on my machine, which is the default gem install path for the Ubuntu Rubygems package. Obviously the DebGem repositories supply updates for Rubygems, so it might become unneccessary to have manual installs of Rubygems in order to get latest versions. I will try this the next days and keep you updated.

Until then, I can only say that this project is very promising, but obviously still far from maturity. On the other hand, just think of setting up the whole Rails stack on a vanilla Ubuntu/Debian machine through a custom .deb package containing your projects dependencies (ruby1.8, rubygems1.8, rails, passenger, apache2 and so on). The Brightbox passenger debs and DebGem might get us there in no time!

Update, January 7th: The Phusion guys have updated the datamapper (which after a version update also is libdatamapper0.9.9-ruby1.8) debgem, so now it won't install all these gems I listed above anymore. I am currently testing the whole thing in a vanilla Ubuntu VM, so stay tuned for a future post on that!

Written by Christoph Olszowka
blog comments powered by Disqus