[ANN] PluginFactory 1.0.6

M

Michael Granger

Version 1.0.6 of pluginfactory has been released.

PluginFactory is a mixin for adding plugin classes to your application.
It adds a 'create' method to your base plugin class that can be used to
search for/and load them later.

For example, if you want pluggable 'driver' classes for your library,
you can define the base class like so:

require 'pluginfactory'

class Driver
include PluginFactory

# Set one or more paths to use when searching for
# 'Driver' plugins
def self::derivative_dirs
["drivers"]
end
end

Now, if someone wants to provide their own plugin, they just inherit
from 'Driver' like so:

require 'driver'
class SpecialDriver < Driver
# ...do special driver-ish things
end

saves it as `drivers/special.rb' (or one of several other variants) in
their library, and then load it by name via the superclass:

special = Driver.create( 'special' )

PluginFactory will search for the correct require, require your library,
and create a new instance of the appropriate subclass. Any additional
arguments to 'create' will be passed to the subclass's constructor.


== Project Page

http://deveiate.org/projects/PluginFactory/

== Installation

Via gems:

$ sudo gem install pluginfactory

or from source:

$ wget http://deveiate.org/code/pluginfactory-1.0.6.tar.gz
$ tar -xzvf pluginfactory-1.0.6.tar.gz
$ cd pluginfactory-1.0.6
$ sudo rake install

== Changes

Repackaging for newer Rubygems. This release contains no major code changes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top