Skip to content

Commit a64783e

Browse files
authored
minor #1562 [docs] document new config values
1 parent f0d1574 commit a64783e

File tree

11 files changed

+3082
-11
lines changed

11 files changed

+3082
-11
lines changed

.doctor-rst.yaml

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
rules:
2+
american_english: ~
3+
avoid_repetetive_words: ~
4+
blank_line_after_anchor: ~
5+
blank_line_after_directive: ~
6+
blank_line_before_directive: ~
7+
composer_dev_option_not_at_the_end: ~
8+
correct_code_block_directive_based_on_the_content: ~
9+
deprecated_directive_should_have_version: ~
10+
ensure_bash_prompt_before_composer_command: ~
11+
ensure_correct_format_for_phpfunction: ~
12+
ensure_exactly_one_space_before_directive_type: ~
13+
ensure_exactly_one_space_between_link_definition_and_link: ~
14+
ensure_explicit_nullable_types: ~
15+
ensure_github_directive_start_with_prefix:
16+
prefix: 'Symfony'
17+
ensure_link_bottom: ~
18+
ensure_link_definition_contains_valid_url: ~
19+
ensure_order_of_code_blocks_in_configuration_block: ~
20+
ensure_php_reference_syntax: ~
21+
extend_abstract_controller: ~
22+
# extension_xlf_instead_of_xliff: ~
23+
forbidden_directives:
24+
directives:
25+
- '.. index::'
26+
indention: ~
27+
lowercase_as_in_use_statements: ~
28+
max_blank_lines:
29+
max: 2
30+
max_colons: ~
31+
no_app_console: ~
32+
no_attribute_redundant_parenthesis: ~
33+
no_blank_line_after_filepath_in_php_code_block: ~
34+
no_blank_line_after_filepath_in_twig_code_block: ~
35+
no_blank_line_after_filepath_in_xml_code_block: ~
36+
no_blank_line_after_filepath_in_yaml_code_block: ~
37+
no_brackets_in_method_directive: ~
38+
no_composer_req: ~
39+
no_directive_after_shorthand: ~
40+
no_duplicate_use_statements: ~
41+
no_footnotes: ~
42+
no_inheritdoc: ~
43+
no_merge_conflict: ~
44+
no_namespace_after_use_statements: ~
45+
no_php_open_tag_in_code_block_php_directive: ~
46+
no_space_before_self_xml_closing_tag: ~
47+
only_backslashes_in_namespace_in_php_code_block: ~
48+
only_backslashes_in_use_statements_in_php_code_block: ~
49+
ordered_use_statements: ~
50+
php_prefix_before_bin_console: ~
51+
remove_trailing_whitespace: ~
52+
replace_code_block_types: ~
53+
replacement: ~
54+
short_array_syntax: ~
55+
space_between_label_and_link_in_doc: ~
56+
space_between_label_and_link_in_ref: ~
57+
string_replacement: ~
58+
title_underline_length_must_match_title_length: ~
59+
typo: ~
60+
unused_links: ~
61+
use_deprecated_directive_instead_of_versionadded: ~
62+
use_named_constructor_without_new_keyword_rule: ~
63+
use_https_xsd_urls: ~
64+
valid_inline_highlighted_namespaces: ~
65+
valid_use_statements: ~
66+
versionadded_directive_should_have_version: ~
67+
yaml_instead_of_yml_suffix: ~
68+
69+
# master
70+
versionadded_directive_major_version:
71+
major_version: 1
72+
73+
versionadded_directive_min_version:
74+
min_version: '1.0'
75+
76+
deprecated_directive_major_version:
77+
major_version: 7
78+
79+
deprecated_directive_min_version:
80+
min_version: '1.0'

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
/tests export-ignore
55
/tools export-ignore
66
docker-compose.yml export-ignore
7+
/_docs_build export-ignore

.github/workflows/ci-docs.yaml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: "CI Docs Analysis"
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- 'main'
8+
schedule:
9+
- cron: '0 0 * * *'
10+
11+
env:
12+
PHPUNIT_FLAGS: "-v"
13+
SYMFONY_PHPUNIT_DIR: "$HOME/symfony-bridge/.phpunit"
14+
15+
jobs:
16+
doctor-rst:
17+
name: Lint (DOCtor-RST)
18+
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: "Checkout"
23+
uses: actions/checkout@v3
24+
25+
- name: "Create cache dir"
26+
run: mkdir .cache
27+
28+
- name: "Extract base branch name"
29+
run: echo "branch=$(echo ${GITHUB_BASE_REF:=${GITHUB_REF##*/}})" >> $GITHUB_OUTPUT
30+
id: extract_base_branch
31+
32+
- name: "Cache DOCtor-RST"
33+
uses: actions/cache@v3
34+
with:
35+
path: .cache
36+
key: ${{ runner.os }}-doctor-rst-${{ steps.extract_base_branch.outputs.branch }}
37+
38+
- name: "Run DOCtor-RST"
39+
uses: docker://oskarstark/doctor-rst:1.61.1
40+
with:
41+
args: --short --error-format=github --cache-file=/github/workspace/.cache/doctor-rst.cache

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@
77
/tools/*/composer.lock
88
/tools/*/vendor
99
/vendor/
10+
/_docs_build/vendor
11+
/_docs_build/output

README.md

+24
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,27 @@ B) The generated code itself may change between minor releases. This
2525

2626
[1]: https://symfony.com/doc/current/bundles/SymfonyMakerBundle/index.html
2727
[2]: https://symfony.com/doc/current/contributing/code/bc.html
28+
29+
---
30+
31+
Build Documentation Locally
32+
---------------------------
33+
34+
This is not needed for contributing, but it's useful if you would like to debug some
35+
issue in the docs or if you want to read MakerBundles Documentation offline.
36+
37+
```bash
38+
$ cd _docs_build/
39+
40+
$ composer install
41+
42+
$ php build.php
43+
```
44+
45+
After generating docs, serve them with the internal PHP server:
46+
47+
```bash
48+
$ php -S localhost:8000 -t output/
49+
```
50+
51+
Browse `http://localhost:8000` to read the docs.

_docs_build/build.php

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
/*
5+
* This file is part of the Symfony MakerBundle package.
6+
*
7+
* (c) Fabien Potencier <fabien@symfony.com>
8+
*
9+
* For the full copyright and license information, please view the LICENSE
10+
* file that was distributed with this source code.
11+
*/
12+
13+
require __DIR__.'/vendor/autoload.php';
14+
15+
use Symfony\Component\Console\Application;
16+
use Symfony\Component\Console\Input\InputInterface;
17+
use Symfony\Component\Console\Input\InputOption;
18+
use Symfony\Component\Console\Output\OutputInterface;
19+
use Symfony\Component\Console\Style\SymfonyStyle;
20+
use SymfonyDocsBuilder\BuildConfig;
21+
use SymfonyDocsBuilder\DocBuilder;
22+
23+
(new Application('Symfony Docs Builder', '1.0'))
24+
->register('build-docs')
25+
->addOption('generate-fjson-files', null, InputOption::VALUE_NONE, 'Use this option to generate docs both in HTML and JSON formats')
26+
->setCode(function (InputInterface $input, OutputInterface $output) {
27+
$io = new SymfonyStyle($input, $output);
28+
$io->text('Building all Symfony Docs...');
29+
30+
$outputDir = __DIR__.'/output';
31+
$buildConfig = (new BuildConfig())
32+
->setSymfonyVersion('7.1')
33+
->setContentDir(__DIR__.'/../src/Resources/doc')
34+
->setOutputDir($outputDir)
35+
->setImagesDir(__DIR__.'/output/_images')
36+
->setImagesPublicPrefix('_images')
37+
->setTheme('rtd')
38+
->diableBuildCache()
39+
;
40+
41+
$buildConfig->setExcludedPaths(['.github/', '_build/']);
42+
43+
if (!$generateJsonFiles = $input->getOption('generate-fjson-files')) {
44+
$buildConfig->disableJsonFileGeneration();
45+
}
46+
47+
$io->comment(sprintf('cache: disabled / output file type(s): %s', $generateJsonFiles ? 'HTML and JSON' : 'HTML'));
48+
49+
$result = (new DocBuilder())->build($buildConfig);
50+
51+
if ($result->isSuccessful()) {
52+
$io->success(sprintf('The Symfony Docs were successfully built at %s', realpath($outputDir)));
53+
54+
return 0;
55+
}
56+
57+
$io->error(sprintf("There were some errors while building the docs:\n\n%s\n", $result->getErrorTrace()));
58+
$io->newLine();
59+
$io->comment('Tip: you can add the -v, -vv or -vvv flags to this command to get debug information.');
60+
61+
return 1;
62+
})
63+
->getApplication()
64+
->setDefaultCommand('build-docs', true)
65+
->run();

_docs_build/composer.json

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"minimum-stability": "dev",
3+
"prefer-stable": true,
4+
"config": {
5+
"platform": {
6+
"php": "8.1.0"
7+
},
8+
"preferred-install": {
9+
"*": "dist"
10+
},
11+
"sort-packages": true,
12+
"allow-plugins": {
13+
"symfony/flex": true
14+
}
15+
},
16+
"require": {
17+
"php": ">=8.1",
18+
"symfony-tools/docs-builder": "^0.23",
19+
"symfony/console": "^6.2",
20+
"symfony/process": "^6.2"
21+
}
22+
}

0 commit comments

Comments
 (0)