@@ -57,7 +57,14 @@ protected function configure()
57
57
null ,
58
58
InputOption::VALUE_NONE ,
59
59
'If provided, caching meta will be disabled '
60
- );
60
+ )
61
+ ->addOption (
62
+ 'save-errors ' ,
63
+ null ,
64
+ InputOption::VALUE_REQUIRED ,
65
+ 'Path where any errors should be saved '
66
+ )
67
+ ;
61
68
}
62
69
63
70
protected function initialize (InputInterface $ input , OutputInterface $ output )
@@ -76,11 +83,24 @@ protected function initialize(InputInterface $input, OutputInterface $output)
76
83
protected function execute (InputInterface $ input , OutputInterface $ output )
77
84
{
78
85
$ this ->startBuild ();
86
+ $ buildErrors = $ this ->builder ->getErrorManager ()->getErrors ();
79
87
80
- $ this ->io ->newLine (2 );
81
88
$ this ->io ->success ('HTML rendering complete! ' );
82
89
83
- $ this ->missingFilesChecker ->checkMissingFiles ($ this ->io );
90
+ $ missingFiles = $ this ->missingFilesChecker ->getMissingFiles ();
91
+ foreach ($ missingFiles as $ missingFile ) {
92
+ $ message = sprintf ('Missing file "%s" ' , $ missingFile );
93
+ $ buildErrors [] = $ message ;
94
+ $ this ->io ->warning ($ message );
95
+ }
96
+
97
+ if ($ logPath = $ input ->getOption ('save-errors ' )) {
98
+ if (count ($ buildErrors ) > 0 ) {
99
+ array_unshift ($ buildErrors , sprintf ('Build errors from "%s" ' , date ('Y-m-d h:i:s ' )));
100
+ }
101
+
102
+ file_put_contents ($ logPath , implode ("\n" , $ buildErrors ));
103
+ }
84
104
85
105
$ metas = $ this ->getMetas ();
86
106
if (!$ this ->buildContext ->getParseSubPath ()) {
0 commit comments