fix: version + changelog

This commit is contained in:
egarette@silique.fr 2025-11-03 18:01:10 +01:00
parent 59dd77e74d
commit 102547d57b
143 changed files with 136 additions and 268 deletions

View file

@ -1,6 +1,7 @@
#!/usr/bin/env python3
import sys
from json import dump, loads
from pathlib import Path
from ruamel.yaml import YAML
from ansi2html import Ansi2HTMLConverter
@ -12,12 +13,14 @@ from rougail.user_data_yaml import RougailUserDataYaml
from rougail.output_doc import RougailOutputDoc
PREVIOUS = Path("previous.yml")
if __name__ == "__main__":
version = sys.argv[1]
commit_id = sys.argv[1]
# rougailconfig = RougailConfig.copy()
rougailconfig = get_rougail_config(backward_compatibility=False, add_extra_options=False)
rougailconfig['main_structural_directories'] = ['firefox']
rougailconfig['default_structural_format_version'] = version
if Path('config/namespace').is_file():
has_namespace = True
has_foxyproxy = False
@ -44,6 +47,7 @@ if __name__ == "__main__":
rougailconfig['doc.title_level'] = 3
inventory = RougailOutputDoc(config, rougailconfig=rougailconfig.copy())
inventory.load_formatter()
inv_formatter = inventory.formatter
rougailconfig['step.output'] = 'console'
summary = Path('summary_before.md')
if summary.is_file():
@ -59,11 +63,11 @@ if __name__ == "__main__":
else:
all_dirs = [[rougailconfig['main_structural_directories']]]
doc += inventory.formatter.title('Screenshot', 2) + '\n'
doc += inv_formatter.title('Screenshot', 2) + '\n'
doc += f'<img src="{namespace}.png" width=50% height=50% alt="{namespace.capitalize()} Proxy setting"/>\n\n'
# with doc_file.open('r') as docfh:
# doc += docfh.read()
doc += '\n' + inventory.formatter.title('Structure', 2) + '\n'
doc += '\n' + inv_formatter.title('Structure', 2) + '\n'
print(all_dirs)
for r in all_dirs:
for dirs in r:
@ -75,17 +79,17 @@ if __name__ == "__main__":
namespace = f.parent.name
file_found = True
if f.name.endswith('.yml') or f.name.endswith('.yaml'):
doc += inventory.formatter.title(str(f), 3)
doc += inv_formatter.title(str(f), 3)
doc += '\n```yml\n'
with f.open(encoding="utf8") as file_fh:
doc += file_fh.read()
doc += '\n```\n'
rougailconfig['step.output'] = 'doc'
inv_doc = inventory.run()[1]
rougailconfig['step.output'] = 'console'
if file_found and inv_doc:
doc += inventory.formatter.title('Generated documentation', 3)
CMD = f"foo@bar:~$ rougail -v {version} -m firefox/ "
doc += inv_formatter.title('Generated documentation', 3)
CMD = f"foo@bar:~$ git switch --detach {commit_id}\n"
CMD += "foo@bar:~$ rougail -m firefox/ "
if has_namespace:
CMD += "-s Firefox "
if has_foxyproxy:
@ -95,10 +99,28 @@ if __name__ == "__main__":
cmd = CMD + "-o doc -do github"
doc += f'```console\n{cmd}\n```\n'
doc += inv_doc
if PREVIOUS.is_file():
rougailconfig["doc.title_level"] = 5
rougailconfig["doc.contents"] = ["changelog"]
rougailconfig["doc.previous_json_file"] = str(PREVIOUS)
inv_doc = inventory.run()[1]
if file_found and inv_doc:
doc += inv_formatter.title('Changelog', 3)
cmd = CMD + "-o doc --doc.contents variables changelog -do github"
doc += f'```console\n{cmd}\n```\n'
doc += inv_doc
# save PREVIOUS
rougailconfig["doc.contents"] = ["variables"]
rougailconfig['doc.output_format'] = 'json'
data = inventory.run()[1]
if data:
with PREVIOUS.open('w') as fh:
dump(loads(data), fh)
#
rougailconfig['step.output'] = 'console'
config = Path('config')
if config.is_dir():
doc += inventory.formatter.title('User data', 2)
doc += inv_formatter.title('User data', 2)
configs = list(config.iterdir())
configs.sort()
for idx, dirname in enumerate(configs):
@ -106,24 +128,24 @@ if __name__ == "__main__":
continue
for filename in dirname.iterdir():
if filename.name.endswith('.yml') or filename.name.endswith('.yaml'):
doc += inventory.formatter.title(f'Example {idx + 1}', 3)
doc += inventory.formatter.title(str(filename), 4)
doc += inv_formatter.title(f'Example {idx + 1}', 3)
doc += inv_formatter.title(str(filename), 4)
doc += '\n```yml\n'
with filename.open(encoding="utf8") as file_fh:
doc += file_fh.read()
doc += '\n```\n'
# with filename.open(encoding="utf8") as file_fh:
# objects = yaml.load(file_fh)
# doc += inventory.formatter.yaml(objects)
# doc += inv_formatter.yaml(objects)
#readme = dirname / 'README.md'
#if readme.is_file():
# doc += inventory.formatter.title('Description', 4)
# doc += inv_formatter.title('Description', 4)
# with readme.open() as fh:
# doc += fh.read() + '\n\n'
rougail = Rougail(rougailconfig)
tiramisu_config = rougail.run()
rougailconfig['step.user_data'] = ['yaml']
rougailconfig['yaml.filename'] = [str(filename.absolute())]
rougailconfig['yaml.filename'] = [str(filename)]
data = RougailUserDataYaml(tiramisu_config, rougailconfig=rougailconfig)
ret = data.run()
errors = rougail.user_datas(ret)
@ -134,7 +156,7 @@ if __name__ == "__main__":
)
console = export.run()[1]
conv = Ansi2HTMLConverter(inline=True)
doc += inventory.formatter.title('Output', 4)
doc += inv_formatter.title('Output', 4)
cmd = CMD + f"-u yaml -ff {filename}"
doc += f"```console\n{cmd}\n```\n"
conv_data = '<pre>' + conv.convert(console, full=False) + "</pre>\n"
@ -150,7 +172,7 @@ if __name__ == "__main__":
)
console = export.run()[1]
conv = Ansi2HTMLConverter(inline=True)
doc += inventory.formatter.title('Output in read write mode', 4)
doc += inv_formatter.title('Output in read write mode', 4)
cmd = cmd + " --cli.read_write"
doc += f"```console\n{cmd}\n```\n"
conv_data = '<pre>' + conv.convert(console, full=False) + "</pre>\n"

View file

@ -40,7 +40,7 @@ cd - > /dev/null
for i in $(ls -d "examples"/* | sort); do
num=$(echo $(basename "$i"))
echo "$num"
commit_id="v$VERSION_$num"
commit_id="v${VERSION}_$num"
summary="[tutorial $(basename $i)] $(head -n 1 $i/README.md)"
echo "- [$summary](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/$commit_id/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/${commit_id}~1..$commit_id))" >> summary_total.md
done
@ -56,7 +56,7 @@ for i in $(ls -d "examples"/* | sort); do
rm -rf "$DEST/config"
num=$(echo $(basename "$i"))
echo "$num"
commit_id="v$VERSION_$num"
commit_id="v${VERSION}_$num"
summary="[tutorial $(basename $i)] $(head -n 1 $i/README.md)"
diff_url="https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/${commit_id}~1..$commit_id"
echo " - [$summary](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/$commit_id/README.md) ([diff]($diff_url))" >> summary.md
@ -100,7 +100,7 @@ for i in $(ls -d "examples"/* | sort); do
if [ -f config/mode ]; then
mv config/mode mode
fi
"$BUILDER"/build.py "$VERSION"
"$BUILDER"/build.py "$commit_id"
rm -rf config/*/README.md config/read_write config/namespace
rm -rf jinja_caches summary.md summary_before.md summary_after.md summary_total.md
if [ -f mode ]; then

View file

@ -1 +0,0 @@
The format version in commandline

View file

@ -1,4 +0,0 @@
%YAML 1.2
---
version: 1.1
...

View file

@ -1 +0,0 @@
Type variable is optional

View file

@ -1 +1 @@
Bases type is optional if default value
Copy HTTP manual proxy to HTTPS manual proxy

View file

@ -5,4 +5,17 @@ version: 1.1
manual:
use_for_https: true # Also use this proxy for HTTPS
https_proxy: # HTTPS Proxy
address:
description: HTTPS address
type: domainname
params:
allow_ip: true
port:
description: HTTPS Port
type: port
default: 8080
...

View file

@ -1 +1 @@
Copy HTTP manual proxy to HTTPS manual proxy
An hidden family

View file

@ -6,7 +6,9 @@ manual:
use_for_https: true # Also use this proxy for HTTPS
https_proxy: # HTTPS Proxy
https_proxy:
description: HTTPS Proxy
hidden: true
address:
description: HTTPS address

View file

@ -1 +1 @@
An hidden family
A conditional hidden family with a variable

View file

@ -8,7 +8,8 @@ manual:
https_proxy:
description: HTTPS Proxy
hidden: true
hidden:
variable: _.use_for_https
address:
description: HTTPS address

View file

@ -1 +1 @@
A conditional hidden family with a variable
A calculated default value

View file

@ -16,9 +16,12 @@ manual:
type: domainname
params:
allow_ip: true
default:
variable: __.http_proxy.address
port:
description: HTTPS Port
type: port
default: 8080
default:
variable: __.http_proxy.port
...

View file

@ -1 +1 @@
A calculated default value
Variable type and parameters type are copied with default value

View file

@ -1 +1 @@
../013/config
../017/config

View file

@ -13,15 +13,11 @@ manual:
address:
description: HTTPS address
type: domainname
params:
allow_ip: true
default:
variable: __.http_proxy.address
port:
description: HTTPS Port
type: port
default:
variable: __.http_proxy.port
...

View file

@ -1 +0,0 @@
Variable type and parameters type are copied with default value

View file

@ -1 +0,0 @@
../017/config

View file

@ -1,23 +0,0 @@
%YAML 1.2
---
version: 1.1
manual:
use_for_https: true # Also use this proxy for HTTPS
https_proxy:
description: HTTPS Proxy
hidden:
variable: _.use_for_https
address:
description: HTTPS address
default:
variable: __.http_proxy.address
port:
description: HTTPS Port
default:
variable: __.http_proxy.port
...

View file

@ -1 +1 @@
Family: "shorthand" mode
A variable with type "web_address"

View file

@ -1 +1 @@
Shorthand mode
Automatic proxy

View file

@ -1 +0,0 @@
../010/config

View file

@ -0,0 +1,2 @@
---
auto: https://auto.proxy.net/wpad.dat

View file

@ -0,0 +1,2 @@
---
proxy_mode: Automatic proxy configuration URL

BIN
examples/050/firefox.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

View file

@ -1,23 +0,0 @@
%YAML 1.2
---
version: 1.1
manual:
description: Manual proxy configuration
disabled:
variable: _.proxy_mode
when_not: Manual proxy configuration
http_proxy: # HTTP Proxy
address:
description: HTTP address
type: domainname
params:
allow_ip: true
port:
description: HTTP Port
type: port
default: 8080
...

View file

@ -1 +1 @@
Variable: "shorthand" mode
A conditional disabled variable

View file

@ -1 +0,0 @@
../013/config

View file

@ -0,0 +1,2 @@
---
auto: https://auto.proxy.net/wpad.dat

View file

@ -0,0 +1,2 @@
---
proxy_mode: Automatic proxy configuration URL

View file

@ -1,43 +0,0 @@
%YAML 1.2
---
version: 1.1
manual:
use_for_https: true # Also use this proxy for HTTPS
'{{ identifier }}_proxy':
description: '{{ identifier }} Proxy'
hidden:
jinja: |-
{% if my_identifier == 'HTTPS' and manual.use_for_https %}
HTTPS is same has HTTP
{% endif %}
description: in HTTPS case if "manual.use_for_https" is set to True
params:
my_identifier:
type: identifier
dynamic:
- HTTPS
- SOCKS
address:
description: '{{ identifier }} address'
default:
variable: __.http_proxy.address
port:
description: '{{ identifier }} port'
default:
variable: __.http_proxy.port
version:
description: SOCKS host version used by proxy
choices:
- v4
- v5
default: v5
disabled:
type: identifier
when: HTTPS
...

View file

@ -1 +1 @@
A variable with type "web_address"
A variable with type "domainname", parameters type and disabled

View file

@ -1 +1 @@
Automatic proxy
Address for which proxy will be desactivated

View file

@ -1,2 +1 @@
---
auto: https://auto.proxy.net/wpad.dat

View file

@ -1,2 +1,4 @@
---
proxy_mode: Automatic proxy configuration URL
auto: https://auto.proxy.net/wpad.dat
no_proxy: 192.168.1.0/24

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

View file

@ -1 +1 @@
A conditional disabled variable
A variable with multiple value

View file

@ -1,2 +1 @@
---
auto: https://auto.proxy.net/wpad.dat

View file

@ -1,2 +1,6 @@
---
proxy_mode: Automatic proxy configuration URL
auto: https://auto.proxy.net/wpad.dat
no_proxy:
- example.net
- 192.168.1.0/24

1
examples/062/README.md Normal file
View file

@ -0,0 +1 @@
A non mandatory variable

1
examples/063/README.md Normal file
View file

@ -0,0 +1 @@
Examples

View file

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 118 KiB

View file

@ -1 +1 @@
A variable with type "domainname", parameters type and disabled
A boolean variable

View file

@ -1 +1 @@
Address for which proxy will be desactivated
DNS over HTTPS

View file

@ -1,4 +0,0 @@
---
proxy_mode: Automatic proxy configuration URL
auto: https://auto.proxy.net/wpad.dat
no_proxy: 192.168.1.0/24

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

View file

@ -0,0 +1,8 @@
%YAML 1.2
---
version: 1.1
dns_over_https: # DNS over HTTPS
enable_dns_over_https: false # Enable DNS over HTTPS
...

Some files were not shown because too many files have changed in this diff Show more