diff --git a/composer.lock b/composer.lock
index 455d88ca9..0e44951da 100755
--- a/composer.lock
+++ b/composer.lock
@@ -206,12 +206,12 @@
"source": {
"type": "git",
"url": "https://github.com/propelorm/Propel2.git",
- "reference": "1781303780ee496eadebedcb8c4636e728b6ea65"
+ "reference": "4cf5fca150ed93b33dc54206e3d9d943d0712621"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/propelorm/Propel2/zipball/1781303780ee496eadebedcb8c4636e728b6ea65",
- "reference": "1781303780ee496eadebedcb8c4636e728b6ea65",
+ "url": "https://api.github.com/repos/propelorm/Propel2/zipball/4cf5fca150ed93b33dc54206e3d9d943d0712621",
+ "reference": "4cf5fca150ed93b33dc54206e3d9d943d0712621",
"shasum": ""
},
"require": {
@@ -258,7 +258,7 @@
"orm",
"persistence"
],
- "time": "2013-07-05 09:02:18"
+ "time": "2013-07-10 11:32:06"
},
{
"name": "psr/log",
diff --git a/core/lib/Thelia/Command/ModuleGenerateCommand.php b/core/lib/Thelia/Command/ModuleGenerateCommand.php
new file mode 100644
index 000000000..5d54cf55e
--- /dev/null
+++ b/core/lib/Thelia/Command/ModuleGenerateCommand.php
@@ -0,0 +1,114 @@
+. */
+/* */
+/*************************************************************************************/
+namespace Thelia\Command;
+
+
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Filesystem\Filesystem;
+
+class ModuleGenerateCommand extends ContainerAwareCommand {
+
+ protected $module;
+ protected $moduleDirectory;
+
+ private $reservedKeyWords = array(
+ "thelia"
+ );
+
+ private $neededDirectories = array(
+ "Config",
+ "Model",
+ "Loop"
+ );
+
+ protected function configure()
+ {
+ $this
+ ->setName("module:generate")
+ ->setDescription("generate all needed files for creating a new Module")
+ ->addArgument(
+ "name" ,
+ InputArgument::REQUIRED,
+ "name wanted for your Module"
+ )
+ ;
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ $this->module = $this->formatModuleName($input->getArgument("name"));
+ $this->moduleDirectory = THELIA_MODULE_DIR . DIRECTORY_SEPARATOR . $this->module;
+ $this->verifyExistingModule();
+
+ $this->createDirectories();
+ $this->createFiles();
+ }
+
+ private function createDirectories()
+ {
+ $fs = new Filesystem();
+
+ $fs->mkdir($this->moduleDirectory);
+
+ foreach ($this->neededDirectories as $directory) {
+ $fs->mkdir($this->moduleDirectory . DIRECTORY_SEPARATOR . $directory);
+ }
+
+ }
+
+ private function createFiles()
+ {
+ $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");
+
+ $classContent = file_get_contents($skeletonDir . "Class.php");
+
+ $classContent = str_replace("%%CLASSNAME%%", $this->module, $classContent);
+ $classContent = str_replace("%%NAMESPACE%%", $this->module, $classContent);
+
+ file_put_contents($this->moduleDirectory . DIRECTORY_SEPARATOR . $this->module.".php", $classContent);
+
+ $schemaContent = file_get_contents($skeletonDir . "schema.xml");
+
+ $schemaContent = str_replace("%%CONFIG_DIR%%", THELIA_CONF_DIR, $schemaContent);
+
+ file_put_contents($this->moduleDirectory . DIRECTORY_SEPARATOR . "Config". DIRECTORY_SEPARATOR . "schema.xml", $schemaContent);
+ }
+
+
+ private function verifyExistingModule()
+ {
+ if (file_exists($this->moduleDirectory)) {
+ throw new \RuntimeException(sprintf("%s module already exists", $this->module));
+ }
+ }
+
+ private function formatModuleName($name)
+ {
+ return ucfirst($name);
+ }
+}
\ No newline at end of file
diff --git a/core/lib/Thelia/Command/Skeleton/Module/Class.php b/core/lib/Thelia/Command/Skeleton/Module/Class.php
new file mode 100644
index 000000000..ccf061a48
--- /dev/null
+++ b/core/lib/Thelia/Command/Skeleton/Module/Class.php
@@ -0,0 +1,36 @@
+. */
+/* */
+/*************************************************************************************/
+
+
+namespace %%NAMESPACE%%;
+
+use Thelia\Module\BaseModule;
+
+class %%CLASSNAME%% extends BaseModule
+{
+ /**
+ * YOU HAVE TO IMPLEMENT HERE ABSTRACT METHODD FROM BaseModule Class
+ * Like install and destroy
+ */
+
+}
diff --git a/core/lib/Thelia/Command/Skeleton/Module/config.xml b/core/lib/Thelia/Command/Skeleton/Module/config.xml
new file mode 100644
index 000000000..2430f5027
--- /dev/null
+++ b/core/lib/Thelia/Command/Skeleton/Module/config.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/core/lib/Thelia/Command/Skeleton/Module/plugin.xml b/core/lib/Thelia/Command/Skeleton/Module/plugin.xml
new file mode 100644
index 000000000..e69de29bb
diff --git a/core/lib/Thelia/Command/Skeleton/Module/schema.xml b/core/lib/Thelia/Command/Skeleton/Module/schema.xml
new file mode 100644
index 000000000..1ef803d36
--- /dev/null
+++ b/core/lib/Thelia/Command/Skeleton/Module/schema.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/core/lib/Thelia/Config/Resources/config.xml b/core/lib/Thelia/Config/Resources/config.xml
index dee0b57b6..e70756adb 100755
--- a/core/lib/Thelia/Config/Resources/config.xml
+++ b/core/lib/Thelia/Config/Resources/config.xml
@@ -34,6 +34,7 @@
+
diff --git a/core/lib/Thelia/Module/BaseModule.php b/core/lib/Thelia/Module/BaseModule.php
new file mode 100644
index 000000000..14777d331
--- /dev/null
+++ b/core/lib/Thelia/Module/BaseModule.php
@@ -0,0 +1,43 @@
+. */
+/* */
+/*************************************************************************************/
+
+namespace Thelia\Module;
+
+abstract class BaseModule
+{
+
+ public function __construct()
+ {
+
+ }
+
+ protected function activate()
+ {
+
+ }
+
+ abstract public function install();
+ abstract public function destroy();
+
+}
\ No newline at end of file