Re: plugin dependencies

Aaron Pfeifer
Fri, 21 Sep 2007 02:56:51 -0000

Not to beat a dead horse, but I threw together a few ideas for working
towards the plugins-as-gems approach.  Attached are two possible ways of
going about it.  They are not, by any means, complete solutions (or
completely tested solutions) but offer an insight at a possibility for
plugins.  Both patches basically replace the current plugin loading
mechanism with the gem system.  This way, we get support for versioning, the
gem repository, dependencies, etc.

For both patches, existing plugins would:
1. No longer need an init.rb
2. Follow the standard gem structure (i.e. my_plugin/lib/my_plugin.rb)
3. Need to create a Rakefile which defines the gem specification (which some
already do)

gem_always.diff - This patch assumes that everything (plugins and gems)
would exist under vendor/ (a true vendor everything).

gem_optional.diff - This patch would require config.plugin_loader to be set
to Rails::Plugin::GemLoader in order to use the gem system for loading
plugins.  This patch assumes that plugins and gems (except rails) would
exist under vendor/plugins.

Essentially, plugins would now simply refer to gems installed locally in the
application.  This would also mean that you wouldn''t need to do
anything
special for loading gems which are normally stored under vendor/ or
vendor/gems.

Anyway, what are everyone''s thoughts?

On 9/19/07, Michael Koziarski <michael@koziarski.com>
wrote:
>
>
> > Ignoring anything about requiring specific versions, couldn''t
this be
> > achieved by having all of the plugins added to the load path before
> > any init.rb files are evaluated (my suggestion above)? That way the
> > normal Ruby "require" would seem to provide everything that
you
> > describe here.
>
> This sounds like it''s probably harmless and could solve a bunch of
the
> different issues people have been mentioning.  If you wanted to take a
> look at this, I''d be happy to apply it.
>
> We''re definitely not going to go down the route of a massive
> dependency system of our own.  Rubygems does this kind of thing
> already, and perhaps we just need to go down the plugins-as-gems
> approach.
>
> Either way,  I''d be open to applying a patch to add :all to
> config.plugins or the load order changing,  but that''s about it
for
> 2.0.
>
> --
> Cheers
>
> Koz
>
> >