Plugin Architecture

Does anyone have any suggestions about building a plugin architecture for a Rails application?

This would be different from the Rails plugin architecture; this would be plugins for my Rails application in particular (i.e. like Firefox extensions, or OpenOffice extensions)

You can do most things with the plugin/gem architecture build into Rails. The only thing I have found is that initialization order and load_path precedence may be different than normal plugins.

With the normal system the applicaiton's views take precedence over views in an engine plugin or gem. With an application plugin system (I call mine "add-ons" to differentiate it from the Rails system), you may want to reverse this.

Right now I've just built my first "add-on" to the Kete app:

http://github.com/kete/kete_translatable_content/

The rails/init.rb file is where most of the example code you may want is. Notice that I add to a set of extensions blocks to run from within the Kete application after the initialization process has completed to reopen classes to extend their functionality (other classes are simply reopened in the config.to_prepare block). This ties in on line 108 of the application's environment.rb file:

http://github.com/kete/kete/blob/enhancement_269_refactoring_for_adds_on/config/environment.rb

Hope this helps, Walter