plugin dependencies

Andrew Kaspick
Wed, 19 Sep 2007 09:12:22 -0000

Hello all,

The topic of plugin dependencies has come up before and it doesn''t
seem to have been addressed by core or core doesn''t seem to think
it''s
an issue.  I''ve looked at the current edge code and don''t see
anything
new, so if I''ve missed something *please* let me know.

The following article makes mention of a require_plugin functionality...
http://www.pluginaweek.org/2006/11/05/plugin-dependencies-revisited/

and the referenced article seems to make the point that such a feature
may not be required...
http://weblog.techno-weenie.net/2006/10/31/plugin-dependencies

The reason I bring this up is that with many current core features
being moved to plugins, existing plugins that have been written to
improve functionality in some of those core areas may no longer work
since they will now be dependent on these "core plugins" being
installed... and even if they are installed, there''s no guarantee that
the load order will be correct.

For example, I have written a plugin to improve the functionality of
the in_place_editor code.  This code works just fine with the current
public version of rails.  Now in edge this core code has been moved to
a plugin and my plugin will no longer work as expected since the core
plugin is now "required" by my plugin.  This is fine (although a more
informational warning would be useful for the user) as the user simply
needs to install the "core plugin" as well.  This is where problems
start to occur.  Since rails loads plugins in alphabetical order by
default, if my plugin comes before the core plugin in name, my plugin
code is overridden.

With many rails features being deprecated and being moved to plugins,
this will cause many dependencies on any existing plugins.  This can
be resolved by specifying the load order with the config.plugins
option, but a user shouldn''t have to jump through those hoops to get
things working... at least not before a fair amount of possible
debugging since there may be no indication of the underlying problem
of an existing plugin not working (a user may believe it''s their own
code causing problems).  Another possible solution is making sure ones
own plugin is alpabetically higher than the one it depends on to force
the proper load order, but that would be rather nasty hack.

So I''d like to know what people think about having a
"require_plugin"
type functionality in core?  Is there a valid workaround that exists
already?  If there isn''t, do people even consider this a problem?

Thanks,
Andrew