[Mongrel] New flexible plugin system in the works

Zed Shaw zedshaw at zedshaw.com
Tue Feb 28 01:52:52 EST 2006

Hi Everyone,

Just a quick message to say that I'm holding back the 0.3.7 release so I can
get this flexible plugin system going that we'll need for the next step of
loading user defined handlers and filters.

What I've done is completely replaces pluginfactory with an alternative that
lets you create simple classes like so:

class Stop < Plugin "/commands"

And it'll get registered automagically into the PluginManager.  I have the
command system already doing this without problems and it is a lot faster
than Plugin factory.  The weird class definition syntax is a strange trick I
picked up from the Camping folks and basically means that this plugin
belongs in the "/commands" category.  These categories can be fairly
arbitrary and are really just using the URIClassifier.

So, how will it get used?  I'm adding an option -L that you can pass a path
and Mongrel will load all the .rb files in that directory for you.  All you
then need to do is place your new commands (or other plugins) in this
directory however you want and they'll be available.

I'm going to then work out how you would create your own handlers from this,
and finally add filters and loading those arbitrarily as well.

Anyway, should have this into svn tonight so please test away and report the
breakage to me.


More information about the Mongrel-users mailing list