-
Notifications
You must be signed in to change notification settings - Fork 0
/
console.php
60 lines (47 loc) · 1.72 KB
/
console.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
if (PHP_SAPI !== 'cli')
{
die('Mudi is away');
}
define('DS', DIRECTORY_SEPARATOR);
define('BASE_PATH', __DIR__);
define('MUDI_PATH', BASE_PATH . DS . 'src/Mudi');
define('RESOURCES_PATH', MUDI_PATH . DS . 'Resources');
define('VIEW_PATH', RESOURCES_PATH . DS .'views');
define('TEST_PATH', BASE_PATH . DS . 'tests');
use Cilex\Provider\Console\Adapter\Silex\ConsoleServiceProvider;
use Silex\Application;
use Symfony\Component\EventDispatcher\Event;
require_once __DIR__ . '/vendor/autoload.php';
$app = new Application;
//twig as service
$app->register(new Silex\Provider\TwigServiceProvider(), array(
'twig.path' => array(VIEW_PATH, VIEW_PATH . '/public', VIEW_PATH . '/generator'),
'twig.options' => array('autoescape' => false),
'debug' => true
));
//console as service
$app->register(new ConsoleServiceProvider(), array(
'console.name' => 'Mudi console',
'console.version' => '0.1.0',
));
$app->register(new Igorw\Silex\ConfigServiceProvider(BASE_PATH . "/config/mudi.json"));
$app["request"] = array('basepath' => $app['app_request_prod']);
$commands = array(
new \Mudi\Command\ValidateCommand(),
new \Mudi\Command\TidyCommand(),
new \Mudi\Command\TagStatsCommand(),
new \Mudi\Command\CheckLinkCommand(),
new \Mudi\Command\CasperjsCommand(),
new \Mudi\Command\CasperjsScreenshotCommand(),
new \Mudi\Command\RunCommand(),
new \Mudi\Command\RunAllCommand(),
new \Mudi\Command\W3CCssValidatorCommand(),
new \Mudi\Command\CssUsageCommand(),
new \Mudi\Command\GenerateCommand()
);
foreach ($commands as $command) {
$app['console']->add($command);
}
$app['dispatcher']->addSubscriber( new \Mudi\ScoringSubscriber($app['scoring']) );
$app['console']->run();