This patch adds a very simple, yet powerful, dependency system for plugins. I'm currently working on a project which is utilizing over 70 plugins at once. It would be impossible to maintain the dependencies between them, e.g. xyz depends on the presence of acts_as_*. It's especially important for us to have the dependencies defined within the plugin since we will be open-sourcing all of the plugins and want to make it easy for people to use them.
The way several people currently address the problem is by forcing a load dependency order such as:
01_acts_as_bacon
02_acts_as_chunky_bacon
These folder names ensure that plugins are loaded in a certain order. However, this is extremely difficult to maintain.
The proposed patch addresses this problem by adding a method called 'require_plugin' to the Initializer that will search the list of available plugins based on the given name and load it. For example, if you have a plugin called 'acts_as_chunky_bacon' that depends on 'acts_as_bacon', in init.rb for acts_as_chunk_bacon you would have the following:
require_plugin 'acts_as_bacon'
require 'acts_as_chunk_bacon'
If the plugin can't be find, an exception would be raised indicating to the user that he is missing a dependent plugin.