Skip to content

Commit

Permalink
Moved the CLI application configuration into the container config
Browse files Browse the repository at this point in the history
  • Loading branch information
mnapoli committed Dec 12, 2014
1 parent 480b471 commit e7452f9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
9 changes: 2 additions & 7 deletions bin/couscous
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ if (isset($include)) {
$factory = new ContainerFactory();
$container = $factory->createContainer();

$application = new Application('Couscous', '1.0-dev');

$application->add($container->get('Couscous\Application\Cli\GenerateCommand'));
$application->add($container->get('Couscous\Application\Cli\PreviewCommand'));
$application->add($container->get('Couscous\Application\Cli\DeployCommand'));
$application->add($container->get('Couscous\Application\Cli\ClearCommand'));

/** @var Application $application */
$application = $container->get('application');
$application->run();
20 changes: 16 additions & 4 deletions src/Application/config.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php

use Interop\Container\ContainerInterface;
use Symfony\Component\Console\Application;

return array(
return [

'steps' => array(
'steps' => [
'Couscous\Module\Core\Step\ClearTargetDirectory',
'Couscous\Module\Config\Step\SetDefaultConfig',
'Couscous\Module\Config\Step\LoadConfig',
Expand All @@ -24,7 +25,7 @@
'Couscous\Module\Template\Step\ProcessTwigLayouts',
'Couscous\Module\Core\Step\WriteFiles',
'Couscous\Module\Scripts\Step\ExecuteAfterScripts',
),
],

'Couscous\Generator' => DI\object()
->constructorParameter('steps', DI\link('steps.instances')),
Expand All @@ -35,9 +36,20 @@
}, $c->get('steps'));
}),

'application' => DI\factory(function (ContainerInterface $c) {
$application = new Application('Couscous', '1.0-dev');

$application->add($c->get('Couscous\Application\Cli\GenerateCommand'));
$application->add($c->get('Couscous\Application\Cli\PreviewCommand'));
$application->add($c->get('Couscous\Application\Cli\DeployCommand'));
$application->add($c->get('Couscous\Application\Cli\ClearCommand'));

return $application;
}),

'Mni\FrontYAML\Parser' => DI\object()
->constructorParameter('markdownParser', DI\link('Mni\FrontYAML\Markdown\MarkdownParser')),
'Mni\FrontYAML\Markdown\MarkdownParser' => DI\object('Mni\FrontYAML\Bridge\Parsedown\ParsedownParser')
->constructor(DI\link('ParsedownExtra')),

);
];

0 comments on commit e7452f9

Please sign in to comment.