basho / cuttlefish

never lose your childlike sense of wonder baby cuttlefish, promise me?
Apache License 2.0
205 stars 124 forks source link

Added priority to also count inside files #72

Closed Licenser closed 10 years ago

Licenser commented 10 years ago

This is a extension of the file order patch. It extends the priority system to within files with the following rules:

The first element of a file has the highest priority, the last element has the lowest one (namely 0). Also mappings can get a {priority, X} setting passed that overwrites this automatic rule to force a mapping to have a specific position inside a file, this comes in handy to decouple position in the generated .conf file from the priority of a setting withn a file.

In file priorities take a lower impact then the permissions assigned by the file order, this prevent schema orders to mess with other schemas. (i.e. everything in 00.schema will always have a higher priority then 01.schema).

WARNING

This breaks some of the current behavior as it seems that as of this moment the last element in .schema to have the highest priority. I left the test failing to point this out.

Other then that I think the new behavior is more sensible since in other places the 'first has higher priority' is already working this way (i.e. the 00.schema lads first in the .config etc.)

Licenser commented 10 years ago

Adding as a note here not sure this is good or worth doing but I wanted to put it in for discussion ;)

joedevivo commented 10 years ago

Didn't want to include data that applied to the whole schema in the file. a schema file is intended to be a set of mappings, translations and validators.