Reorganized commands, removed theme-commands and edit-commands
This commit is contained in:
@@ -28,7 +28,7 @@
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
*/
|
||||
|
||||
namespace Magdev\Dossier\Command\Cv;
|
||||
namespace Magdev\Dossier\Command\Create;
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
@@ -43,7 +43,7 @@ use Magdev\Dossier\Command\Base\BaseCommand;
|
||||
*
|
||||
* @author magdev
|
||||
*/
|
||||
final class CvAddCommand extends BaseCommand
|
||||
final class CreateCvCommand extends BaseCommand
|
||||
{
|
||||
/**
|
||||
* TheCV Form
|
||||
@@ -58,7 +58,7 @@ final class CvAddCommand extends BaseCommand
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('cv:add')
|
||||
$this->setName('create:cv')
|
||||
->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');
|
||||
@@ -73,6 +73,11 @@ final class CvAddCommand extends BaseCommand
|
||||
*/
|
||||
protected function initialize(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$name = $input->getArgument('name');
|
||||
if (file_exists(PROJECT_ROOT.'/cv/'.$name.'.md')) {
|
||||
throw new \RuntimeException('File cv/'.$name.'.md already exists');
|
||||
}
|
||||
|
||||
try {
|
||||
$this->form = $this->getHelper('form')->getFormByName('form.cv', $input, $output);
|
||||
parent::initialize($input, $output);
|
||||
@@ -28,7 +28,7 @@
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
*/
|
||||
|
||||
namespace Magdev\Dossier\Command\Intro;
|
||||
namespace Magdev\Dossier\Command\Create;
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
@@ -37,7 +37,7 @@ use Symfony\Component\Console\Exception\RuntimeException;
|
||||
use Droath\ConsoleForm\Exception\FormException;
|
||||
use Magdev\Dossier\Command\Base\BaseCommand;
|
||||
|
||||
final class IntroAddCommand extends BaseCommand
|
||||
final class CreateIntroCommand extends BaseCommand
|
||||
{
|
||||
/**
|
||||
* The IntroForm
|
||||
@@ -52,7 +52,7 @@ final class IntroAddCommand extends BaseCommand
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('intro:add')
|
||||
$this->setName('create:intro')
|
||||
->setDescription('Write the Intro page')
|
||||
->addOption('review', 'r', InputOption::VALUE_NONE, 'Review file in editor');
|
||||
|
||||
@@ -68,6 +68,10 @@ final class IntroAddCommand extends BaseCommand
|
||||
{
|
||||
parent::initialize($input, $output);
|
||||
|
||||
if (file_exists(PROJECT_ROOT.'/intro.md')) {
|
||||
throw new \RuntimeException('File intro.md already exists');
|
||||
}
|
||||
|
||||
try {
|
||||
$this->form = $this->getHelper('form')
|
||||
->getFormByName('form.intro', $input, $output);
|
||||
@@ -28,7 +28,7 @@
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
*/
|
||||
|
||||
namespace Magdev\Dossier\Command\Person;
|
||||
namespace Magdev\Dossier\Command\Create;
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
@@ -37,7 +37,7 @@ use Symfony\Component\Console\Exception\RuntimeException;
|
||||
use Droath\ConsoleForm\Exception\FormException;
|
||||
use Magdev\Dossier\Command\Base\BaseCommand;
|
||||
|
||||
final class PersonAddCommand extends BaseCommand
|
||||
final class CreatePersonCommand extends BaseCommand
|
||||
{
|
||||
/**
|
||||
* The IntroForm
|
||||
@@ -52,7 +52,7 @@ final class PersonAddCommand extends BaseCommand
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('person:add')
|
||||
$this->setName('create:person')
|
||||
->setDescription('Write the Person page')
|
||||
->addOption('review', 'r', InputOption::VALUE_NONE, 'Review file in editor');
|
||||
|
||||
@@ -68,6 +68,10 @@ final class PersonAddCommand extends BaseCommand
|
||||
{
|
||||
parent::initialize($input, $output);
|
||||
|
||||
if (file_exists(PROJECT_ROOT.'/person.md')) {
|
||||
throw new \RuntimeException('File person.md already exists');
|
||||
}
|
||||
|
||||
try {
|
||||
$this->form = $this->getHelper('form')
|
||||
->getFormByName('form.person', $input, $output);
|
||||
129
src/Command/Create/CreateProjectCommand.php
Normal file
129
src/Command/Create/CreateProjectCommand.php
Normal file
@@ -0,0 +1,129 @@
|
||||
<?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\Create;
|
||||
|
||||
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 project
|
||||
*
|
||||
* @author magdev
|
||||
*/
|
||||
final class CreateProjectCommand 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('create:project')
|
||||
->setDescription('Write a new project file')
|
||||
->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)
|
||||
{
|
||||
$name = $input->getArgument('name');
|
||||
if (file_exists(PROJECT_ROOT.'/projects/'.$name.'.md')) {
|
||||
throw new \RuntimeException('File projects/'.$name.'.md already exists');
|
||||
}
|
||||
|
||||
try {
|
||||
$this->form = $this->getHelper('form')->getFormByName('form.project', $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.project.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.'/projects/'.$name.'.md', $this->form->getResults(), $text, false);
|
||||
$this->io->success($this->translator->trans('message.write.success', array(
|
||||
'%name%' => 'Project/'.ucfirst($name)
|
||||
)));
|
||||
|
||||
if ($input->getOption('review') != false) {
|
||||
$this->getService('uri_helper')->openFileInEditor(PROJECT_ROOT.'/projects/'.$name.'.md');
|
||||
}
|
||||
} catch (FormException $fe) {
|
||||
throw new RuntimeException(get_class($fe).': '.$fe->getMessage(), $fe->getCode(), $fe);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
<?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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
<?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