rod mclaughlin

I created this blog to illustrate my experiences with the Ruby application framework 'Merb', Ruby on Rails' competitor, which is apparently much faster and more modular...

I initially intended to get some 'blogging app' from the web, and adapt it. I downloaded Mephisto, Rock, Feather, Fightinjoe and Pmpknpi from GitHub, and none of them worked. Merb always had some issue.

Not quite true: Mephisto is a RAILS app that doesn't work with any of the Rails versions I had installed (2.0 +), and Rock is a MERB app which does work - but it doesn't do anything.

I got further with Feather than any of the others, and had fun extending Merb::Router so it had a method Feather needed which had been deprecated (I added this to the top of application.rb):


module Merb class Router class << self def prepend(&block) prepare([], @routes, &block) end end end end

The power of Ruby! I've no idea what the above code does, just that Feather needed it. Feather still didn't work though - I can't remember at what point I gave up.

Merb is in rabid development. It is not well documented. The great leap forward which occured during 2008, when version 1.0 was released, rendered all the tutorials obsolete. For example, I couldn't get this one working with Merb 1.0.3: www.devx.com/webdev/Article/39735 even when I downloaded the finished app.

The way the notes and documentation are written are difficult for the newcomer, unlike Rails. When you have an error and google it, you don't usually find anything you can use...



Named route admin_dashboard could not be generated with {}

FATAL: The gem lib/merb_helpers_ext (>= 0, runtime), [] was not found

'load_missing_constant': uninitialized constant Dependencies (NameError)
 

For example, I googled 'merb tests' to find out how to run tests in Merb.
In Rails it's 'rake tests' but this doesn't work for Merb.

I found http://merbivore.com/features.html which says

 

    "Merb is testing-framework-agnostic: you can use Test::Unit, Rspec, or test/spec. All three testing frameworks have built-in support for mock objects that allow you to micro-target your tests exactly as you like. And because Merb is so modular, it’s easy to test your controller without a request object at all, if you’d want to."
 
 

Great. But how do you run the tests?

Oh! It's

rake spec Silly me.

This tells me to install 'webrat'.

sudo gem install webrat This produces the following:


Building native extensions. This could take a while... ERROR: Error installing webrat: ERROR: Failed to build gem native extension. rake RUBYARCHDIR=/usr/local/lib/ruby/gems/1.8/gems/nokogiri-1.0.6/lib RUBYLIBDIR=/usr/local/lib/ruby/gems/1.8/gems/nokogiri-1.0.6/lib /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/gempackagetask.rb:13:Warning: Gem::manage_gems is deprecated and will be removed on or after March 2009. (in /usr/local/lib/ruby/gems/1.8/gems/nokogiri-1.0.6) checking for xmlParseDoc() in -lxml2... no checking for xsltParseStylesheetDoc() in -lxslt... no checking for libxml/xmlversion.h in /usr/local/include/libxml2,/usr/include/libxml2... no need libxml *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details... etc.

This is not the end of the world for a Unix developer. But it is the end of the
feeling you got from Ruby on Rails, that you'll never have to work again...

 

Portland London