10 Nov 2007

FreeBASE is a Ruby library that deserves to be better known.

FreeBASE is a plugin management system that automatically handles dependencies and plugin loading and starting. It has an internal databus that it uses, and that your application can use to store data and services. FreeBASE is part of the FreeRIDE project, but can be used independently.

I recently decided to port Redcar onto FreeBASE (ditching my own home-grown plugin system) and I must say that it was the right decision. I’ve been able to rip out an enormous amount of code from the Redcar libs.

For each plugin, you declare the relevant metadata in the plugin.yaml file:

--- !ruby/object:FreeBASE::PluginConfiguration
name: documents
version: 1.0
autoload: (true)
require_path: documents/documents
startup_module: Redcar::Plugins::Documents
  redcar-core: "*"
  redcar-core: "*"
FreeBASE can then calculate the dependencies between plugins (for plugin loading and for starting) and load them in the correct order.

The databus is a little like a filesystem. Here’s what the top two levels look like in Redcar:

  /plugins/ ...
Using the FreeBASE databus simplifies things dramatically, because there’s always an obvious place to store information. Each ‘slot’ in the databus can be data, a stack, a queue or a proc. The code to persist subtrees is built-in, and slots can have manager objects and arbitrary attributes.

If your Ruby project needs a plugin system, you should strongly consider FreeBASE. There are some useful docs about FreeBASE here and here.

blog comments powered by Disqus