Summary of the DirectiveMetadata rework:
New class DirectiveMetadata - mixin for directive implementations. Standard
protocol for the fundamental directive properties that define the directive
markup (attribute name and namespace) and processing priority that are
required for all directives. Extensible - any metadata property of use can
be specified.
DirectivePriorities constants are moved from DirectiveHelpers module to
DirectiveMetadata.
Standard metadata properties for all directives specify the directive markup
and processing priority:
- :attribute_name, :namespace_name, :namespace_prefix, :attribute_qname
- :priority - directive processing priority (specify constant or its
name; latter preferred)
Intended convention for documentation metadata (not yet rolled out into
directive impls, but Real Soon):
- :description - the one-liner summary we put in the index
- :category - one or more categories so we can generate docs automically
with category indexes
The description properties can support a directive info page in the
MasterView admin controller and be used to automatically generate the
doc/directives.html reference.
Directive implementations use metadata DSL notation for declarative
specification of their directive info.
class Foo < MasterView::DirectiveBase
metadata :priority => ''High'',
:description => ''My nifty custom directive that does
Good Stuff''
event :element { ... }
end
Default values for standard properties are installed when directive is
loaded.
Default values for the directive implementations in a directives load path
dir can be specified by placing file named .metadata in the directives
directory with yaml specifications. Specify defaults: with name/value pairs
for metadata defaults. In future may have some other options that fit in
here which could control loading or support tools.
Supporting changes:
- MasterView::Configuration now supports add_directive_path method for
appending a directive_paths entry. Currently this is just appends the
directive path name string provided as arg to the load path
(config.directive_paths << arg). Intention is to add support here for
optional parm with metadata defaults, so that the md defaults for directives
loaded from that directory can be controlled by the app config to override
or extend the .metadata file in the directives dir.
###STILL TO DO: need to sort out config setting for specifying default
namespace for directives that distinguishs builtin from addons (mv:, mvx:).
Right now addon directives that don''t explicitly declare their
namespace or
provide .metadata spec in their directives dir still go to mv: namespace.
~ Deb