Engines & config

Hello all,

So, finally (yes, yes, I know) a version of the engines plugin
approacheth targetted at edge rails (aiming at the 1.2 release). I’m
taking this opportunity to do some serious refactoring, so I thought
I’d solicit some opinions while I’m at it. There might be a few emails
like this in the very near future - feedback is appreciated.

Topic #1: Removing the ‘config’ method

I’m considering removing this method from engines as default. Or
rather, not attaching the ‘config’ method to the Module class when
engines loads. This might’ve been a bad idea since it can conflict
with the ‘config’ method of any other module out there, or even when
accessing Rails’ config via the variable supplied during plugin’s
init.rb evaluation (http://dev.rails-engines.org/tickets/187).

The purpose of the ‘config’ method was to make it simple for engine
developers to define defaults but allow users to override those
values, but I think now we might be able to adopt a more ‘Railish’
approach by using mattr_accessor instead. So, rather than
(environment.rb):

module SomeEngine
config :something,
end
Engines.start :some_engine

we might have

Engines.start :some_engine
SomeEngine.something =

The user configuration would now occur after the engines are loaded,
so that the appropriate accessors ca be defined within the engine
itself.

Obviously this change is going to break existing engines (the config
method won’t be there anymore) until they are updated, which needn’t
be immediately. Any thoughts?

James

On Mon, 16 Oct 2006 13:09:15 +0100, James A. wrote:

The purpose of the ‘config’ method was to make it simple for engine
developers to define defaults but allow users to override those
values, but I think now we might be able to adopt a more ‘Railish’
approach by using mattr_accessor instead.

I think that sounds good… no reason to reinvent the wheel. The less
weight that Engines carries, the more likely it is to see wider
adoption.
I’ve recently seen people who want “a plugin with views and controllers
and
models” but, instinctively, feel that Engines is too heavyweight. I
obviously disagree…

Jay

On 10/16/06, James A. [email protected] wrote:

SomeEngine.something =

The user configuration would now occur after the engines are loaded,
so that the appropriate accessors ca be defined within the engine
itself.

I love it.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs