Initial commit
This commit is contained in:
174
src/Command/Base/BaseCommand.php
Normal file
174
src/Command/Base/BaseCommand.php
Normal file
@@ -0,0 +1,174 @@
|
||||
<?php
|
||||
/**
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 magdev
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author magdev
|
||||
* @copyright 2018 Marco Grätsch
|
||||
* @package magdev/dossier
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
*/
|
||||
|
||||
namespace Magdev\Dossier\Command\Base;
|
||||
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
|
||||
/**
|
||||
* Base command
|
||||
*
|
||||
* @author magdev
|
||||
*/
|
||||
class BaseCommand extends Command
|
||||
{
|
||||
/**
|
||||
* Configuration service
|
||||
* @var \Magdev\Dossier\Service\ConfigService
|
||||
*/
|
||||
protected $config = null;
|
||||
|
||||
/**
|
||||
* Translator service
|
||||
* @var \Magdev\Dossier\Service\TranslatorService
|
||||
*/
|
||||
protected $translator = null;
|
||||
|
||||
/**
|
||||
* Monolog Service
|
||||
* @var \Magdev\Dossier\Service\MonologService
|
||||
*/
|
||||
protected $logger = null;
|
||||
|
||||
/**
|
||||
* The IO-Style object
|
||||
* @var \Magdev\Dossier\Style\DossierStyle
|
||||
*/
|
||||
protected $io = null;
|
||||
|
||||
|
||||
/**
|
||||
* Write the application header
|
||||
*
|
||||
* @param \Symfony\Component\Console\Output\OutputInterface $output
|
||||
* @return \Magdev\Dossier\BaseCommand\Base\BaseCommand
|
||||
* @deprecated
|
||||
*/
|
||||
protected function writeHeader(OutputInterface $output): BaseCommand
|
||||
{
|
||||
$this->getService('output_helper')
|
||||
->setOutput($output)
|
||||
->writeApplicationHeader();
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a service from the container
|
||||
*
|
||||
* @param string $name
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getService(string $name)
|
||||
{
|
||||
return $this->getApplication()->getService($name);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::configure()
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this->addOption('no-header', 'N', InputOption::VALUE_NONE, 'Suppress header <option>(format=table)</>');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\BaseCommand\Command::initialize()
|
||||
*/
|
||||
protected function initialize(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$this->config = $this->getService('config');
|
||||
$this->logger = $this->getService('monolog');
|
||||
|
||||
$locale = $this->config->get('translator.locale', 'en');
|
||||
if ($input->hasOption('locale')) {
|
||||
$locale = $input->getOption('locale');
|
||||
}
|
||||
$this->translator = $this->getService('translator')->setLocale($locale);
|
||||
|
||||
$this->io = $this->getHelper('output')
|
||||
->getIoStyle($input, $output);
|
||||
|
||||
if (!$input->hasOption('no-header') || !$input->getOption('no-header')) {
|
||||
$this->io->header($this->translator->trans('app.header'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Log and output debug messages
|
||||
*
|
||||
* @param string $message
|
||||
* @return \Magdev\Dossier\Command\Base\BaseCommand
|
||||
*/
|
||||
protected function debugLog(string $message): BaseCommand
|
||||
{
|
||||
$this->logger->debug($message);
|
||||
$this->io->debug($message);
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Log and output error messages
|
||||
*
|
||||
* @param string $message
|
||||
* @return \Magdev\Dossier\Command\Base\BaseCommand
|
||||
*/
|
||||
protected function errorLog(string $message): BaseCommand
|
||||
{
|
||||
$this->logger->error($message);
|
||||
$this->io->error($message);
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Log and output warnings
|
||||
*
|
||||
* @param string $message
|
||||
* @return \Magdev\Dossier\Command\Base\BaseCommand
|
||||
*/
|
||||
protected function warningLog(string $message): BaseCommand
|
||||
{
|
||||
$this->logger->warning($message);
|
||||
$this->io->warning($message);
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
75
src/Command/Cache/CacheClearCommand.php
Normal file
75
src/Command/Cache/CacheClearCommand.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/**
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 magdev
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author magdev
|
||||
* @copyright 2018 Marco Grätsch
|
||||
* @package magdev/dossier
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
*/
|
||||
|
||||
namespace Magdev\Dossier\Command\Cache;
|
||||
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Magdev\Dossier\Command\Base\BaseCommand;
|
||||
|
||||
class CacheClearCommand extends BaseCommand
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::configure()
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('cache:clear')
|
||||
->setDescription('Clear the cache');
|
||||
|
||||
parent::configure();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Magdev\Dossier\Command\Base\BaseCommand::initialize()
|
||||
*/
|
||||
protected function initialize(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$input->setOption('no-header', true);
|
||||
parent::initialize($input, $output);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::execute()
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
if (DOSSIER_CACHE && DOSSIER_CACHE != '/' && is_dir(DOSSIER_CACHE)) {
|
||||
system('rm -rf '.DOSSIER_CACHE.' 2>&1 >> /dev/null');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
139
src/Command/Config/ConfigGetCommand.php
Normal file
139
src/Command/Config/ConfigGetCommand.php
Normal file
@@ -0,0 +1,139 @@
|
||||
<?php
|
||||
/**
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 magdev
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author magdev
|
||||
* @copyright 2018 Marco Grätsch
|
||||
* @package magdev/dossier
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
*/
|
||||
|
||||
namespace Magdev\Dossier\Command\Config;
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Helper\Table;
|
||||
use Magdev\Dossier\Command\Base\BaseCommand;
|
||||
|
||||
/**
|
||||
* Get a configuration value
|
||||
*
|
||||
* @author magdev
|
||||
*/
|
||||
class ConfigGetCommand extends BaseCommand
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::configure()
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('config:get')
|
||||
->setDescription('Get a configuration value')
|
||||
->addArgument('path', InputArgument::REQUIRED, 'Configuration path')
|
||||
|
||||
->addOption('format', 'f', InputOption::VALUE_OPTIONAL, 'Output format (table|yaml|json|php)', 'table')
|
||||
->addOption('plain', 'p', InputOption::VALUE_NONE, 'Show the value only <option>(implies --no-header)</>')
|
||||
|
||||
->addOption('include-return', 'R', InputOption::VALUE_NONE, 'Include return statement <option>(format=php)</>')
|
||||
->addOption('include-tags', 'T', InputOption::VALUE_NONE, 'Include PHP tags <option>(format=php)</>')
|
||||
|
||||
->addOption('pretty', 'P', InputOption::VALUE_NONE, 'JSON pretty print <option>(format=json)</>')
|
||||
|
||||
->addOption('indent', 'i', InputOption::VALUE_OPTIONAL, 'Indentation width <option>(format=yaml)</>', 2)
|
||||
->addOption('depth', 'd', InputOption::VALUE_OPTIONAL, 'Render depth before switching to inline YAML <option>(format=yaml)</>', 3);
|
||||
|
||||
parent::configure();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::initialize()
|
||||
*/
|
||||
protected function initialize(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$input->setOption('no-header', $input->getOption('plain'));
|
||||
parent::initialize($input, $output);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::execute()
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$export = $this->getHelper('export');
|
||||
/* @var $export \Magdev\Dossier\Helper\ExportHelper */
|
||||
|
||||
$path = $input->getArgument('path');
|
||||
$value = $this->config->get($path);
|
||||
|
||||
if ($input->getOption('plain')) {
|
||||
$this->io->write($value);
|
||||
exit;
|
||||
}
|
||||
|
||||
switch ($input->getOption('format')) {
|
||||
case 'yaml':
|
||||
$this->io->write($export->toYAML(
|
||||
$this->config->getConfig()->all(),
|
||||
(int) $input->getOption('depth'),
|
||||
(int) $input->getOption('indent')
|
||||
));
|
||||
break;
|
||||
|
||||
case 'json':
|
||||
$this->io->write($export->toJSON(
|
||||
$this->config->getConfig()->all(),
|
||||
(bool) $input->getOption('pretty')
|
||||
));
|
||||
break;
|
||||
|
||||
case 'php':
|
||||
$this->io->write($export->toPHP(
|
||||
$this->config->getConfig()->all(),
|
||||
(bool) $input->getOption('include-return'),
|
||||
(bool) $input->getOption('include-tags')
|
||||
));
|
||||
break;
|
||||
|
||||
default:
|
||||
$global = $this->io->bool($this->config->isGlobalConfig($path, $value));
|
||||
$this->io->writeln(array(
|
||||
' '.$this->translator->trans('info.debug_mode').': '.$this->io->debugStatus(),
|
||||
' '.$this->translator->trans('info.environment').': '.$this->io->environment()
|
||||
));
|
||||
$this->io->newLine();
|
||||
$this->io->table(
|
||||
array('Path', 'Value', 'Global'),
|
||||
array(array($path, $value, $this->io->align($global, 6)))
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
85
src/Command/Config/ConfigSetCommand.php
Normal file
85
src/Command/Config/ConfigSetCommand.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
/**
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 magdev
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author magdev
|
||||
* @copyright 2018 Marco Grätsch
|
||||
* @package magdev/dossier
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
*/
|
||||
|
||||
namespace Magdev\Dossier\Command\Config;
|
||||
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Helper\Table;
|
||||
use Magdev\Dossier\Command\Base\BaseCommand;
|
||||
|
||||
|
||||
/**
|
||||
* Set a configuration value
|
||||
*
|
||||
* @author magdev
|
||||
*/
|
||||
class ConfigSetCommand extends BaseCommand
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::configure()
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('config:set')
|
||||
->setDescription('Set a configuration value')
|
||||
->addOption('global', 'g', InputOption::VALUE_NONE, 'Set in global configuration')
|
||||
->addArgument('path', InputArgument::REQUIRED, 'Configuration path in dot-notation')
|
||||
->addArgument('value', InputArgument::REQUIRED, 'Configuration value');
|
||||
|
||||
parent::configure();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::execute()
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$global = (bool) $input->getOption('global');
|
||||
$path = $input->getArgument('path');
|
||||
$value = $input->getArgument('value');
|
||||
|
||||
$this->config->set($path, $value, $global)->save();
|
||||
$this->io->table(array('Path', 'Value', 'Global'), array(
|
||||
array(
|
||||
$path,
|
||||
$this->config->get($path),
|
||||
$this->io->align($this->io->bool($this->config->isGlobalConfig($path, $value)), 6)
|
||||
)
|
||||
));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
131
src/Command/Config/ConfigShowCommand.php
Normal file
131
src/Command/Config/ConfigShowCommand.php
Normal file
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
/**
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 magdev
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author magdev
|
||||
* @copyright 2018 Marco Grätsch
|
||||
* @package magdev/dossier
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
*/
|
||||
|
||||
namespace Magdev\Dossier\Command\Config;
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Helper\Table;
|
||||
use Magdev\Dossier\Service\ConfigService;
|
||||
use Magdev\Dossier\Command\Base\BaseCommand;
|
||||
|
||||
/**
|
||||
* Show the full configuration
|
||||
*
|
||||
* @author magdev
|
||||
*/
|
||||
class ConfigShowCommand extends BaseCommand
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::configure()
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('config:show')
|
||||
->setDescription('Show or export the full configuration')
|
||||
|
||||
->addOption('format', 'f', InputOption::VALUE_OPTIONAL, 'Output format (table|yaml|json|php)', 'table')
|
||||
->addOption('return', 'r', InputOption::VALUE_NONE, 'PHP: Include return statement')
|
||||
->addOption('tags', 't', InputOption::VALUE_NONE, 'PHP: Include PHP tags')
|
||||
->addOption('pretty', 'p', InputOption::VALUE_NONE, 'JSON: Output pretty printed')
|
||||
->addOption('indent', 'i', InputOption::VALUE_OPTIONAL, 'YAML: Indentation width', 2)
|
||||
->addOption('depth', 'd', InputOption::VALUE_OPTIONAL, 'YAML: Render depth before switching to inline YAML', 3);
|
||||
|
||||
parent::configure();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::initialize()
|
||||
*/
|
||||
protected function initialize(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
if ($input->getOption('format') != 'table') {
|
||||
$input->setOption('no-header', true);
|
||||
}
|
||||
parent::initialize($input, $output);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::execute()
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$export = $this->getHelper('export');
|
||||
/* @var $export \Magdev\Dossier\Helper\ExportHelper */
|
||||
|
||||
switch ($input->getOption('format')) {
|
||||
case 'yaml':
|
||||
$this->io->write($export->toYAML(
|
||||
$this->config->getConfig()->all(),
|
||||
(int) $input->getOption('depth'),
|
||||
(int) $input->getOption('indent')
|
||||
));
|
||||
break;
|
||||
|
||||
case 'json':
|
||||
$this->io->write($export->toJSON(
|
||||
$this->config->getConfig()->all(),
|
||||
(bool) $input->getOption('pretty')
|
||||
));
|
||||
break;
|
||||
|
||||
case 'php':
|
||||
$this->io->write($export->toPHP(
|
||||
$this->config->getConfig()->all(),
|
||||
(bool) $input->getOption('include-return'),
|
||||
(bool) $input->getOption('include-tags')
|
||||
));
|
||||
break;
|
||||
|
||||
default:
|
||||
$outHelper = $this->getHelper('output');
|
||||
/* @var $outHelper \Magdev\Dossier\Helper\OutputHelper */
|
||||
|
||||
$this->io->newLine();
|
||||
$this->io->writeln(array(
|
||||
' '.$this->translator->trans('info.debug_mode').': '.$this->io->debugStatus(),
|
||||
' '.$this->translator->trans('info.environment').': '.$this->io->environment()
|
||||
));
|
||||
$this->io->newLine();
|
||||
$this->io->table(
|
||||
array('Path', 'Value', 'Global'),
|
||||
$this->config->allTable($this->io, 6)
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
73
src/Command/Config/ConfigUnsetCommand.php
Normal file
73
src/Command/Config/ConfigUnsetCommand.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/**
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 magdev
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author magdev
|
||||
* @copyright 2018 Marco Grätsch
|
||||
* @package magdev/dossier
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
*/
|
||||
|
||||
namespace Magdev\Dossier\Command\Config;
|
||||
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Helper\Table;
|
||||
use Magdev\Dossier\Command\Base\BaseCommand;
|
||||
|
||||
|
||||
/**
|
||||
* Set a configuration value
|
||||
*
|
||||
* @author magdev
|
||||
*/
|
||||
class ConfigUnsetCommand extends BaseCommand
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::configure()
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('config:unset')
|
||||
->setDescription('Unset a configuration value')
|
||||
->addArgument('path', InputArgument::REQUIRED, 'Configuration path in dot-notation');
|
||||
|
||||
parent::configure();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::execute()
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$path = $input->getArgument('path');
|
||||
$this->config->unset($path)->save();
|
||||
|
||||
$this->io->success($this->translator->trans('message.config.deleted', array('%path%' => $path)));
|
||||
}
|
||||
}
|
||||
|
||||
124
src/Command/Cv/CvAddCommand.php
Normal file
124
src/Command/Cv/CvAddCommand.php
Normal file
@@ -0,0 +1,124 @@
|
||||
<?php
|
||||
/**
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 magdev
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author magdev
|
||||
* @copyright 2018 Marco Grätsch
|
||||
* @package magdev/dossier
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
*/
|
||||
|
||||
namespace Magdev\Dossier\Command\Cv;
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Exception\RuntimeException;
|
||||
use Droath\ConsoleForm\Exception\FormException;
|
||||
use Magdev\Dossier\Command\Base\BaseCommand;
|
||||
|
||||
/**
|
||||
* Write a new CV entry
|
||||
*
|
||||
* @author magdev
|
||||
*/
|
||||
final class CvAddCommand extends BaseCommand
|
||||
{
|
||||
/**
|
||||
* TheCV Form
|
||||
* @var \Magdev\Dossier\Form\Extension\Form
|
||||
*/
|
||||
protected $form = null;
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::configure()
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('cv:add')
|
||||
->setDescription('Write a new CV entry')
|
||||
->addArgument('name', InputArgument::REQUIRED, 'Choose the name of the entry')
|
||||
->addOption('review', 'r', InputOption::VALUE_NONE, 'Review file in editor');
|
||||
|
||||
parent::configure();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Magdev\Dossier\Command\BaseCommand::initialize()
|
||||
*/
|
||||
protected function initialize(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
try {
|
||||
$this->form = $this->getHelper('form')->getFormByName('form.cv', $input, $output);
|
||||
parent::initialize($input, $output);
|
||||
} catch (FormException $fe) {
|
||||
throw new RuntimeException(get_class($fe).': '.$fe->getMessage(), $fe->getCode(), $fe);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::interact()
|
||||
*/
|
||||
protected function interact(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$this->io->title($this->translator->trans('form.cv.header.add'));
|
||||
$this->io->newLine();
|
||||
$this->form->process();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::execute()
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
if ($this->form->isProcessed()) {
|
||||
$markdown = $this->getService('markdown');
|
||||
/* @var $markdown \Magdev\Dossier\Service\MarkdownService */
|
||||
|
||||
try {
|
||||
$text = $this->form->stripData('text', '');
|
||||
$name = $input->getArgument('name');
|
||||
|
||||
$markdown->save(PROJECT_ROOT.'/cv/'.$name.'.md', $this->form->getResults(), $text, false);
|
||||
$this->io->success($this->translator->trans('message.write.success', array(
|
||||
'%name%' => 'CV/'.ucfirst($name)
|
||||
)));
|
||||
|
||||
if ($input->getOption('review') != false) {
|
||||
$this->getService('uri_helper')->openFileInEditor(PROJECT_ROOT.'/cv/'.$name.'.md');
|
||||
}
|
||||
} catch (FormException $fe) {
|
||||
throw new RuntimeException(get_class($fe).': '.$fe->getMessage(), $fe->getCode(), $fe);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
70
src/Command/Cv/CvEditCommand.php
Normal file
70
src/Command/Cv/CvEditCommand.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
/**
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 magdev
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author magdev
|
||||
* @copyright 2018 Marco Grätsch
|
||||
* @package magdev/dossier
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
*/
|
||||
|
||||
namespace Magdev\Dossier\Command\Cv;
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Exception\RuntimeException;
|
||||
use Magdev\Dossier\Command\Base\BaseCommand;
|
||||
|
||||
class CvEditCommand extends BaseCommand
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::configure()
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('cv:edit')
|
||||
->setDescription('Edit a CV entry in your default editor')
|
||||
->addArgument('file', InputArgument::REQUIRED, 'Filename of the entry w/o extension');
|
||||
|
||||
parent::configure();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::configure()
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$file = PROJECT_ROOT.'/cv/'.$input->getArgument('file').'.md';
|
||||
|
||||
if (!file_exists($file)) {
|
||||
throw new RuntimeException('File '.$file.' not found');
|
||||
}
|
||||
|
||||
$this->getService('uri_helper')->openFileInEditor($file);
|
||||
}
|
||||
}
|
||||
|
||||
66
src/Command/Dev/PharExtractCommand.php
Normal file
66
src/Command/Dev/PharExtractCommand.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/**
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 magdev
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author magdev
|
||||
* @copyright 2018 Marco Grätsch
|
||||
* @package magdev/dossier
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
*/
|
||||
|
||||
namespace Magdev\Dossier\Command\Dev;
|
||||
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Magdev\Dossier\Command\Base\BaseCommand;
|
||||
|
||||
class PharExtractCommand extends BaseCommand
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::configure()
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('dev:phar:extract')
|
||||
->setHidden(!getenv('APP_DEBUG'))
|
||||
->setDescription('Extract the Phar archive')
|
||||
->addOption('target', 'd', InputOption::VALUE_OPTIONAL, 'Target directory', getcwd().'/_phar');
|
||||
|
||||
parent::configure();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::execute()
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$targetDir = $input->getOption('target');
|
||||
$this->getService('phar_helper')->extractArchive($targetDir);
|
||||
}
|
||||
}
|
||||
|
||||
133
src/Command/Dossier/DossierBuildCommand.php
Normal file
133
src/Command/Dossier/DossierBuildCommand.php
Normal file
@@ -0,0 +1,133 @@
|
||||
<?php
|
||||
/**
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 magdev
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author magdev
|
||||
* @copyright 2018 Marco Grätsch
|
||||
* @package magdev/dossier
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
*/
|
||||
|
||||
namespace Magdev\Dossier\Command\Dossier;
|
||||
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Magdev\Dossier\Model\CurriculumVitae;
|
||||
use Magdev\Dossier\Model\Person;
|
||||
use Magdev\Dossier\Model\Intro;
|
||||
use Magdev\Dossier\Model\Letter;
|
||||
use Magdev\Dossier\Command\Base\BaseCommand;
|
||||
use Magdev\Dossier\Util\DataCollector;
|
||||
|
||||
/**
|
||||
* Generate your dossier
|
||||
*
|
||||
* @author magdev
|
||||
*/
|
||||
final class DossierBuildCommand extends BaseCommand
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::configure()
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('dossier:build')
|
||||
->setDescription('Create a dossier from a set of Markdown files')
|
||||
|
||||
->addOption('review', 'r', InputOption::VALUE_NONE, 'Review created file')
|
||||
->addOption('pdf', 'p', InputOption::VALUE_NONE, 'Convert to PDF (requires PDFShift API-Key)')
|
||||
->addOption('locale', 'l', InputOption::VALUE_OPTIONAL, 'Set the locale', 'de')
|
||||
->addOption('sort', 's', InputOption::VALUE_OPTIONAL, 'Set the sort direction for the CV', CurriculumVitae::SORT_DESC)
|
||||
->addOption('theme', 't', InputOption::VALUE_OPTIONAL, 'Select the theme', 'print')
|
||||
->addOption('docname', 'd', InputOption::VALUE_OPTIONAL, 'Set the name for the output document (w/o extension)', 'dossier')
|
||||
|
||||
->addOption('no-cover', null, InputOption::VALUE_NONE, 'Suppress the cover')
|
||||
->addOption('no-intro', null, InputOption::VALUE_NONE, 'Suppress the introduction')
|
||||
->addOption('no-resume', null, InputOption::VALUE_NONE, 'Suppress the resume')
|
||||
->addOption('no-cv', null, InputOption::VALUE_NONE, 'Suppress the curriculum vitae')
|
||||
->addOption('no-projects', null, InputOption::VALUE_NONE, 'Suppress the projects page')
|
||||
->addOption('no-certs', null, InputOption::VALUE_NONE, 'Suppress the certificates')
|
||||
->addOption('no-toc', null, InputOption::VALUE_NONE, 'Suppress the table of contents')
|
||||
->addOption('no-quotes', null, InputOption::VALUE_NONE, 'Suppress the quotes');
|
||||
|
||||
parent::configure();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::execute()
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
if ($input->getOption('theme') == 'server') {
|
||||
$this->warningLog('Template server cannot be used to render dossiers, using print theme');
|
||||
$input->setOption('theme', 'print');
|
||||
}
|
||||
|
||||
$uriHelper = $this->getService('uri_helper');
|
||||
/* @var $uriHelper \Magdev\Dossier\Service\UriHelperService */
|
||||
|
||||
$tpl = $this->getService('template')->setTheme($input->getOption('theme'));
|
||||
/* @var $tpl \Magdev\Dossier\Service\TemplateService */
|
||||
|
||||
$cssproc = $this->getService('cssproc');
|
||||
/* @var $cssroc \Magdev\Dossier\Service\StylesheetProcessorService */
|
||||
|
||||
try {
|
||||
$data = new DataCollector(array(
|
||||
'disabled' => $this->getHelper('section_manager')->getDisabledSections($input),
|
||||
'theme' => $input->getOption('theme'),
|
||||
'name' => $input->getOption('docname'),
|
||||
'tags' => $this->config->get('cv.tags'),
|
||||
'locale' => $this->translator->getTranslator()->getLocale(),
|
||||
'stylesheet' => $cssproc->parseThemeStyles(),
|
||||
'userstyles' => $cssproc->parseUserstyles(),
|
||||
'favicon' => $uriHelper->getDataUriFromFile($tpl->getThemeFile('favicon.ico')),
|
||||
));
|
||||
|
||||
$models = $this->getService('markdown')->getFileSet($input->getOption('sort'));
|
||||
$data->merge($models);
|
||||
|
||||
$outputFile = $tpl->render('document.html.twig', $data, PROJECT_ROOT.'/_output');
|
||||
if ($input->getOption('pdf')) {
|
||||
$outputFile = $this->getService('pdf')->createPdf($outputFile);
|
||||
}
|
||||
|
||||
$this->io->result($this->translator->trans('message.output_file').': '.$uriHelper->getRelativePath($outputFile));
|
||||
$this->io->newLine();
|
||||
|
||||
$this->io->success($this->translator->trans('message.build.success'));
|
||||
$this->io->newLine();
|
||||
|
||||
if ($input->getOption('review')) {
|
||||
$uriHelper->openFileInEditor($outputFile);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$this->errorLog($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
205
src/Command/Dossier/DossierInitCommand.php
Normal file
205
src/Command/Dossier/DossierInitCommand.php
Normal file
@@ -0,0 +1,205 @@
|
||||
<?php
|
||||
/**
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 magdev
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author magdev
|
||||
* @copyright 2018 Marco Grätsch
|
||||
* @package magdev/dossier
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
*/
|
||||
|
||||
namespace Magdev\Dossier\Command\Dossier;
|
||||
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Exception\RuntimeException;
|
||||
use Magdev\Dossier\Command\Base\BaseCommand;
|
||||
|
||||
/**
|
||||
* Initialize a new project directory
|
||||
*
|
||||
* @author magdev
|
||||
*/
|
||||
final class DossierInitCommand extends BaseCommand
|
||||
{
|
||||
/**
|
||||
* The InitForm
|
||||
* @var \Magdev\Dossier\Form\Extension\Form
|
||||
*/
|
||||
protected $form = null;
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::configure()
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('dossier:init')
|
||||
->setDescription('Initialize a directory as dossier project')
|
||||
->setHelp('Initialize a new project. Creates the folder structure and some example markdown files')
|
||||
->addOption('directory', 'd', InputOption::VALUE_OPTIONAL, 'Set the output directory', getcwd());
|
||||
|
||||
parent::configure();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::initialize()
|
||||
*/
|
||||
protected function initialize(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
parent::initialize($input, $output);
|
||||
|
||||
try {
|
||||
$this->form = $this->getHelper('form')
|
||||
->getFormByName('form.init', $input, $output);
|
||||
} catch (FormException $fe) {
|
||||
throw new RuntimeException(get_class($fe).': '.$fe->getMessage(), $fe->getCode(), $fe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::interact()
|
||||
*/
|
||||
protected function interact(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$this->io->title($this->translator->trans('form.init.header'));
|
||||
$this->io->newLine();
|
||||
$this->form->process();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::execute()
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$targetDir = $input->getOption('directory');
|
||||
|
||||
if ($this->isDossierProjectDirectory($targetDir)) {
|
||||
throw new RuntimeException('Directory '.$targetDir.' seems to be an existing dossier project');
|
||||
}
|
||||
|
||||
$this->initTargetDirectory($targetDir);
|
||||
|
||||
if ($this->form->isProcessed()) {
|
||||
|
||||
if ($this->form->hasData('userstyle_type')) {
|
||||
$type = strtolower($this->form->getData('userstyle_type'));
|
||||
$file = $targetDir.'/.conf/'.$type.'/userstyles.'.$type;
|
||||
|
||||
if (!is_dir(dirname($file))) {
|
||||
mkdir(dirname($file), 0755, true);
|
||||
}
|
||||
file_put_contents($file, '');
|
||||
}
|
||||
|
||||
$formatter = $this->getHelper('formatter');
|
||||
|
||||
$output->writeln($formatter->formatBlock(array(
|
||||
' $ dossier.phar add:person',
|
||||
' $ dossier.phar add:intro',
|
||||
' $ dossier.phar add:cv',
|
||||
), 'cmd', true));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if the path is a valid dossier project
|
||||
*
|
||||
* @param string $path
|
||||
* @return bool
|
||||
*/
|
||||
private function isDossierProjectDirectory(string $path): bool
|
||||
{
|
||||
if (!is_dir($path)) {
|
||||
return false;
|
||||
}
|
||||
if (!is_dir($path.'/cv')) {
|
||||
return false;
|
||||
}
|
||||
if (!is_dir($path.'/certs')) {
|
||||
return false;
|
||||
}
|
||||
if (!is_dir($path.'/.conf')) {
|
||||
return false;
|
||||
}
|
||||
if (!file_exists($path.'/.conf/dossier.yaml')) {
|
||||
return false;
|
||||
}
|
||||
if (!file_exists($path.'/.env')) {
|
||||
return false;
|
||||
}
|
||||
if (!file_exists($path.'/intro.md')) {
|
||||
return false;
|
||||
}
|
||||
if (!file_exists($path.'/person.md')) {
|
||||
return false;
|
||||
}
|
||||
if (!file_exists($path.'/letter.md')) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Create the directory structure
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function initTargetDirectory(string $dir): string
|
||||
{
|
||||
if (!is_dir($dir)) {
|
||||
if (mkdir($dir, 0755, true) === false) {
|
||||
throw new RuntimeException('Creating directory '.$dir.' failed');
|
||||
}
|
||||
}
|
||||
if (!is_dir($dir.'/cv')) {
|
||||
mkdir($dir.'/cv', 0755, true);
|
||||
}
|
||||
if (!is_dir($dir.'/certs/pdf')) {
|
||||
mkdir($dir.'/certs/pdf', 0755, true);
|
||||
}
|
||||
if (!is_dir($dir.'/certs/png')) {
|
||||
mkdir($dir.'/certs/png', 0755, true);
|
||||
}
|
||||
if (!is_dir($dir.'/.conf')) {
|
||||
mkdir($dir.'/.conf', 0755, true);
|
||||
}
|
||||
file_put_contents($dir.'/.conf/dossier.yaml', '');
|
||||
file_put_contents($dir.'/.env', 'APP_DEBUG=false'.PHP_EOL.'APP_ENV=prod'.PHP_EOL);
|
||||
return $dir;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
122
src/Command/Dossier/DossierStatusCommand.php
Normal file
122
src/Command/Dossier/DossierStatusCommand.php
Normal file
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
/**
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 magdev
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author magdev
|
||||
* @copyright 2018 Marco Grätsch
|
||||
* @package magdev/dossier
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
*/
|
||||
|
||||
namespace Magdev\Dossier\Command\Dossier;
|
||||
|
||||
use Symfony\Component\Console\Helper\Table;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Helper\TableSeparator;
|
||||
use Magdev\Dossier\Model\Person;
|
||||
use Magdev\Dossier\Model\Intro;
|
||||
use Magdev\Dossier\Model\CurriculumVitae\Entry;
|
||||
use Magdev\Dossier\Model\Letter;
|
||||
use Magdev\Dossier\Style\DossierStyle;
|
||||
use Magdev\Dossier\Command\Base\BaseCommand;
|
||||
|
||||
/**
|
||||
* Command to show the current status of your dossier
|
||||
*
|
||||
* @author magdev
|
||||
*/
|
||||
class DossierStatusCommand extends BaseCommand
|
||||
{
|
||||
/**
|
||||
* Markdown service
|
||||
* @var \Magdev\Dossier\Service\MarkdownService
|
||||
*/
|
||||
private $markdown = null;
|
||||
|
||||
private $models = array(
|
||||
'Person' => 'person.md',
|
||||
'Intro' => 'intro.md',
|
||||
'Letter' => 'letter.md'
|
||||
);
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::configure()
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('dossier:status')
|
||||
->setDescription('Get the status of the current dossier files');
|
||||
|
||||
parent::configure();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::execute()
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$markdown = $this->getService('markdown');
|
||||
/* @var $markdown \Magdev\Dossier\Service\MarkdownService */
|
||||
|
||||
$analyzer = $this->getService('analyzer')->getAnalyzer('model.status');
|
||||
/* @var $analyzer \Magdev\Dossier\Analyzer\DossierStatusAnalyzer */
|
||||
|
||||
$thresholds = $this->config->get('style.dossier_status_thresholds');
|
||||
|
||||
$person = new Person($markdown->getDocument(PROJECT_ROOT.'/person.md'));
|
||||
$intro = new Intro($markdown->getDocument(PROJECT_ROOT.'/intro.md'));
|
||||
|
||||
$status = array();
|
||||
$status[] = array(get_class($person), 'person.md',
|
||||
$this->io->align('---', 9, DossierStyle::ALIGN_CENTER),
|
||||
$this->io->align($this->io->percent($analyzer->analyze($person), $thresholds), 6, DossierStyle::ALIGN_RIGHT)
|
||||
);
|
||||
$status[] = array(get_class($intro), 'intro.md',
|
||||
$this->io->align('---', 9, DossierStyle::ALIGN_CENTER),
|
||||
$this->io->align($this->io->percent($analyzer->analyze($intro), $thresholds), 6, DossierStyle::ALIGN_RIGHT)
|
||||
);
|
||||
$status[] = new TableSeparator();
|
||||
|
||||
$files = new \FilesystemIterator(PROJECT_ROOT.'/cv');
|
||||
foreach ($files as $file) {
|
||||
/* @var $file \SplFileInfo */
|
||||
$document = $markdown->getDocument($file->getPathname());
|
||||
$entry = new Entry($document);
|
||||
$status[] = array(get_class($entry), 'cv/'.$file->getFilename(),
|
||||
$this->io->align($this->io->bool($entry->useInResume()), 9, DossierStyle::ALIGN_CENTER),
|
||||
$this->io->align($this->io->percent($analyzer->analyze($entry), $thresholds), 6, DossierStyle::ALIGN_RIGHT)
|
||||
);
|
||||
}
|
||||
|
||||
$this->io->table(array('Model', 'File',
|
||||
$this->io->align('In Resume', 9),
|
||||
$this->io->align('Status', 6, DossierStyle::ALIGN_RIGHT)
|
||||
), $status);
|
||||
}
|
||||
}
|
||||
|
||||
119
src/Command/Intro/IntroAddCommand.php
Normal file
119
src/Command/Intro/IntroAddCommand.php
Normal file
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
/**
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 magdev
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author magdev
|
||||
* @copyright 2018 Marco Grätsch
|
||||
* @package magdev/dossier
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
*/
|
||||
|
||||
namespace Magdev\Dossier\Command\Intro;
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Exception\RuntimeException;
|
||||
use Droath\ConsoleForm\Exception\FormException;
|
||||
use Magdev\Dossier\Command\Base\BaseCommand;
|
||||
|
||||
final class IntroAddCommand extends BaseCommand
|
||||
{
|
||||
/**
|
||||
* The IntroForm
|
||||
* @var \Magdev\Dossier\Form\Extension\Form
|
||||
*/
|
||||
protected $form = null;
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::configure()
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('intro:add')
|
||||
->setDescription('Write the Intro page')
|
||||
->addOption('review', 'r', InputOption::VALUE_NONE, 'Review file in editor');
|
||||
|
||||
parent::configure();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Magdev\Dossier\Command\BaseCommand::initialize()
|
||||
*/
|
||||
protected function initialize(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
parent::initialize($input, $output);
|
||||
|
||||
try {
|
||||
$this->form = $this->getHelper('form')
|
||||
->getFormByName('form.intro', $input, $output);
|
||||
} catch (FormException $fe) {
|
||||
throw new RuntimeException(get_class($fe).': '.$fe->getMessage(), $fe->getCode(), $fe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::interact()
|
||||
*/
|
||||
protected function interact(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$this->io->title('<info> '.$this->translator->trans('form.intro.header.add').'</>');
|
||||
$this->io->newLine();
|
||||
$this->form->process();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::execute()
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
if ($this->form->isProcessed()) {
|
||||
$markdown = $this->getService('markdown');
|
||||
/* @var $markdown \Magdev\Dossier\Service\MarkdownService */
|
||||
|
||||
try {
|
||||
$text = $this->form->stripData('text', '');
|
||||
|
||||
$markdown->save(PROJECT_ROOT.'/intro.md', $this->form->getResults(), $text, false);
|
||||
$this->io->success($this->translator->trans('message.write.success', array(
|
||||
'%name%' => 'Intro'
|
||||
)));
|
||||
|
||||
if ($input->getOption('review') != false) {
|
||||
$this->getService('uri_helper')->openFileInEditor(PROJECT_ROOT.'/intro.md');
|
||||
}
|
||||
} catch (FormException $fe) {
|
||||
throw new RuntimeException(get_class($fe).': '.$fe->getMessage(), $fe->getCode(), $fe);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
69
src/Command/Intro/IntroEditCommand.php
Normal file
69
src/Command/Intro/IntroEditCommand.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/**
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 magdev
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author magdev
|
||||
* @copyright 2018 Marco Grätsch
|
||||
* @package magdev/dossier
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
*/
|
||||
|
||||
namespace Magdev\Dossier\Command\Intro;
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Exception\RuntimeException;
|
||||
use Magdev\Dossier\Command\Base\BaseCommand;
|
||||
|
||||
class IntroEditCommand extends BaseCommand
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::configure()
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('intro:edit')
|
||||
->setDescription('Edit the intro in your default editor');
|
||||
|
||||
parent::configure();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::configure()
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$file = PROJECT_ROOT.'/intro.md';
|
||||
|
||||
if (!file_exists($file)) {
|
||||
throw new RuntimeException('File '.$file.' not found');
|
||||
}
|
||||
|
||||
$this->getService('uri_helper')->openFileInEditor($file);
|
||||
}
|
||||
}
|
||||
|
||||
119
src/Command/Person/PersonAddCommand.php
Normal file
119
src/Command/Person/PersonAddCommand.php
Normal file
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
/**
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 magdev
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author magdev
|
||||
* @copyright 2018 Marco Grätsch
|
||||
* @package magdev/dossier
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
*/
|
||||
|
||||
namespace Magdev\Dossier\Command\Person;
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Exception\RuntimeException;
|
||||
use Droath\ConsoleForm\Exception\FormException;
|
||||
use Magdev\Dossier\Command\Base\BaseCommand;
|
||||
|
||||
final class PersonAddCommand extends BaseCommand
|
||||
{
|
||||
/**
|
||||
* The IntroForm
|
||||
* @var \Magdev\Dossier\Form\Extension\Form
|
||||
*/
|
||||
protected $form = null;
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::configure()
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('person:add')
|
||||
->setDescription('Write the Person page')
|
||||
->addOption('review', 'r', InputOption::VALUE_NONE, 'Review file in editor');
|
||||
|
||||
parent::configure();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Magdev\Dossier\Command\BaseCommand::initialize()
|
||||
*/
|
||||
protected function initialize(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
parent::initialize($input, $output);
|
||||
|
||||
try {
|
||||
$this->form = $this->getHelper('form')
|
||||
->getFormByName('form.person', $input, $output);
|
||||
} catch (FormException $fe) {
|
||||
throw new RuntimeException(get_class($fe).': '.$fe->getMessage(), $fe->getCode(), $fe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::interact()
|
||||
*/
|
||||
protected function interact(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$this->io->title($this->translator->trans('form.person.header.add'));
|
||||
$this->io->newLine();
|
||||
$this->form->process();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::execute()
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
if ($this->form->isProcessed()) {
|
||||
$markdown = $this->getService('markdown');
|
||||
/* @var $markdown \Magdev\Dossier\Service\MarkdownService */
|
||||
|
||||
try {
|
||||
$text = $this->form->stripData('text', '');
|
||||
|
||||
$markdown->save(PROJECT_ROOT.'/person.md', $this->form->getResults(), $text, false);
|
||||
$this->io->success($this->translator->trans('message.write.success', array(
|
||||
'%name%' => 'Person'
|
||||
)));
|
||||
|
||||
if ($input->getOption('review') != false) {
|
||||
$this->getService('uri_helper')->openFileInEditor(PROJECT_ROOT.'/person.md');
|
||||
}
|
||||
} catch (FormException $fe) {
|
||||
throw new RuntimeException(get_class($fe).': '.$fe->getMessage(), $fe->getCode(), $fe);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
69
src/Command/Person/PersonEditCommand.php
Normal file
69
src/Command/Person/PersonEditCommand.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/**
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 magdev
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author magdev
|
||||
* @copyright 2018 Marco Grätsch
|
||||
* @package magdev/dossier
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
*/
|
||||
|
||||
namespace Magdev\Dossier\Command\Person;
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Exception\RuntimeException;
|
||||
use Magdev\Dossier\Command\Base\BaseCommand;
|
||||
|
||||
class PersonEditCommand extends BaseCommand
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::configure()
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('person:edit')
|
||||
->setDescription('Edit personal data in your default editor');
|
||||
|
||||
parent::configure();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::configure()
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$file = PROJECT_ROOT.'/person.md';
|
||||
|
||||
if (!file_exists($file)) {
|
||||
throw new RuntimeException('File '.$file.' not found');
|
||||
}
|
||||
|
||||
$this->getService('uri_helper')->openFileInEditor($file);
|
||||
}
|
||||
}
|
||||
|
||||
143
src/Command/Server/ServerStartCommand.php
Normal file
143
src/Command/Server/ServerStartCommand.php
Normal file
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
/**
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 magdev
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author magdev
|
||||
* @copyright 2018 Marco Grätsch
|
||||
* @package magdev/dossier
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
*/
|
||||
|
||||
namespace Magdev\Dossier\Command\Server;
|
||||
|
||||
use Magdev\Dossier\Command\Base\BaseCommand;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Process\Process;
|
||||
use Symfony\Component\Process\Exception\ProcessFailedException;
|
||||
use Magdev\Dossier\Util\DataCollector;
|
||||
use Symfony\Component\Console\Exception\RuntimeException;
|
||||
|
||||
/**
|
||||
* Start the local HTTP server
|
||||
*
|
||||
* @author magdev
|
||||
*/
|
||||
class ServerStartCommand extends BaseCommand
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Magdev\Dossier\Command\Base\BaseCommand::configure()
|
||||
*/
|
||||
public function configure()
|
||||
{
|
||||
$this->setName('server:start')
|
||||
->setDescription('Start a local HTTP server')
|
||||
->addOption('socket', 's', InputOption::VALUE_OPTIONAL, 'Set the HTTP socket (host, port or host:port)', 'localhost:8000')
|
||||
->addOption('no-index', null, InputOption::VALUE_NONE, 'Suppress rendering of index.html before starting the server');
|
||||
|
||||
parent::configure();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::execute()
|
||||
*/
|
||||
public function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$socket = $input->getOption('socket');
|
||||
$docroot = PROJECT_ROOT.'/_output';
|
||||
|
||||
if (!$input->getOption('no-index')) {
|
||||
$this->createIndex($docroot);
|
||||
}
|
||||
|
||||
$cmd = sprintf('/usr/bin/env php -S %s -t %s', $socket, $docroot);
|
||||
try {
|
||||
$process = new Process($cmd);
|
||||
$process->setTimeout((60*60*24*365))
|
||||
->start();
|
||||
|
||||
$this->io->info(sprintf('Starting HTTP server on %s, press CTRL+C to stop', $socket));
|
||||
$process->wait(function($type, $buffer) {
|
||||
if (getenv('APP_DEBUG')) {
|
||||
$this->io->write(' <lightyellow>[GET] <fg=cyan>'.$buffer.'</>');
|
||||
}
|
||||
});
|
||||
} catch (\Exception $e) {
|
||||
$this->io->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create an index.html file before server start
|
||||
*
|
||||
* @param string $docroot
|
||||
* @return void
|
||||
*/
|
||||
protected function createIndex(string $docroot): void
|
||||
{
|
||||
if (file_exists($docroot.'/index.html')) {
|
||||
unlink($docroot.'/index.html');
|
||||
}
|
||||
|
||||
try {
|
||||
$tpl = $this->getService('template')->setTheme('server');
|
||||
/* @var $tpl \Magdev\Dossier\Service\TemplateService */
|
||||
|
||||
$cssproc = $this->getService('cssproc');
|
||||
/* @var $cssroc \Magdev\Dossier\Service\StylesheetProcessorService */
|
||||
|
||||
$uriHelper = $this->getService('uri_helper');
|
||||
/* @var $uriHelper \Magdev\Dossier\Service\UriHelperService */
|
||||
|
||||
$data = new DataCollector(array(
|
||||
'locale' => $this->translator->getTranslator()->getLocale(),
|
||||
'stylesheet' => $cssproc->parseThemeStyles(),
|
||||
'favicon' => $uriHelper->getDataUriFromFile($tpl->getThemeFile('favicon.ico')),
|
||||
));
|
||||
|
||||
$files = array();
|
||||
$fs = new \FilesystemIterator($docroot);
|
||||
foreach ($fs as $file) {
|
||||
if (!sizeof($files)) {
|
||||
$data->setData('first_link', $file);
|
||||
}
|
||||
$files[] = $file;
|
||||
}
|
||||
$data->setData('links', $files);
|
||||
|
||||
$html = $tpl->renderDocument('index.html.twig', $data);
|
||||
if (false === file_put_contents($docroot.'/index.html', $html)) {
|
||||
throw new RuntimeException('Error while writing index.html file');
|
||||
}
|
||||
$this->debugLog(sprintf('File index.html created with %s bytes', mb_strlen($html)));
|
||||
} catch (\Exception $e) {
|
||||
$this->errorLog($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
108
src/Command/Theme/ThemeDumpCommand.php
Normal file
108
src/Command/Theme/ThemeDumpCommand.php
Normal file
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
/**
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 magdev
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author magdev
|
||||
* @copyright 2018 Marco Grätsch
|
||||
* @package magdev/dossier
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
*/
|
||||
|
||||
namespace Magdev\Dossier\Command\Theme;
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Magdev\Dossier\Command\Base\BaseCommand;
|
||||
|
||||
/**
|
||||
* Create a local copy of a template
|
||||
*
|
||||
* @author magdev
|
||||
*/
|
||||
final class ThemeDumpCommand extends BaseCommand
|
||||
{
|
||||
/**
|
||||
* Phar helper service
|
||||
* @var \Magdev\Dossier\Service\PharHelperService
|
||||
*/
|
||||
private $pharHelper = null;
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::configure()
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('theme:dump')
|
||||
->setDescription('Create a local copy of a theme')
|
||||
|
||||
->addArgument('theme', InputArgument::REQUIRED, 'The name of the theme')
|
||||
->addOption('locale', 'l', InputOption::VALUE_OPTIONAL, 'Set the locale', 'de')
|
||||
->addOption('rename', 'r', InputOption::VALUE_OPTIONAL, 'Rename the theme', '')
|
||||
->addOption('output', 'o', InputOption::VALUE_OPTIONAL, 'Output folder', getenv('HOME').'/.dossier/tpl');
|
||||
|
||||
parent::configure();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::initialize()
|
||||
*/
|
||||
protected function initialize(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$this->pharHelper = $this->getService('phar_helper');
|
||||
|
||||
parent::initialize($input, $output);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::execute()
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$theme = $input->getArgument('theme');
|
||||
$outDir = $input->getOption('output');
|
||||
$newName = $input->getOption('rename');
|
||||
|
||||
$themeDir = 'app/tpl/'.$theme;
|
||||
$targetDir = !$newName ? $outDir.'/'.$theme : $outDir.'/'.$newName;
|
||||
$this->pharHelper->copyDir($themeDir, $targetDir);
|
||||
|
||||
$this->io->success($this->translator->trans('message.dump.success', array('%theme%' => $theme)));
|
||||
/*
|
||||
if ($outDir != getenv('HOME').'/.dossier/tpl') {
|
||||
$output->writeln('<fg=cyan> '.$this->translator->trans('message.export.template_dir').'</>');
|
||||
$output->writeln('<fg=blue> '.$this->translator->trans('message.export.code.template_environment', array('%path%' => $outDir)).'</>');
|
||||
} else {
|
||||
$output->writeln('<fg=cyan> '.$this->translator->trans('message.export.template_homedir').'</>');
|
||||
}*/
|
||||
$this->io->newLine();
|
||||
}
|
||||
}
|
||||
|
||||
72
src/Command/Theme/ThemeListCommand.php
Normal file
72
src/Command/Theme/ThemeListCommand.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
/**
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 magdev
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author magdev
|
||||
* @copyright 2018 Marco Grätsch
|
||||
* @package magdev/dossier
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
*/
|
||||
|
||||
namespace Magdev\Dossier\Command\Theme;
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Magdev\Dossier\Command\Base\BaseCommand;
|
||||
|
||||
/**
|
||||
* Create a local copy of a template
|
||||
*
|
||||
* @author magdev
|
||||
*/
|
||||
final class ThemeListCommand extends BaseCommand
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::configure()
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('theme:list')
|
||||
->setDescription('List available themes')
|
||||
->addOption('all', 'a', InputOption::VALUE_NONE, 'List all themes, icluding the overridden ones');
|
||||
|
||||
parent::configure();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Symfony\Component\Console\Command\Command::execute()
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$all = (bool) $input->getOption('all');
|
||||
$helper = $this->getHelper('export');
|
||||
/* @var $helper \Magdev\Dossier\Helper\ExportHelper */
|
||||
|
||||
$themes = $this->config->findThemes($all);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user