forked from symfony/symfony-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.php
executable file
·45 lines (38 loc) · 1.56 KB
/
build.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
#!/usr/bin/env php
<?php
require __DIR__.'/vendor/autoload.php';
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Process\Process;
use Symfony\Component\Process\Exception\ProcessFailedException;
use Symfony\Component\Console\Input\InputOption;
(new Application('Symfony Docs Builder', '1.0'))
->register('build-docs')
->addOption('generate-fjson-files', null, InputOption::VALUE_NONE, 'Use this option to generate docs both in HTML and JSON formats')
->addOption('disable-cache', null, InputOption::VALUE_NONE, 'Use this option to force a full regeneration of all doc contents')
->setCode(function(InputInterface $input, OutputInterface $output) {
$command = [
'php',
'vendor/symfony/docs-builder/bin/console',
'build:docs',
sprintf('--save-errors=%s', __DIR__.'/logs.txt'),
__DIR__.'/../',
__DIR__.'/output/',
];
if ($input->getOption('generate-fjson-files')) {
$command[] = '--output-json';
}
if ($input->getOption('disable-cache')) {
$command[] = '--disable-cache';
}
$process = new Process($command);
$process->setTimeout(3600);
$this->getHelper('process')->run($output, $process);
if (!$process->isSuccessful()) {
throw new ProcessFailedException($process);
}
})
->getApplication()
->setDefaultCommand('build-docs', true)
->run();