fix: update
This commit is contained in:
parent
11ebbb8dc5
commit
21669746a3
63 changed files with 229 additions and 47 deletions
92
build.py
92
build.py
|
|
@ -8,6 +8,7 @@ from ansi2html import Ansi2HTMLConverter
|
|||
from bs4 import BeautifulSoup
|
||||
|
||||
from rougail import Rougail
|
||||
from rougail.user_data import mandatories
|
||||
from rougail.config import get_rougail_config
|
||||
from rougail.output_display import RougailOutputDisplay
|
||||
from rougail.user_data_yaml import RougailUserDataYaml
|
||||
|
|
@ -48,6 +49,7 @@ if __name__ == "__main__":
|
|||
rougailconfig['doc.output_format'] = 'github'
|
||||
rougailconfig['doc.title_level'] = 3
|
||||
inventory = RougailOutputDoc(config, rougailconfig=rougailconfig)
|
||||
inventory.load()
|
||||
inventory.load_formatter()
|
||||
inv_formatter = inventory.formatter
|
||||
rougailconfig['step.output'] = 'display'
|
||||
|
|
@ -102,6 +104,7 @@ if __name__ == "__main__":
|
|||
with display_yml.open(encoding="utf8") as file_fh:
|
||||
doc += file_fh.read()
|
||||
doc += '\n```\n'
|
||||
doc += "\n***\n"
|
||||
rougailconfig['step.output'] = 'doc'
|
||||
rougailconfig["doc.title_level"] = 4
|
||||
inv_doc = inventory.run()[1]
|
||||
|
|
@ -117,6 +120,7 @@ if __name__ == "__main__":
|
|||
cmd = CMD + "-o doc"
|
||||
doc += f'```shell\n{cmd}\n```\n'
|
||||
doc += inv_doc
|
||||
doc += "\n***\n"
|
||||
if previous.is_file():
|
||||
rougailconfig["doc.contents"] = ["changelog"]
|
||||
rougailconfig["doc.changelog.previous_json_file"] = str(previous)
|
||||
|
|
@ -126,6 +130,7 @@ if __name__ == "__main__":
|
|||
cmd = CMD + "-o doc --doc.contents changelog"
|
||||
doc += f'```shell\n{cmd}\n```\n'
|
||||
doc += inv_doc + "\n"
|
||||
doc += "***\n"
|
||||
# save PREVIOUS
|
||||
rougailconfig["doc.contents"] = ["variables"]
|
||||
rougailconfig['doc.output_format'] = 'json'
|
||||
|
|
@ -135,10 +140,10 @@ if __name__ == "__main__":
|
|||
dump(loads(data), fh)
|
||||
#
|
||||
rougailconfig['step.output'] = 'display'
|
||||
config = Path('config')
|
||||
if config.is_dir():
|
||||
config_dir = Path('config')
|
||||
if config_dir.is_dir():
|
||||
doc += inv_formatter.title('User datas', 2)
|
||||
configs = list(config.iterdir())
|
||||
configs = list(config_dir.iterdir())
|
||||
configs.sort()
|
||||
for idx, dirname in enumerate(configs):
|
||||
if dirname.is_file():
|
||||
|
|
@ -151,6 +156,7 @@ if __name__ == "__main__":
|
|||
with filename.open(encoding="utf8") as file_fh:
|
||||
doc += file_fh.read()
|
||||
doc += '```\n'
|
||||
doc += "\n***\n"
|
||||
rougail = Rougail(rougailconfig)
|
||||
tiramisu_config = rougail.run()
|
||||
rougailconfig['step.user_data'] = ['yaml']
|
||||
|
|
@ -158,6 +164,8 @@ if __name__ == "__main__":
|
|||
data = RougailUserDataYaml(tiramisu_config, rougailconfig=rougailconfig)
|
||||
ret = data.run()
|
||||
errors = rougail.user_data(ret)
|
||||
tiramisu_config.property.read_only()
|
||||
mandatories(tiramisu_config, errors["errors"])
|
||||
rougailconfig['display.output_format'] = "console"
|
||||
export = RougailOutputDisplay(tiramisu_config,
|
||||
rougailconfig=rougailconfig,
|
||||
|
|
@ -181,8 +189,12 @@ if __name__ == "__main__":
|
|||
user_data_warnings=errors['warnings'],
|
||||
)
|
||||
doc += export.run()[1]
|
||||
doc += "\n***\n"
|
||||
if (dirname / 'invalid').is_file():
|
||||
tiramisu_config.property.read_write()
|
||||
errors2 = rougail.user_data(ret, invalid_user_data_error=True)
|
||||
tiramisu_config.property.read_only()
|
||||
mandatories(tiramisu_config, errors2["errors"])
|
||||
rougailconfig['display.output_format'] = "console"
|
||||
export = RougailOutputDisplay(tiramisu_config,
|
||||
rougailconfig=rougailconfig,
|
||||
|
|
@ -191,7 +203,7 @@ if __name__ == "__main__":
|
|||
)
|
||||
console = export.run()[1]
|
||||
conv = Ansi2HTMLConverter(inline=True)
|
||||
doc += inv_formatter.title('Output when invalid user datas is an error', 4)
|
||||
doc += inv_formatter.title('Output when invalid user data is an error', 4)
|
||||
cmd2 = cmd + " --cli.invalid_user_data_error"
|
||||
with (dirname / "cmd_invalid.txt").open("w") as fh:
|
||||
fh.write(cmd2)
|
||||
|
|
@ -206,12 +218,79 @@ if __name__ == "__main__":
|
|||
user_data_warnings=errors2['warnings'],
|
||||
)
|
||||
doc += export.run()[1]
|
||||
doc += "\n***\n"
|
||||
if (dirname / 'unknown').is_file():
|
||||
tiramisu_config.property.read_write()
|
||||
trougailconfig = rougailconfig.copy()
|
||||
errors2 = rougail.user_data(ret, unknown_user_data_error=True)
|
||||
tiramisu_config.property.read_only()
|
||||
mandatories(tiramisu_config, errors2["errors"])
|
||||
trougailconfig['display.output_format'] = "console"
|
||||
export = RougailOutputDisplay(tiramisu_config,
|
||||
rougailconfig=trougailconfig,
|
||||
user_data_errors=errors2['errors'],
|
||||
user_data_warnings=errors2['warnings'],
|
||||
)
|
||||
console = export.run()[1]
|
||||
conv = Ansi2HTMLConverter(inline=True)
|
||||
doc += inv_formatter.title('Output when unknown user data is an error', 4)
|
||||
cmd2 = cmd + " --cli.unknown_user_data_error"
|
||||
with (dirname / "cmd_unknown.txt").open("w") as fh:
|
||||
fh.write(cmd2)
|
||||
doc += f"```shell\n{cmd2}\n```\n"
|
||||
conv_data = '<pre>' + conv.convert(console, full=False) + "</pre>\n"
|
||||
with open(dirname / 'output_unknown.html', 'w') as fh_output:
|
||||
fh_output.write(conv_data)
|
||||
trougailconfig['display.output_format'] = "github"
|
||||
export = RougailOutputDisplay(tiramisu_config,
|
||||
rougailconfig=trougailconfig,
|
||||
user_data_errors=errors2['errors'],
|
||||
user_data_warnings=errors2['warnings'],
|
||||
)
|
||||
doc += export.run()[1]
|
||||
doc += "\n***\n"
|
||||
if (dirname / 'root').is_file():
|
||||
tiramisu_config.property.read_write()
|
||||
trougailconfig = rougailconfig.copy()
|
||||
errors2 = rougail.user_data(ret, unknown_user_data_error=True)
|
||||
tiramisu_config.property.read_only()
|
||||
with (dirname / 'root').open() as root_fh:
|
||||
root_path = root_fh.read().strip()
|
||||
root_tiramisu_config = tiramisu_config
|
||||
for r in root_path.split('.'):
|
||||
root_tiramisu_config = root_tiramisu_config.option(r)
|
||||
mandatories(tiramisu_config, errors2["errors"])
|
||||
trougailconfig['display.output_format'] = "console"
|
||||
export = RougailOutputDisplay(root_tiramisu_config,
|
||||
root_config=tiramisu_config,
|
||||
rougailconfig=trougailconfig,
|
||||
user_data_errors=errors2['errors'],
|
||||
user_data_warnings=errors2['warnings'],
|
||||
)
|
||||
console = export.run()[1]
|
||||
conv = Ansi2HTMLConverter(inline=True)
|
||||
doc += inv_formatter.title(f'Output for "{root_path}"', 4)
|
||||
cmd2 = cmd + f" --cli.root {root_path}"
|
||||
with (dirname / "cmd_root.txt").open("w") as fh:
|
||||
fh.write(cmd2)
|
||||
doc += f"```shell\n{cmd2}\n```\n"
|
||||
conv_data = '<pre>' + conv.convert(console, full=False) + "</pre>\n"
|
||||
with open(dirname / 'output_root.html', 'w') as fh_output:
|
||||
fh_output.write(conv_data)
|
||||
trougailconfig['display.output_format'] = "github"
|
||||
export = RougailOutputDisplay(root_tiramisu_config,
|
||||
root_config = tiramisu_config,
|
||||
rougailconfig=trougailconfig,
|
||||
user_data_errors=errors2['errors'],
|
||||
user_data_warnings=errors2['warnings'],
|
||||
)
|
||||
doc += export.run()[1]
|
||||
doc += "\n***\n"
|
||||
if (dirname / 'read_write').is_file():
|
||||
trougailconfig = rougailconfig.copy()
|
||||
trougailconfig["display.mandatory"] = False
|
||||
tiramisu_config.property.read_write()
|
||||
errors2 = rougail.user_data(ret, invalid_user_data_error=True)
|
||||
rougailconfig['display.output_format'] = "console"
|
||||
trougailconfig['display.output_format'] = "console"
|
||||
export = RougailOutputDisplay(tiramisu_config,
|
||||
rougailconfig=trougailconfig,
|
||||
user_data_errors=errors2['errors'],
|
||||
|
|
@ -234,6 +313,7 @@ if __name__ == "__main__":
|
|||
user_data_warnings=errors2['warnings'],
|
||||
)
|
||||
doc += export.run()[1]
|
||||
doc += "\n***\n"
|
||||
tiramisu_config.property.read_only()
|
||||
#
|
||||
summary = Path('summary_after.md')
|
||||
|
|
|
|||
8
build.sh
8
build.sh
|
|
@ -50,8 +50,11 @@ for i in $(ls -d "examples"/* | sort); do
|
|||
done
|
||||
|
||||
for i in $(ls -d "examples"/* | sort); do
|
||||
if [ -f $i/URL ]; then
|
||||
base_url_doc=$(cat $i/URL)
|
||||
fi
|
||||
if [ -f "$i/TITLE.md" ]; then
|
||||
echo "- $(head -n 1 $i/TITLE.md)" >> summary.md
|
||||
echo "- [$(head -n 1 $i/TITLE.md)]($base_url_doc)" >> summary.md
|
||||
fi
|
||||
if [ -f "$i/SUBTITLE.md" ]; then
|
||||
echo " - $(head -n 1 $i/SUBTITLE.md)" >> summary.md
|
||||
|
|
@ -63,9 +66,6 @@ for i in $(ls -d "examples"/* | sort); do
|
|||
commit_id="v${VERSION}_$num"
|
||||
title=$(head -n 1 $i/README.md)
|
||||
summary="[tutorial $commit_id] $title"
|
||||
if [ -f $i/URL ]; then
|
||||
base_url_doc=$(cat $i/URL)
|
||||
fi
|
||||
url_doc="$base_url_doc#$(echo $title | tr A-Z a-z | sed 's/ /-/g' | sed 's/’/-/g')"
|
||||
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) ([doc]($url_doc) - [diff]($diff_url))" >> summary.md
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
A variable with a list of possible values
|
||||
A variable with possible values
|
||||
|
|
|
|||
1
examples/010/URL
Normal file
1
examples/010/URL
Normal file
|
|
@ -0,0 +1 @@
|
|||
https://pedago.gwenaelremond.fr/bribes/rougail/tutorial/choice.html
|
||||
|
|
@ -1 +1 @@
|
|||
Group variables inside "families"
|
||||
Group variables inside families
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
https://pedago.gwenaelremond.fr/bribes/rougail/tutorial/proxymode.html
|
||||
https://pedago.gwenaelremond.fr/bribes/rougail/tutorial/family.html
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Constrainte the value of a variable with it's type
|
||||
Some suitable types
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
https://pedago.gwenaelremond.fr/bribes/rougail/tutorial/disabled.html
|
||||
https://pedago.gwenaelremond.fr/bribes/rougail/tutorial/types.html
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
A disabled family
|
||||
HTTPS family
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
Property disabled
|
||||
|
|
@ -1 +1 @@
|
|||
Define access to variable or family
|
||||
Calculated default value for a variable
|
||||
|
|
|
|||
1
examples/040/URL
Normal file
1
examples/040/URL
Normal file
|
|
@ -0,0 +1 @@
|
|||
https://pedago.gwenaelremond.fr/bribes/rougail/tutorial/calculated.html
|
||||
|
|
@ -6,9 +6,7 @@ manual:
|
|||
|
||||
use_for_https: true # Also use this proxy for HTTPS
|
||||
|
||||
https_proxy:
|
||||
description: HTTPS Proxy
|
||||
hidden: true
|
||||
https_proxy: # HTTPS Proxy
|
||||
|
||||
address:
|
||||
description: HTTPS address
|
||||
|
|
@ -1 +1 @@
|
|||
A conditional disabled family
|
||||
A default value calculated from another variable
|
||||
|
|
|
|||
|
|
@ -1 +1,9 @@
|
|||
---
|
||||
proxy_mode: Manual proxy configuration
|
||||
manual:
|
||||
http_proxy:
|
||||
address: http.proxy.net
|
||||
port: 3128
|
||||
use_for_https: false
|
||||
https_proxy:
|
||||
address: https.proxy.net
|
||||
|
|
|
|||
20
examples/041/structural_files/firefox/20-manual.yml
Normal file
20
examples/041/structural_files/firefox/20-manual.yml
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
%YAML 1.2
|
||||
---
|
||||
version: 1.1
|
||||
|
||||
manual:
|
||||
|
||||
use_for_https: true # Also use this proxy for HTTPS
|
||||
|
||||
https_proxy: # HTTPS Proxy
|
||||
|
||||
address:
|
||||
description: HTTPS address
|
||||
default:
|
||||
variable: __.http_proxy.address
|
||||
|
||||
port:
|
||||
description: HTTPS Port
|
||||
default:
|
||||
variable: __.http_proxy.port
|
||||
...
|
||||
|
|
@ -1 +0,0 @@
|
|||
Property hidden
|
||||
|
|
@ -1 +1 @@
|
|||
A calculated default value
|
||||
A disabled family
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Calculated default value for a variable
|
||||
Define access to variable or family
|
||||
|
|
|
|||
|
|
@ -1,9 +1 @@
|
|||
---
|
||||
proxy_mode: Manual proxy configuration
|
||||
manual:
|
||||
http_proxy:
|
||||
address: http.proxy.net
|
||||
port: 3128
|
||||
use_for_https: false
|
||||
https_proxy:
|
||||
address: https.proxy.net
|
||||
|
|
|
|||
BIN
examples/050/firefox.png
Normal file
BIN
examples/050/firefox.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 117 KiB |
1
examples/051/README.md
Normal file
1
examples/051/README.md
Normal file
|
|
@ -0,0 +1 @@
|
|||
A conditional disabled family
|
||||
0
examples/051/structural_files/DISPLAY_10-manual.yml
Normal file
0
examples/051/structural_files/DISPLAY_10-manual.yml
Normal file
0
examples/052/config/01/read_write
Normal file
0
examples/052/config/01/read_write
Normal file
BIN
examples/052/firefox.png
Normal file
BIN
examples/052/firefox.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 118 KiB |
|
|
@ -8,17 +8,15 @@ manual:
|
|||
|
||||
https_proxy:
|
||||
description: HTTPS Proxy
|
||||
hidden:
|
||||
variable: _.use_for_https
|
||||
hidden: true
|
||||
|
||||
address:
|
||||
description: HTTPS address
|
||||
type: domainname
|
||||
params:
|
||||
allow_ip: true
|
||||
default:
|
||||
variable: __.http_proxy.address
|
||||
|
||||
port:
|
||||
description: HTTPS Port
|
||||
type: port
|
||||
default: 8080
|
||||
default:
|
||||
variable: __.http_proxy.port
|
||||
...
|
||||
2
examples/053/config/01/README.md
Normal file
2
examples/053/config/01/README.md
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
If "use_for_https" is false, HTTPS variables are visible in read only mode and in read write mode.
|
||||
|
||||
9
examples/053/config/01/config.yml
Normal file
9
examples/053/config/01/config.yml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
proxy_mode: Manual proxy configuration
|
||||
manual:
|
||||
http_proxy:
|
||||
address: http.proxy.net
|
||||
port: 3128
|
||||
use_for_https: false
|
||||
https_proxy:
|
||||
address: https.proxy.net
|
||||
2
examples/053/config/02/README.md
Normal file
2
examples/053/config/02/README.md
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
If "use_for_https" is false, HTTPS variables are visible in read only mode and in read write mode.
|
||||
|
||||
7
examples/053/config/02/config.yml
Normal file
7
examples/053/config/02/config.yml
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
proxy_mode: Manual proxy configuration
|
||||
manual:
|
||||
http_proxy:
|
||||
address: http.proxy.net
|
||||
port: 3128
|
||||
use_for_https: true
|
||||
|
|
@ -1 +1 @@
|
|||
Family: a dynamic family
|
||||
A dynamically built family
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Dynamic family
|
||||
A dynamically built family
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
https://pedago.gwenaelremond.fr/bribes/rougail/tutorial/calculation.html
|
||||
https://pedago.gwenaelremond.fr/bribes/rougail/tutorial/jinja.html
|
||||
|
|
|
|||
1
examples/070/config/01/root
Normal file
1
examples/070/config/01/root
Normal file
|
|
@ -0,0 +1 @@
|
|||
manual.https_proxy
|
||||
2
examples/070/config/02/README.md
Normal file
2
examples/070/config/02/README.md
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
If "use_for_https" is false, HTTPS variables are visible in read only mode and in read write mode.
|
||||
|
||||
9
examples/070/config/02/config.yml
Normal file
9
examples/070/config/02/config.yml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
proxy_mode: Manual proxy configuration
|
||||
manual:
|
||||
http_proxy:
|
||||
address: http.proxy.net
|
||||
port: 3128
|
||||
use_for_https: true
|
||||
https_proxy:
|
||||
address: https.proxy.net
|
||||
1
examples/070/config/02/root
Normal file
1
examples/070/config/02/root
Normal file
|
|
@ -0,0 +1 @@
|
|||
manual.https_proxy
|
||||
1
examples/073/README.md
Normal file
1
examples/073/README.md
Normal file
|
|
@ -0,0 +1 @@
|
|||
Jinja could returns a boolean
|
||||
2
examples/073/config/01/README.md
Normal file
2
examples/073/config/01/README.md
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
If "use_for_https" is false, HTTPS variables are visible in read only mode and in read write mode.
|
||||
|
||||
9
examples/073/config/01/config.yml
Normal file
9
examples/073/config/01/config.yml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
proxy_mode: Manual proxy configuration
|
||||
manual:
|
||||
http_proxy:
|
||||
address: http.proxy.net
|
||||
port: 3128
|
||||
use_for_https: false
|
||||
https_proxy:
|
||||
address: https.proxy.net
|
||||
42
examples/073/structural_files/firefox/20-manual.yml
Normal file
42
examples/073/structural_files/firefox/20-manual.yml
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
%YAML 1.2
|
||||
---
|
||||
version: 1.1
|
||||
|
||||
manual:
|
||||
|
||||
use_for_https: true # Also use this proxy for HTTPS
|
||||
|
||||
'{{ identifier }}_proxy':
|
||||
description: '{{ identifier }} Proxy'
|
||||
hidden:
|
||||
jinja: |-
|
||||
{{ my_identifier == 'HTTPS' and _.use_for_https }}
|
||||
return_type: boolean
|
||||
description: in HTTPS case if "_.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
|
||||
...
|
||||
|
|
@ -1 +1 @@
|
|||
Various variables
|
||||
A web_address variable
|
||||
|
|
|
|||
1
examples/090/TITLE.md
Normal file
1
examples/090/TITLE.md
Normal file
|
|
@ -0,0 +1 @@
|
|||
A full documented variable with multiple values and not mandatory
|
||||
|
|
@ -1 +0,0 @@
|
|||
Multiple variable
|
||||
|
|
@ -1 +0,0 @@
|
|||
Mandatory
|
||||
|
|
@ -1 +0,0 @@
|
|||
Extras informations for a variable
|
||||
Loading…
Reference in a new issue