I'm still not sure this kind of functionality is something that should  
be provided outside of Mephisto - is there really a general need for  
plugins to have configuration?

Additionally, it doesnt seem very natural that application developers  
should have to create config files within vendor/plugins... Rails'  
conventions lean towards putting configuration in config/initializers  
or config/environment.rb, surely?

Mephisto has some interesting needs because it needs to provide a  
general web interface for configuring an unknown set of plugins  
parameters, and persisting that configuration, but is this something  
that all rails applications need?

I guess it would help me understand the motivation for this feature if  
I knew what was deficient in Mephisto's current mechanism. Can anyone  
enlighten me? :)

Thanks,

James


On 2 Feb 2008, at 11:32, Sven Fuchs <[EMAIL PROTECTED]> wrote:

> A couple of discussions later I propose the attached patch for  
> Engines.
>
> This super-minimalistic approach allows to do two things:
>
> 1. Plugin users can set plugin attribute values in a file  
> [plugin_dir]/config.yml. If the file is present, it will be parsed  
> and values loaded. If an attribute for a YAML name/value pair hasn't  
> been defined by the plugin dev (see 2.)) it will be defined.
>
> # [plugin_dir]/config.yml
> something: cool
>
> 2. Plugin devs can define attributes and default values in init.rb  
> (or elsewhere in the plugin as long as they make sure that the  
> definition is evaluated when the plugin's init.rb is) like this:
>
> attr_accessor :something
> @something = 'default'
>
> The mechanism works both when 1.) no config.yml is present and when  
> 2.) no default values have been set by the plugin dev.
>
> I think this is a great solution because it's flexible, minimalistic  
> and unobstrusive.
>
> Apps like Mephisto can then build further on this mechanism and add  
> another storage layer on top of this. E.g. Mephisto could overwrite  
> Engine::Plugin#load_config_data and access the database to load an  
> AR object holding the config data.
>
> Unit tests for this are ready. Please let me know what you think!
>
> I'd like to proceed with this stuff as soon as possible so I can  
> start porting/implementing changes for Mephisto.
>
> <plugin_attributes.diff>
>
>
> --
> 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 (mobil
> _______________________________________________
> Engine-Developers mailing list
> [email protected]
> http://lists.rails-engines.org/listinfo.cgi/engine-developers-rails-engines.org
_______________________________________________
Engine-Developers mailing list
[email protected]
http://lists.rails-engines.org/listinfo.cgi/engine-developers-rails-engines.org

Reply via email to