6
6
use Symfony \Component \Console \Input \InputInterface ;
7
7
use Symfony \Component \Console \Output \OutputInterface ;
8
8
9
+ if (!class_exists ('Symfony \\Bundle \\FrameworkBundle \\Command \\ContainerAwareCommand ' )) {
10
+ // @codeCoverageIgnoreStart
11
+ class_alias ('Jade \\JadeSymfonyBundle \\Command \\PugAwareCommand ' , 'Symfony \\Bundle \\FrameworkBundle \\Command \\ContainerAwareCommand ' );
12
+ // @codeCoverageIgnoreEnd
13
+ }
14
+
9
15
class AssetsPublishCommand extends ContainerAwareCommand
10
16
{
11
17
protected function configure ()
@@ -27,6 +33,7 @@ protected function cacheTemplates($pug)
27
33
$ errors = 0 ;
28
34
$ errorDetails = [];
29
35
$ directories = [];
36
+
30
37
foreach ($ pug ->getOption ('viewDirectories ' ) as $ viewDirectory ) {
31
38
if (is_dir ($ viewDirectory ) && !in_array ($ viewDirectory , $ directories )) {
32
39
$ directories [] = $ viewDirectory ;
@@ -42,17 +49,19 @@ protected function cacheTemplates($pug)
42
49
43
50
protected function execute (InputInterface $ input , OutputInterface $ output )
44
51
{
45
- list ($ directories , $ success , $ errors , $ errorDetails ) = $ this ->cacheTemplates (
46
- $ this ->getContainer ()->get ('templating.engine.pug ' )->getEngine ()
47
- );
52
+ $ symfonyEngine = isset ($ this ->pugSymfonyEngine ) ? $ this ->pugSymfonyEngine : $ this ->getContainer ()->get ('templating.engine.pug ' );
53
+ list ($ directories , $ success , $ errors , $ errorDetails ) = $ this ->cacheTemplates ($ symfonyEngine ->getEngine ());
48
54
$ count = count ($ directories );
49
55
$ output ->writeln ($ count . ' ' . ($ count === 1 ? 'directory ' : 'directories ' ) . ' scanned: ' . implode (', ' , $ directories ) . '. ' );
50
56
$ output ->writeln ($ success . ' templates cached. ' );
51
57
$ output ->writeln ($ errors . ' templates failed to be cached. ' );
58
+
52
59
foreach ($ errorDetails as $ index => $ detail ) {
53
60
$ output ->writeln ("\n" . ($ index + 1 ) . ') ' . $ detail ['inputFile ' ]);
54
61
$ output ->writeln ($ detail ['error ' ]->getMessage ());
55
62
$ output ->writeln ($ detail ['error ' ]->getTraceAsString ());
56
63
}
64
+
65
+ return 0 ;
57
66
}
58
67
}
0 commit comments