With so many good plugins around at the moment, I’d perhaps like to
require
some of these in one of my own rather than try to re-write their
functionality.
Is there a mechanism available for making a plugin dependent on another
plugin(s)?
There are two different types of dependency. Controlling the load
order is currently impossible without resorting to some send()-based
trickery (or the patch here - http://dev.rubyonrails.org/ticket/5468,
or using init_engine.rb and the engines plugin’s Engines.start
method).
However, I’m guessing that you might be looking for a more general
form of dependency, i.e. “for plugin X to operate, plugin Y needs to
be installed”. There are a couple of ways around that at the moment,
which aren’t too ardous.
If you’re the developer behind Plugin X, you can include a hook in
install.rb which ensures that Plugin Y is also installed if it isn’t
already:
If you want to be able to use some of the functionality from Plugin Y
while Plugin X is loading (i.e. in init.rb), then you’ll need some of
the cunning at the top of this email. Some people have mooted using
gems to install and load plugins, which might give you all of this
functionality in the future. I’m not crazy about this idea, but we’ll
see what happens.