Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Described complete root.xml file format.
  • Loading branch information
andkirby committed Aug 17, 2016
1 parent c186a89 commit a2e3c64
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 15 deletions.
24 changes: 12 additions & 12 deletions src/config/root.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<config xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:noNamespaceSchemaLocation="xsd/root.xsd">

<!--Please update also PreCommit\Composer\Application::VERSION-->
<!--Please update also PreCommit\Console\Application::VERSION-->
<version>2.x-dev</version>

<supported_hooks>
Expand All @@ -17,17 +17,17 @@

<!--Additional configuration file-->
<additional_config>
<main>config/commithook.xml</main>
<pre-commit>config/pre-commit.xml</pre-commit>
<commit-msg>config/commit-msg.xml</commit-msg>
<magento>config/pre-commit-magento.xml</magento>
<local>../commithook-local.xml</local>
<userprofile>HOME/.commithook/commithook.xml</userprofile>
<userprofile-pre-commit>HOME/.commithook/pre-commit.xml</userprofile-pre-commit>
<userprofile-commit-msg>HOME/.commithook/commit-msg.xml</userprofile-commit-msg>
<project_all>PROJECT_DIR/.commithook/</project_all>
<project>PROJECT_DIR/commithook.xml</project>
<project_local>HOME/.commithook/projects/PROJECT_NAME/commithook.xml</project_local>
<main xs:type="ConfigFile">config/commithook.xml</main>
<pre-commit xs:type="ConfigFile">config/pre-commit.xml</pre-commit>
<commit-msg xs:type="ConfigFile">config/commit-msg.xml</commit-msg>
<magento xs:type="ConfigFile">config/pre-commit-magento.xml</magento>
<local xs:type="ConfigFile">../commithook-local.xml</local>
<userprofile xs:type="ConfigFile">HOME/.commithook/commithook.xml</userprofile>
<userprofile-pre-commit xs:type="ConfigFile">HOME/.commithook/pre-commit.xml</userprofile-pre-commit>
<userprofile-commit-msg xs:type="ConfigFile">HOME/.commithook/commit-msg.xml</userprofile-commit-msg>
<project_all xs:type="ConfigFile">PROJECT_DIR/.commithook/</project_all>
<project xs:type="ConfigFile">PROJECT_DIR/commithook.xml</project>
<project_local xs:type="ConfigFile">HOME/.commithook/projects/PROJECT_NAME/commithook.xml</project_local>
</additional_config>
<cache_dir>HOME/.commithook/cache</cache_dir>
</config>
46 changes: 43 additions & 3 deletions src/config/xsd/root.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,61 @@
<xs:element name="config">
<xs:complexType>
<xs:sequence>
<xs:element name="version" type="VersionType" />
<xs:element name="version" type="Version" minOccurs="0" />
<xs:element name="supported_hooks" type="HooksList" minOccurs="0" />
<xs:element name="additional_config" type="ConfigFiles" minOccurs="0" />
<xs:element name="cache_dir" type="ConfigFile" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>

<!--Version type-->
<xs:simpleType name="VersionType">
<xs:simpleType name="Version">
<xs:annotation>
<xs:documentation xml:lang="en">
Version node.
Examples: 1.2.4, 1.2.4-patch, 1.2.4-patch.4, 1.2.4-beta.5, 1.2.4-alpha.6, 1.2.4-alpha
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:pattern value="(([0-9]+\.[0-9]+\.[0-9]+(-(alpha|beta|patch)(\.[0-9]+)*)?)|([0-9]+(\.[0-9]+)?\.x-dev))"/>
<xs:pattern
value="(([0-9]+\.[0-9]+\.[0-9]+(-(alpha|beta|patch)(\.[0-9]+)*)?)|([0-9]+(\.[0-9]+)?\.x-dev))" />
</xs:restriction>
</xs:simpleType>

<!--Hooks list-->
<xs:complexType name="HooksList">
<xs:sequence>
<xs:element name="hook" type="Hook" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>

<!--Hook type-->
<xs:simpleType name="Hook">
<xs:annotation>
<xs:documentation xml:lang="en">Hook filename.</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:pattern value="[a-z_-]+" />
</xs:restriction>
</xs:simpleType>

<!--Additional config files-->
<xs:complexType name="ConfigFiles">
<xs:sequence>
<xs:any processContents="strict" namespace="##local" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>

<!--Hook type-->
<xs:simpleType name="ConfigFile">
<xs:annotation>
<xs:documentation xml:lang="en">
Path to config file.
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:pattern value="(([A-z]:)|\.\.|config|HOME|PROJECT_DIR)/[A-z_\-./]+" />
</xs:restriction>
</xs:simpleType>
</xs:schema>

0 comments on commit a2e3c64

Please sign in to comment.