Merb and DataMapper on the edge

I've just started writing a new app with merb and datamapper, so decided to start out on the edge. The preferred way to do it these days is with sake, a tool for running system wide rake tasks. It's rather neat, and should (in theory) have made my installation of the edge versions of merb and datamapper extremely easy.

I did hit a couple of issues running them on Ubuntu 7.10, hence this article.

Installing sake

This should be easy, but right now it appears to be a bit of sticking point. You need a relatively recent version of rubygems (at least 1.1.1), so I upgraded to the latest (1.2.0):

$ sudo gem update --system

Sadly I couldn't install sake automatically as specific versions of ParseTree and ruby2ruby couldn't be installed. I did manage to work round it manually though, and it went something like this:

$ sudo gem install sake
ERROR:  Error installing sake:
             sake requires ParseTree (= 2.1.1, runtime)
$ gem list -r ParseTree

*** REMOTE GEMS ***

ParseTree (2.2.0)
ParseTreeReloaded (0.0.1)
$ sudo gem install ParseTree --version '= 2.1.1'

Once ParseTree was installed I had trouble with ruby2ruby. The only way I could get round that problem was by downloading it and installing it manually, followed closely by sake:

$ wget http://rubyforge.rubyuser.de/gems/ruby2ruby-1.1.8.gem
$ sudo gem install ruby2ruby-1.1.8.gem
$ sudo adl gem install sake

Phew. There's a bug report about this problem on RubyForge; with a bit of luck it may be sorted by the time you try this.

Installing merb with sake and edgy

Edgy is a cracking bunch of scripts (well, rake tasks actually) for installing gems directly from their source repositories. You run the tasks with sake.

Before you try and run the sake tasks you'll need zip installed:

$ sudo apt-get install zip

You'll also need a few dependencies installed from the gem world:

$ sudo gem install erubis json_pure rack mime-types

Then all you need to do is to head over to the edgy sake instructions. The short version looks like this:

$ sake -i 'http://edgy.4ninjas.org/edgy.sake'
# Installing task `edgy:self:version'
# Installing task `edgy:self:update'
# Installing task `edgy:self:uninstall'
# Installing task `edgy:list'
# Installing task `edgy:install'
# Installing task `edgy:update'
# Installing task `edgy:dependencies'
$ sake edgy:install packages="merb do dm"

It's worth scanning the output of the build process once it's finished, as it doesn't halt on errors.

If you want to run rspec from edge as well then you can set packages to "merb-stack" instead, but I'm quite happy with rspec 1.1.4 so long as I can get away with it.

Enjoy.

Published on in Merb