protected function execute(InputInterface $input, OutputInterface $output)
{
$this->moduleName = $input->getArgument('name');
$this->moduleDir = $this->modulesDir . DIRECTORY_SEPARATOR . $this->moduleName;
// Acquire Module Information
$this->askQuestions($input, $output);
$this->createModuleStructure($this->moduleDir, $this->moduleName);
$output->writeln("<info>Created module successfully</info>");
$output->writeln("Name: <info>{$this->moduleName}</info>");
$output->writeln(sprintf("Path: <info>%s</info>", $this->moduleDir));
// Copy the core files
$this->copyFiles($this->skeletonModuleDir, $this->moduleDir, $this->coreFiles);
$tokenizedFiles = $this->getTokenizedCoreFiles();
$tokens = [];
$tokens['[MODULE_NAME]'] = $this->moduleName;
if (null !== $this->tplEngine && $this->isValidTemplatingEngine($this->tplEngine)) {
$this->processTemplatingFiles();
$output->writeln(sprintf("Templating: <info>%s</info>", $this->tplEngine));
}
if ($this->isValidRoutingEngine($this->routingEngine)) {
$this->processRoutingFiles($tokenizedFiles, $tokens);
$output->writeln(sprintf("Router: <info>%s</info>", $this->routingEngine));
} else {
$tokens['ROUTING_TRAIT'] = '';
}
// replace tokens from specified tokenizable files
$this->replaceTokensInFiles($this->moduleDir, $tokenizedFiles, $tokens);
$output->writeln("<comment>This module is not enabled. Enable it in <info>config[modules]</info> key</comment>");
$this->checkEnabledTemplatingEngines($input, $output);
$this->checkEnabledRouters($input, $output);
}