A generated module works now out of the box (no need to update
module.xml)
This commit is contained in:
@@ -84,9 +84,18 @@ class ModuleGenerateCommand extends BaseModuleGenerate
|
|||||||
private function createFiles()
|
private function createFiles()
|
||||||
{
|
{
|
||||||
$fs = new Filesystem();
|
$fs = new Filesystem();
|
||||||
|
|
||||||
|
try {
|
||||||
$skeletonDir = str_replace("/", DIRECTORY_SEPARATOR, THELIA_ROOT . "/core/lib/Thelia/Command/Skeleton/Module/");
|
$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 . "config.xml", $this->moduleDirectory . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "config.xml");
|
||||||
$fs->copy($skeletonDir . "module.xml", $this->moduleDirectory . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "module.xml");
|
|
||||||
|
$moduleContent = file_get_contents($skeletonDir . "module.xml");
|
||||||
|
|
||||||
|
$moduleContent = str_replace("%%CLASSNAME%%", $this->module, $moduleContent);
|
||||||
|
$moduleContent = str_replace("%%NAMESPACE%%", $this->module, $moduleContent);
|
||||||
|
|
||||||
|
file_put_contents($this->moduleDirectory . DIRECTORY_SEPARATOR . "Config". DIRECTORY_SEPARATOR . "module.xml", $moduleContent);
|
||||||
|
|
||||||
$classContent = file_get_contents($skeletonDir . "Class.php");
|
$classContent = file_get_contents($skeletonDir . "Class.php");
|
||||||
|
|
||||||
@@ -102,5 +111,11 @@ class ModuleGenerateCommand extends BaseModuleGenerate
|
|||||||
|
|
||||||
file_put_contents($this->moduleDirectory . DIRECTORY_SEPARATOR . "Config". DIRECTORY_SEPARATOR . "schema.xml", $schemaContent);
|
file_put_contents($this->moduleDirectory . DIRECTORY_SEPARATOR . "Config". DIRECTORY_SEPARATOR . "schema.xml", $schemaContent);
|
||||||
}
|
}
|
||||||
|
catch (\Exception $ex) {
|
||||||
|
$fs->remove($this->moduleDirectory);
|
||||||
|
|
||||||
|
throw $ex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<module>
|
<module>
|
||||||
<fullnamespace></fullnamespace>
|
<fullnamespace>%%NAMESPACE%%\%%CLASSNAME%%</fullnamespace>
|
||||||
<descriptive locale="en_US">
|
<descriptive locale="en_US">
|
||||||
<title></title>
|
<title>Automatically generated module - please update module.xml file</title>
|
||||||
</descriptive>
|
</descriptive>
|
||||||
<descriptive locale="fr_FR">
|
<descriptive locale="fr_FR">
|
||||||
<title></title>
|
<title>Module généré autromatiquement - editez le fichier module.xml</title>
|
||||||
</descriptive>
|
</descriptive>
|
||||||
<version></version>
|
<version></version>
|
||||||
<author>
|
<author>
|
||||||
<name></name>
|
<name></name>
|
||||||
<email></email>
|
<email></email>
|
||||||
</author>
|
</author>
|
||||||
<type></type>
|
<type>classic</type>
|
||||||
<thelia></thelia>
|
<thelia>2.0.0</thelia>
|
||||||
<stability></stability>
|
<stability>other</stability>
|
||||||
</module>
|
</module>
|
||||||
Reference in New Issue
Block a user