8000 Add the new doc build system · symfony/symfony-docs@792968b · GitHub
[go: up one dir, main page]

Skip to content

Commit 792968b

Browse files
javiereguiluzwouterj
authored andcommitted
Add the new doc build system
1 parent fbb9a67 commit 792968b

File tree

5 files changed

+2268
-0
lines changed

5 files changed

+2268
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
/_build/doctrees
22
/_build/spelling
33
/_build/html
4+
/_build/logs.txt
5+
/_build/vendor
6+
/_build/output
47
*.pyc

_build/build.php

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env php
2+
<?php
3+
require __DIR__.'/vendor/autoload.php';
4+
5+
use Symfony\Component\Console\Application;
6+
use Symfony\Component\Console\Input\InputInterface;
7+
use Symfony\Component\Console\Output\OutputInterface;
8+
use Symfony\Component\Process\Process;
9+
use Symfony\Component\Process\Exception\ProcessFailedException;
10+
use Symfony\Component\Console\Input\InputOption;
11+
12+
(new Application('Symfony Docs Builder', '1.0'))
13+
->register('build-docs')
14+
->addOption('generate-fjson-files', null, InputOption::VALUE_NONE, 'Use this option to generate docs both in HTML and JSON formats')
15+
->addOption('disable-cache', null, InputOption::VALUE_NONE, 'Use this option to force a full regeneration of all doc contents')
16+
->setCode(function(InputInterface $input, OutputInterface $output) {
17+
$command = [
18+
'php',
19+
'vendor/symfony/docs-builder/bin/console',
20+
'build:docs',
21+
sprintf('--save-errors=%s', __DIR__.'/logs.txt'),
22+
__DIR__.'/../',
23+
__DIR__.'/output/',
24+
];
25+
26+
if ($input->getOption('generate-fjson-files')) {
27+
$command[] = '--output-json';
28+
}
29+
30+
if ($input->getOption('disable-cache')) {
31+
$command[] = '--disable-cache';
32+
}
33+
34+
$process = new Process($command);
35+
$process->setTimeout(3600);
36+
$process->run();
37+
38+
if (!$process->isSuccessful()) {
39+
throw new ProcessFailedException($process);
40+
}
41+
})
42+
->getApplication()
43+
->setDefaultCommand('build-docs', true)
44+
->run();

_build/composer.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"minimum-stability": "dev",
3+
"repositories": [
4+
{ "type": "git", "url": "https://github.com/weaverryan/docs-builder" }
5+
],
6+
"config": {
7+
"platform": {
8+
"php": "7.2.9"
9+
},
10+
"preferred-install": {
11+
"*": "dist"
12+
},
13+
"sort-packages": true
14+
},
15+
"require": {
16+
"php": ">=7.2.9",
17+
"symfony/console": "^4.1",
18+
"symfony/docs-builder": "dev-master",
19+
"symfony/process": "9999999-dev"
20+
}
21+
}

0 commit comments

Comments
 (0)
0