start validating module.xml file
This commit is contained in:
@@ -62,7 +62,7 @@ class ModuleGenerateCommand extends BaseModuleGenerate
|
||||
$output->renderBlock(array(
|
||||
'',
|
||||
sprintf("module %s create with success", $this->module),
|
||||
"You can now configure your module and complete plugin.xml file",
|
||||
"You can now configure your module and complete module.xml file",
|
||||
''
|
||||
), "bg=green;fg=black");
|
||||
}
|
||||
@@ -86,7 +86,7 @@ class ModuleGenerateCommand extends BaseModuleGenerate
|
||||
$fs = new Filesystem();
|
||||
$skeletonDir = str_replace("/", DIRECTORY_SEPARATOR, THELIA_ROOT . "/core/lib/Thelia/Command/Skeleton/Module/");
|
||||
$fs->copy($skeletonDir . "config.xml", $this->moduleDirectory . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "config.xml");
|
||||
$fs->copy($skeletonDir . "plugin.xml", $this->moduleDirectory . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "plugin.xml");
|
||||
$fs->copy($skeletonDir . "module.xml", $this->moduleDirectory . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "module.xml");
|
||||
|
||||
$classContent = file_get_contents($skeletonDir . "Class.php");
|
||||
|
||||
|
||||
71
core/lib/Thelia/Module/Loader/XmlFileLoader.php
Normal file
71
core/lib/Thelia/Module/Loader/XmlFileLoader.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Module\Loader;
|
||||
use Symfony\Component\Config\Loader\FileLoader;
|
||||
use Symfony\Component\Config\Util\XmlUtils;
|
||||
|
||||
|
||||
/**
|
||||
* Class XmlFileLoader
|
||||
* @package Thelia\Module\Loader
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class XmlFileLoader extends FileLoader
|
||||
{
|
||||
|
||||
/**
|
||||
* Loads a resource.
|
||||
*
|
||||
* @param mixed $resource The resource
|
||||
* @param string $type The resource type
|
||||
*/
|
||||
public function load($resource, $type = null)
|
||||
{
|
||||
$path = $this->locator->locate($resource);
|
||||
|
||||
$xml = $this->parseFile($path);
|
||||
}
|
||||
|
||||
protected function parseFile($file)
|
||||
{
|
||||
$schema = str_replace('\\', '/',__DIR__.'/schema/module-1.0.xsd');
|
||||
|
||||
$dom = XmlUtils::loadFile($file, $schema);
|
||||
|
||||
return simplexml_import_dom($dom);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this class supports the given resource.
|
||||
*
|
||||
* @param mixed $resource A resource
|
||||
* @param string $type The resource type
|
||||
*
|
||||
* @return Boolean true if this class supports the given resource, false otherwise
|
||||
*/
|
||||
public function supports($resource, $type = null)
|
||||
{
|
||||
// TODO: Implement supports() method.
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,16 @@
|
||||
<?xml version="1.0" encoding='UTF-8'?>
|
||||
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:element name="plugin">
|
||||
<xs:element name="module">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="descriptif" maxOccurs="unbounded">
|
||||
<xs:element type="xs:string" minOccurs="1" name="full-namespace">
|
||||
<xs:annotation>
|
||||
<xs:documentation>le descriptif complet, dans autant de langues que nécessaire.
|
||||
Le code de la langue doit être un code pays ISO 639</xs:documentation>
|
||||
<xs:documentation>The full namespace for the main class module (for example MyModule\MyModule)</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element name="descriptive" maxOccurs="unbounded">
|
||||
<xs:annotation>
|
||||
<xs:documentation>complete description, each description must be identify by ISO CODE 639</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
@@ -20,33 +24,31 @@
|
||||
</xs:element>
|
||||
<xs:element type="xs:string" name="version">
|
||||
<xs:annotation>
|
||||
<xs:documentation>La version du plugin. Format libre</xs:documentation>
|
||||
<xs:documentation>Module version</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element name="auteur">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Auteur du plugin</xs:documentation>
|
||||
<xs:documentation>Module author</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element type="xs:string" name="nom"/>
|
||||
<xs:element type="xs:string" name="societe" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element type="xs:string" name="name"/>
|
||||
<xs:element type="xs:string" name="company" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element type="xs:string" name="email"/>
|
||||
<xs:element type="xs:anyURI" name="web" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element type="xs:anyURI" name="website" minOccurs="0" maxOccurs="1"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="type">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Le type du plugin: classique, transport, paiement, filtre, taxe</xs:documentation>
|
||||
<xs:documentation>module type : classic, delivery, payment</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="classique"/>
|
||||
<xs:enumeration value="transport"/>
|
||||
<xs:enumeration value="paiement"/>
|
||||
<xs:enumeration value="filtre"/>
|
||||
<xs:enumeration value="taxe"/>
|
||||
<xs:enumeration value="classic"/>
|
||||
<xs:enumeration value="delivery"/>
|
||||
<xs:enumeration value="payment"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
@@ -70,7 +72,7 @@
|
||||
</xs:element>
|
||||
<xs:element name="thelia">
|
||||
<xs:annotation>
|
||||
<xs:documentation>La version minimum requise de Thelia, au format 'dot' (1.2.3.4 par exemple)</xs:documentation>
|
||||
<xs:documentation>minimum required version of Thelia in 'dot' format (for example 1.2.3.4)</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
@@ -78,17 +80,17 @@
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="etat">
|
||||
<xs:element name="stability">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Le statut actuel du plugin: alpha, beta, rc, production</xs:documentation>
|
||||
<xs:documentation>current module stability: alpha, beta, rc, prod</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="alpha"/>
|
||||
<xs:enumeration value="beta"/>
|
||||
<xs:enumeration value="rc"/>
|
||||
<xs:enumeration value="production"/>
|
||||
<xs:enumeration value="autre"/>
|
||||
<xs:enumeration value="prod"/>
|
||||
<xs:enumeration value="other"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
@@ -44,7 +44,7 @@ class ModuleManagement
|
||||
$finder = new Finder();
|
||||
|
||||
$finder
|
||||
->name('config.xml')
|
||||
->name('module.xml')
|
||||
->in($this->baseModuleDir . '/*/Config');
|
||||
|
||||
foreach ($finder as $file) {
|
||||
|
||||
24
local/modules/Cheque/Config/module.xml
Executable file
24
local/modules/Cheque/Config/module.xml
Executable file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module xmlns="http://thelia.net/schema/module"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://thelia.net/schema/module http://thelia.net/schema/module/module-1.0.xsd">
|
||||
<descriptif lang="fr">
|
||||
<titre>Produits factices</titre>
|
||||
<chapo></chapo>
|
||||
<description>Insertion des produits dans votre site Thelia permettant d'avoir un Thelia de test vite opérationnel.</description>
|
||||
<postscriptum></postscriptum>
|
||||
</descriptif>
|
||||
<version>1.1</version>
|
||||
<auteur>
|
||||
<nom>Manuel Raynaud - mraynaud@openstudio.fr</nom>
|
||||
<societe></societe>
|
||||
<email></email>
|
||||
<web></web>
|
||||
</auteur>
|
||||
<type>classique</type>
|
||||
<prerequis/>
|
||||
<thelia>1.5.0</thelia>
|
||||
<etat>production</etat>
|
||||
<documentation>README.TXT</documentation>
|
||||
<urlmiseajour></urlmiseajour>
|
||||
</module>
|
||||
Reference in New Issue
Block a user