Re: plugin dependencies

Andrew White
Wed, 19 Sep 2007 14:04:30 -0000

On 19 Sep 2007, at 14:02, Michael Koziarski wrote:

>> Sure, and what we''ve done so far internally is twist things so
that
>> this isn''t the case and we don''t have to rely on load
order. It would
>> be nice not to have to perform those contorsions.
>
> So for those situations you could use config.plugins >
[:your_first_thing, :all] ?  Or am I missing something.

Perhaps some mechanism of changing the order config.plugins from
within a plugin would be simpler, e.g:

Three plugins A, B and C need to be loaded in the order C, A, B as B
depends on A & C and A depends on C.

In a dependencies.rb within the plugin''s top level directory:

   Plugin A:  depends_on :plugin_c
   Plugin B:  depends_on :plugin_a, :plugin_c
   Plugin C:  <empty>

The plugin loader would start off with the alphabetical list and then
remove and re-insert each plugin depending on it''s dependencies. e.g:

   Initial:  [:plugin_a, :plugin_b, :plugin_c]
   A/deps :  [:plugin_b, :plugin_c, :plugin_a]    # A re-inserted
after C
   B/deps :  [:plugin_c, :plugin_a, :plugin_b]    # B re-inserted
after A
   C/deps :  [:plugin_c, :plugin_a, :plugin_b]    # No changes

I''m sure there''s some situation which wouldn''t work
but at least it
help reduce the need to manually specify config.plugins.


Andrew White