ruby, rails, textmate, automation, etc.

merb and DataMapper on the edge

Posted on July 14, 2008

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.

Comments
  1. GrahamJuly 15, 2008 @ 05:35 PM
    Sorry to comment on my own post, but I just tried sake on OS X. It failed abismally and didn't tell me why. It turns out that line 187 of ~/.sake (created after you run the "sake -i" command) sends all error messages to /dev/null. Edit line 187 so that it looks like this to see what's going on: `sudo rake install`
  2. Mike StenhouseJuly 22, 2008 @ 09:32 PM
    Hmmmm. I've got everything _apparently_ installed but when trying to run a test merb app I get: You must install the DataObjects::SQLite3 driver. gem install do_sqlite3 I guess the next step is to try installing Datamapper on edge too?
  3. Sam SmootAugust 17, 2008 @ 05:54 AM
    Mike, sounds like you have DM 0.3.x installed through: gem install datamapper. DM 0.9.x is installed through gem install data_mapper. I can tell you this because DM 0.9.x doesn't include the "You must install the DataObjects::Foo driver" messages. It simply gives you a LoadError for a missing driver. Which was the obvious thing to do in hind-sight. I just got a bit too clever previously. ;-)
Post a comment
Comment