From e5c774788410f76df764f4d043d430773d568975 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ste=CC=81phane=20Goetz?= Date: Thu, 17 Nov 2016 17:02:12 +0100 Subject: [PATCH] Allow to use Processors through the new CLI --- composer.json | 1 - libs/Console/Serve.php | 17 +--------------- libs/bootstrap.php | 46 ++++++++++++++++++++++++++++++------------ 3 files changed, 34 insertions(+), 30 deletions(-) diff --git a/composer.json b/composer.json index 2428cae7..fa51794d 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,6 @@ }, "autoload": { "psr-4": { - "Todaymade\\Daux\\Extension\\": "daux/", "Todaymade\\Daux\\": "libs/" } }, diff --git a/libs/Console/Serve.php b/libs/Console/Serve.php index b782fa86..602e4800 100755 --- a/libs/Console/Serve.php +++ b/libs/Console/Serve.php @@ -17,7 +17,6 @@ protected function configure() ->setName('serve') ->setDescription('Serve documentation') - ->addOption('configuration', 'c', InputOption::VALUE_REQUIRED, 'Configuration file') ->addOption('source', 's', InputOption::VALUE_REQUIRED, 'Where to take the documentation from') ->addOption('processor', 'p', InputOption::VALUE_REQUIRED, 'Manipulations on the tree') @@ -44,9 +43,7 @@ protected function execute(InputInterface $input, OutputInterface $output) putenv('DAUX_SOURCE=' . $daux->getParams()->getDocumentationDirectory()); putenv('DAUX_THEME=' . $daux->getParams()->getThemesPath()); putenv('DAUX_CONFIGURATION=' . $daux->getParams()->getConfigurationOverrideFile()); - - //TODO :: support processor - //putenv('DAUX_PROCESSOR=' . $daux->getParams()->getProcessorFile()); + putenv('DAUX_EXTENSION=' . DAUX_EXTENSION); $base = ProcessUtils::escapeArgument(__DIR__ . '/../../'); $binary = ProcessUtils::escapeArgument((new PhpExecutableFinder)->find(false)); @@ -63,16 +60,4 @@ protected function execute(InputInterface $input, OutputInterface $output) passthru("{$binary} -S {$host}:{$port} {$base}/index.php"); } } - - protected function prepareProcessor(Daux $daux, InputInterface $input, OutputInterface $output, $width) - { - if ($input->getOption('processor')) { - $daux->getParams()['processor'] = $input->getOption('processor'); - } - - $class = $daux->getProcessorClass(); - if (!empty($class)) { - $daux->setProcessor(new $class($daux, $output, $width)); - } - } } diff --git a/libs/bootstrap.php b/libs/bootstrap.php index ad0260ab..622691cb 100644 --- a/libs/bootstrap.php +++ b/libs/bootstrap.php @@ -1,20 +1,40 @@ setPsr4("Todaymade\\Daux\\Extension\\", $ext); +}