Allow to use Processors through the new CLI
Dieser Commit ist enthalten in:
Ursprung
2d451be104
Commit
e5c7747884
@ -26,7 +26,6 @@
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Todaymade\\Daux\\Extension\\": "daux/",
|
||||
"Todaymade\\Daux\\": "libs/"
|
||||
}
|
||||
},
|
||||
|
@ -17,7 +17,6 @@ class Serve extends DauxCommand
|
||||
->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 @@ class Serve extends DauxCommand
|
||||
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 @@ class Serve extends DauxCommand
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +1,40 @@
|
||||
<?php
|
||||
|
||||
// Loaded as a dependency
|
||||
if (file_exists(__DIR__ . '/../../../autoload.php')) {
|
||||
return require_once __DIR__ . '/../../../autoload.php';
|
||||
function loadApp() {
|
||||
// Loaded as a dependency
|
||||
if (file_exists(__DIR__ . '/../../../autoload.php')) {
|
||||
return require_once __DIR__ . '/../../../autoload.php';
|
||||
}
|
||||
|
||||
// Loaded in the project itself
|
||||
if (file_exists(__DIR__ . '/../vendor/autoload.php')) {
|
||||
return require_once __DIR__ . '/../vendor/autoload.php';
|
||||
}
|
||||
|
||||
// Loaded in the project itself, when vendor isn't installed
|
||||
if (file_exists(__DIR__ . '/../daux.phar')) {
|
||||
define('PHAR_DIR', __DIR__ . '/..');
|
||||
|
||||
return require_once 'phar://' . __DIR__ . '/../daux.phar/vendor/autoload.php';
|
||||
}
|
||||
|
||||
throw new Exception('Impossible to load Daux, missing vendor/ or daux.phar');
|
||||
}
|
||||
|
||||
// Loaded in the project itself
|
||||
if (file_exists(__DIR__ . '/../vendor/autoload.php')) {
|
||||
return require_once __DIR__ . '/../vendor/autoload.php';
|
||||
$loader = loadApp();
|
||||
|
||||
if ($loader) {
|
||||
$ext = __DIR__ . '/../daux';
|
||||
if (is_dir(getcwd() . "/daux")) {
|
||||
$ext = getcwd() . "/daux";
|
||||
}
|
||||
|
||||
$env = getenv('DAUX_EXTENSION');
|
||||
if ($env && is_dir($env)) {
|
||||
$ext = $env;
|
||||
}
|
||||
|
||||
define('DAUX_EXTENSION', $ext);
|
||||
|
||||
$loader->setPsr4("Todaymade\\Daux\\Extension\\", $ext);
|
||||
}
|
||||
|
||||
// Loaded in the project itself, when vendor isn't installed
|
||||
if (file_exists(__DIR__ . '/../daux.phar')) {
|
||||
define('PHAR_DIR', __DIR__ . '/..');
|
||||
|
||||
return require_once 'phar://' . __DIR__ . '/../daux.phar/vendor/autoload.php';
|
||||
}
|
||||
|
||||
throw new Exception('Impossible to load Daux, missing vendor/ or daux.phar');
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren