Hi James,
like I mentioned a while back Rick asked me regarding Engines as a
basis for Mephisto plugins.
Mephisto comes with its own implementation of plugins that share
controllers, views, routes, schemas (migrations) etc. as well as some
config stuff. Rick asked me to look into using Engines instead and he
suggested this as a feature for Mephisto 1.0
I believe Mephisto could benefit from using all the major Engines
functionality. But there are some features that aren’t currently
supported by Engines and I’d like to discuss to what extend these
could possibly be added to Engines instead of having them in Mephisto.
These are:
-
About info: we’ve omitted about.yml from Engines for Rails 2.0
recently and you already mentioned that this could possibly be
restored. On the one hand Rick said that he doesn’t really care about
this, but on the other hand people actually seem to use this
information (e.g. the plugin authors website is displayed in the
Mephisto admin interface and people use this link to lookup
information about the plugin). -
Configuration info: Mephisto provides means to configure a plugin
through an option directive. E.g. in a feedback form plugin there
might be an option to configure the confirmation message that’s
displayed when the feedback for has been submitted (bad example but
you get the idea). The option and its default value is defined in the
plugin, it’s current value is pulled from the database if a record is
present (otherwise the default value is used). Mephisto could switch
from using ActiveRecord as a storage for plugin configuration data to
something else, e.g. another YAML file, Ruby code or whatever.
A possible solution for both requirements that I personally like could
be:
With Rails 2.0 plugins we can do all the about and configuration stuff
from within init.rb because this file is evaluated within the plugin’s
scope. Because init.rb is overwritten when the plugin get’s
reinstalled (so the config customization would get lost) we could look
for a (e.g.) config.rb file and evaluate it alongside with the plugin
init.rb file if it’s present. This config.rb file would allow to
define something like:
author ‘James’
version ‘1.0’
website ‘http://…’
option :feedback_confirm_msg, ‘Thanks!’
option :foo, ‘bar’
What do you think?
–
sven fuchs [email protected]
artweb design http://www.artweb-design.de
grünberger 65 + 49 (0) 30 - 47 98 69 96 (phone)
d-10245 berlin + 49 (0) 171 - 35 20 38 4 (mobile)