There was much discussion in
TWiki:Codev.MainTWikiPreferencesOverridePluginSettings
on how we should handle plugin settings.
We differentiated
- Plugin preferences
- Plugin customization/personalization
- Plugin configuration
The agreement was that we should attempt to move (3) into the standard config format, as this will allow us to read that only once, rather than every time a plugin is called.
In order to make this process easier, I have updated the
bin/configure
script to allow it to read plugin settings.
For this, in the plugin directory, for example,
lib/TWiki/Plugins/ControlsPlugin/
, there should be a file
Plugin.spec
which is layed out in the format of the configure
*.spec
files. The section marker should be "Plugins", in order to show up under the plugin section, albeit we could also create a separate section for each plugin.
If we do not want to rely on the user to give the correct section, we could enhance
TWiki::Configure::TWikiCfg::_parse
to take a section argument, which would assume all what follows is in that section. I did not do this yet.
An example spec file would be
#---+ Plugins
# **BOOLEAN**
# EditTablerowPlugin debug setting
$TWiki::cfg{Plugins}{EditTablerowPlugin}{DEBUG} = 0;
1;
Checked this in as 11578.
Notes:
- It already loads all .spec files found on the path, but this approach is neater and more consistent with the way extensions are published.
- Please make sure it picks up .spec files for Contribs as well as Plugins (all non-plugin extensions are classed as contribs)
- To add a section, you need to put this at the top of your .spec:
# ---+ Section Name
I will check in an example (
MailInContrib)
CC
Your update has the same problem than the one I tried earlier: the config file in the contrib directories is not interpreted correctly:
- The format string line seems to be ignored. In my experiment with JSCalendarContrib I used a different size prompt box, but both come up with the default value.
- The values in the Config.spec file is ignored, and the empty value is assumed.
However, the Config.spec file is read enough to pick up that there are two items to configure. --
TW
I also have a question... Why are you scanning the INC path when looking for contrib and plugins. Certainly they are only on lib/Twiki/*! Why look in all the other places? --
TW
Confirming that both Contrib and Plugins load now... --
TW
Still not sure whether we really should search all of
@INC
but I guess it is no big deal one way or the other --
TW
I explained in mail why
@INC
is searched; it is because .spec files live in the code tree, and the code tree is whatever is under
@INC
.
Anyway, I think this is done now, so marking ready for release.
CC
4.1.0 released
KJL