Compare commits
No commits in common. "0.1.0a5" and "main" have entirely different histories.
81 changed files with 117 additions and 553 deletions
47
CHANGELOG.md
47
CHANGELOG.md
|
|
@ -1,47 +0,0 @@
|
||||||
## 0.1.0a5 (2025-03-27)
|
|
||||||
|
|
||||||
### Fix
|
|
||||||
|
|
||||||
- if and for in 3 lines
|
|
||||||
|
|
||||||
## 0.1.0a4 (2025-03-27)
|
|
||||||
|
|
||||||
### Feat
|
|
||||||
|
|
||||||
- format jinja template
|
|
||||||
|
|
||||||
## 0.1.0a3 (2025-03-27)
|
|
||||||
|
|
||||||
### Feat
|
|
||||||
|
|
||||||
- add secret_manager support
|
|
||||||
- add Namespace(Param|Calculation) support
|
|
||||||
|
|
||||||
### Fix
|
|
||||||
|
|
||||||
- do not add namespace in param
|
|
||||||
- an empty variable is []
|
|
||||||
|
|
||||||
## 0.1.0a2 (2025-03-26)
|
|
||||||
|
|
||||||
### Fix
|
|
||||||
|
|
||||||
- pyproject.toml
|
|
||||||
|
|
||||||
## 0.1.0a1 (2025-03-26)
|
|
||||||
|
|
||||||
### Fix
|
|
||||||
|
|
||||||
- add pyproject.toml
|
|
||||||
|
|
||||||
## 0.1.0a0 (2025-02-10)
|
|
||||||
|
|
||||||
### Feat
|
|
||||||
|
|
||||||
- output return status too
|
|
||||||
|
|
||||||
## 0.0.1a0 (2025-01-04)
|
|
||||||
|
|
||||||
### Fix
|
|
||||||
|
|
||||||
- remove prefix_path
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
||||||
[build-system]
|
|
||||||
build-backend = "flit_core.buildapi"
|
|
||||||
requires = ["flit_core >=3.8.0,<4"]
|
|
||||||
|
|
||||||
[project]
|
|
||||||
name = "rougail.output_formatter"
|
|
||||||
version = "0.1.0a5"
|
|
||||||
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
|
|
||||||
readme = "README.md"
|
|
||||||
description = "Rougail output formatter"
|
|
||||||
requires-python = ">=3.8"
|
|
||||||
license = {file = "LICENSE"}
|
|
||||||
classifiers = [
|
|
||||||
"License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)",
|
|
||||||
"Programming Language :: Python",
|
|
||||||
"Programming Language :: Python :: 3.8",
|
|
||||||
"Programming Language :: Python :: 3.9",
|
|
||||||
"Programming Language :: Python :: 3.10",
|
|
||||||
"Programming Language :: Python :: 3.11",
|
|
||||||
"Programming Language :: Python :: 3.12",
|
|
||||||
"Programming Language :: Python :: 3.13",
|
|
||||||
"Programming Language :: Python :: 3.14",
|
|
||||||
"Programming Language :: Python :: 3",
|
|
||||||
"Operating System :: OS Independent",
|
|
||||||
"Natural Language :: English",
|
|
||||||
"Natural Language :: French",
|
|
||||||
|
|
||||||
]
|
|
||||||
dependencies = [
|
|
||||||
"rougail >= 1.1,<2",
|
|
||||||
"djlint == 1.36.4",
|
|
||||||
]
|
|
||||||
|
|
||||||
[project.urls]
|
|
||||||
Home = "https://forge.cloud.silique.fr/stove/rougail-output-formatter"
|
|
||||||
|
|
||||||
[tool.commitizen]
|
|
||||||
name = "cz_conventional_commits"
|
|
||||||
tag_format = "$version"
|
|
||||||
version_scheme = "pep440"
|
|
||||||
version_provider = "pep621"
|
|
||||||
update_changelog_on_bump = true
|
|
||||||
changelog_merge_prerelease = true
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
"""
|
"""
|
||||||
Silique (https://www.silique.fr)
|
Silique (https://www.silique.fr)
|
||||||
Copyright (C) 2024-2025
|
Copyright (C) 2024
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify it
|
This program is free software: you can redistribute it and/or modify it
|
||||||
under the terms of the GNU Lesser General Public License as published by the
|
under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
@ -27,14 +27,11 @@ from ruamel.yaml.error import CommentMark
|
||||||
from ruamel.yaml.comments import CommentedSeq
|
from ruamel.yaml.comments import CommentedSeq
|
||||||
from ruamel.yaml.scalarstring import LiteralScalarString, FoldedScalarString
|
from ruamel.yaml.scalarstring import LiteralScalarString, FoldedScalarString
|
||||||
|
|
||||||
from djlint.settings import Config
|
|
||||||
from djlint.reformat import formatter
|
|
||||||
|
|
||||||
from tiramisu import undefined
|
from tiramisu import undefined
|
||||||
from tiramisu.config import get_common_path
|
from tiramisu.config import get_common_path
|
||||||
|
|
||||||
from rougail.convert import RougailConvert
|
from rougail.convert import RougailConvert
|
||||||
from rougail.object_model import Variable, Family, Calculation, JinjaCalculation, IdentifierCalculation, IdentifierPropertyCalculation, NamespaceCalculation, IdentifierParam, IndexCalculation, IndexParam, NamespaceParam, Param
|
from rougail.object_model import Variable, Family, Calculation, JinjaCalculation, IdentifierCalculation, IdentifierPropertyCalculation, IdentifierParam, IndexCalculation, IndexParam, Param
|
||||||
from rougail.utils import normalize_family
|
from rougail.utils import normalize_family
|
||||||
|
|
||||||
from .upgrade import RougailUpgrade
|
from .upgrade import RougailUpgrade
|
||||||
|
|
@ -75,12 +72,6 @@ class RougailOutputFormatter:
|
||||||
filename = Path(filenames[0])
|
filename = Path(filenames[0])
|
||||||
if not filename.is_file():
|
if not filename.is_file():
|
||||||
raise Exception(_('only a file is allowed'))
|
raise Exception(_('only a file is allowed'))
|
||||||
|
|
||||||
self.config = Config()
|
|
||||||
self.config.profile = 'jinja'
|
|
||||||
self.config.line_break_after_multiline_tag = True
|
|
||||||
self.config.indent = " "
|
|
||||||
|
|
||||||
self.original_yaml = RougailUpgrade(rougailconfig).run(filename)
|
self.original_yaml = RougailUpgrade(rougailconfig).run(filename)
|
||||||
datas = RougailUpgrade(rougailconfig).run(filename)
|
datas = RougailUpgrade(rougailconfig).run(filename)
|
||||||
self.rougail = RougailConvert(rougailconfig)
|
self.rougail = RougailConvert(rougailconfig)
|
||||||
|
|
@ -116,12 +107,10 @@ class RougailOutputFormatter:
|
||||||
with BytesIO() as ymlfh:
|
with BytesIO() as ymlfh:
|
||||||
self.yaml.dump(self.families[None], ymlfh)
|
self.yaml.dump(self.families[None], ymlfh)
|
||||||
ret = ymlfh.getvalue().decode("utf-8").strip() + '\n'
|
ret = ymlfh.getvalue().decode("utf-8").strip() + '\n'
|
||||||
return True, ret
|
return ret
|
||||||
|
|
||||||
def print(self):
|
def print(self):
|
||||||
ret, data = self.run()
|
print(self.run())
|
||||||
print(data)
|
|
||||||
return ret
|
|
||||||
|
|
||||||
def parse(self):
|
def parse(self):
|
||||||
# FIXME path to relative !
|
# FIXME path to relative !
|
||||||
|
|
@ -170,7 +159,7 @@ class RougailOutputFormatter:
|
||||||
else:
|
else:
|
||||||
attributes = self.families_attributes
|
attributes = self.families_attributes
|
||||||
for attr, default_value in attributes.items():
|
for attr, default_value in attributes.items():
|
||||||
if attr in ["name", "path", "namespace", "version", "xmlfiles"]:
|
if attr in ["name", "path", "namespace", "version", "path_prefix", "xmlfiles"]:
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
value = getattr(obj, attr)
|
value = getattr(obj, attr)
|
||||||
|
|
@ -215,7 +204,7 @@ class RougailOutputFormatter:
|
||||||
multi = obj.multi or isinstance(obj.default, list)
|
multi = obj.multi or isinstance(obj.default, list)
|
||||||
type_ = obj.type
|
type_ = obj.type
|
||||||
for attr, default_value in self.variables_attributes.items():
|
for attr, default_value in self.variables_attributes.items():
|
||||||
if attr in ["name", "path", "namespace", "version", "xmlfiles"]:
|
if attr in ["name", "path", "namespace", "version", "path_prefix", "xmlfiles"]:
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
value = getattr(obj, attr)
|
value = getattr(obj, attr)
|
||||||
|
|
@ -249,9 +238,6 @@ class RougailOutputFormatter:
|
||||||
# if boolean, the default value is True
|
# if boolean, the default value is True
|
||||||
del variable["type"]
|
del variable["type"]
|
||||||
variable["default"] = True
|
variable["default"] = True
|
||||||
if "default" not in variable and variable.get("multi") is True and not set(variable) - {'default', 'description', "multi"}:
|
|
||||||
variable["default"] = []
|
|
||||||
del(variable['multi'])
|
|
||||||
if not isinstance(variable.get("default"), dict) and not set(variable) - {'default', 'description'}:
|
if not isinstance(variable.get("default"), dict) and not set(variable) - {'default', 'description'}:
|
||||||
# shorthand notation
|
# shorthand notation
|
||||||
default = variable.get('default')
|
default = variable.get('default')
|
||||||
|
|
@ -308,18 +294,10 @@ class RougailOutputFormatter:
|
||||||
if isinstance(value, JinjaCalculation):
|
if isinstance(value, JinjaCalculation):
|
||||||
jinja = CommentedMap()
|
jinja = CommentedMap()
|
||||||
# replace \n to space a add index of \n (now a space) to fold_pos
|
# replace \n to space a add index of \n (now a space) to fold_pos
|
||||||
jinja_values = formatter(self.config, value.jinja.strip())[:-1]
|
jinja_values = value.jinja.strip()
|
||||||
if key == 'default' and not multi:
|
if key == 'default' and not multi:
|
||||||
jinja["jinja"] = FoldedScalarString(jinja_values)
|
jinja["jinja"] = FoldedScalarString(jinja_values.replace('\n', ' '))
|
||||||
fold_pos = []
|
jinja["jinja"].fold_pos = [i for i, ltr in enumerate(jinja_values) if ltr == '\n']
|
||||||
old_i = 0
|
|
||||||
for i, ltr in enumerate(jinja_values):
|
|
||||||
if ltr == '\n':
|
|
||||||
fold_pos.append(i - old_i)
|
|
||||||
old_i = 1
|
|
||||||
jinja["jinja"].fold_pos = fold_pos
|
|
||||||
elif key == 'secret_manager':
|
|
||||||
return self.object_to_yaml("params", type_, value.params, multi, object_path)
|
|
||||||
else:
|
else:
|
||||||
jinja["jinja"] = LiteralScalarString(jinja_values)
|
jinja["jinja"] = LiteralScalarString(jinja_values)
|
||||||
if value.return_type:
|
if value.return_type:
|
||||||
|
|
@ -334,10 +312,8 @@ class RougailOutputFormatter:
|
||||||
variable = CommentedMap()
|
variable = CommentedMap()
|
||||||
if isinstance(value, (IdentifierCalculation, IdentifierPropertyCalculation)):
|
if isinstance(value, (IdentifierCalculation, IdentifierPropertyCalculation)):
|
||||||
variable["type"] = "identifier"
|
variable["type"] = "identifier"
|
||||||
elif isinstance(value, IndexCalculation):
|
if isinstance(value, IndexCalculation):
|
||||||
variable["type"] = "index"
|
variable["type"] = "index"
|
||||||
elif isinstance(value, NamespaceCalculation):
|
|
||||||
variable["type"] = "namespace"
|
|
||||||
for key, default in variable_attributes.items():
|
for key, default in variable_attributes.items():
|
||||||
val = getattr(value, key)
|
val = getattr(value, key)
|
||||||
if val != default and val is not undefined:
|
if val != default and val is not undefined:
|
||||||
|
|
@ -348,17 +324,15 @@ class RougailOutputFormatter:
|
||||||
del variable["type"]
|
del variable["type"]
|
||||||
return variable
|
return variable
|
||||||
elif isinstance(value, Param):
|
elif isinstance(value, Param):
|
||||||
param_attributes = self.get_object_informations(value, ["type", "key", "namespace"])
|
param_attributes = self.get_object_informations(value, ["type", "key"])
|
||||||
if list(param_attributes) == ['value']:
|
if list(param_attributes) == ['value']:
|
||||||
variable = value.value
|
variable = value.value
|
||||||
else:
|
else:
|
||||||
variable = CommentedMap()
|
variable = CommentedMap()
|
||||||
if isinstance(value, IdentifierParam):
|
if isinstance(value, IdentifierParam):
|
||||||
variable["type"] = "identifier"
|
variable["type"] = "identifier"
|
||||||
elif isinstance(value, IndexParam):
|
if isinstance(value, IndexParam):
|
||||||
variable["type"] = "index"
|
variable["type"] = "index"
|
||||||
elif isinstance(value, NamespaceParam):
|
|
||||||
variable["type"] = "namespace"
|
|
||||||
for key, default in param_attributes.items():
|
for key, default in param_attributes.items():
|
||||||
val = getattr(value, key)
|
val = getattr(value, key)
|
||||||
if val != default and val is not undefined:
|
if val != default and val is not undefined:
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
"""
|
"""
|
||||||
Silique (https://www.silique.fr)
|
Silique (https://www.silique.fr)
|
||||||
Copyright (C) 2024-2025
|
Copyright (C) 2024
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify it
|
This program is free software: you can redistribute it and/or modify it
|
||||||
under the terms of the GNU Lesser General Public License as published by the
|
under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
@ -29,14 +29,14 @@ load_unexist_redefine:
|
||||||
type: boolean
|
type: boolean
|
||||||
default:
|
default:
|
||||||
jinja: >-
|
jinja: >-
|
||||||
{% if step.output is not propertyerror and step.output == 'formatter' %}
|
{% if step.output == 'formatter' %}
|
||||||
true
|
true
|
||||||
{% else %}
|
{% else %}
|
||||||
false
|
false
|
||||||
{% endif %}
|
{% endif %}
|
||||||
hidden:
|
hidden:
|
||||||
jinja: >-
|
jinja: >-
|
||||||
{% if step.output is not propertyerror and step.output == 'formatter' %}
|
{% if step.output == 'formatter' %}
|
||||||
load_unexist_redefine is always true with 'formatter' output
|
load_unexist_redefine is always true with 'formatter' output
|
||||||
{% endif %}
|
{% endif %}
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ Cadoles (http://www.cadoles.com)
|
||||||
Copyright (C) 2021
|
Copyright (C) 2021
|
||||||
|
|
||||||
Silique (https://www.silique.fr)
|
Silique (https://www.silique.fr)
|
||||||
Copyright (C) 2022-2025
|
Copyright (C) 2022-2024
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify it
|
This program is free software: you can redistribute it and/or modify it
|
||||||
under the terms of the GNU Lesser General Public License as published by the
|
under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
---
|
|
||||||
version: 1.1
|
|
||||||
|
|
||||||
secret1:
|
|
||||||
description: the first variable
|
|
||||||
type: secret
|
|
||||||
|
|
||||||
secret2:
|
|
||||||
description: the second variable
|
|
||||||
type: secret
|
|
||||||
default: value
|
|
||||||
|
|
@ -5,7 +5,7 @@ variable:
|
||||||
description: a variable
|
description: a variable
|
||||||
default:
|
default:
|
||||||
jinja: >-
|
jinja: >-
|
||||||
{{ test_information }}
|
{{test_information }}
|
||||||
description: get information test_information
|
description: get information test_information
|
||||||
params:
|
params:
|
||||||
test_information:
|
test_information:
|
||||||
|
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
---
|
|
||||||
version: 1.1
|
|
||||||
|
|
||||||
variable:
|
|
||||||
description: a variable
|
|
||||||
default:
|
|
||||||
type: namespace
|
|
||||||
mandatory: false
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
---
|
|
||||||
version: 1.1
|
|
||||||
|
|
||||||
variable:
|
|
||||||
description: a variable
|
|
||||||
default:
|
|
||||||
jinja: >-
|
|
||||||
{{ namespace }}
|
|
||||||
params:
|
|
||||||
namespace:
|
|
||||||
type: namespace
|
|
||||||
mandatory: false
|
|
||||||
|
|
@ -5,15 +5,8 @@ var1:
|
||||||
description: a first variable
|
description: a first variable
|
||||||
default:
|
default:
|
||||||
jinja: >-
|
jinja: >-
|
||||||
{% if var2 is defined %}
|
{% if var2 is defined %} {{ var2 }} {% elif var3 is defined %} {{ var3 }} {%
|
||||||
{{ var2 }}
|
elif var4 is defined %} {{ var4 }} {% else %} {{ _.var2 }} {% endif %}
|
||||||
{% elif var3 is defined %}
|
|
||||||
{{ var3 }}
|
|
||||||
{% elif var4 is defined %}
|
|
||||||
{{ var4 }}
|
|
||||||
{% else %}
|
|
||||||
{{ _.var2 }}
|
|
||||||
{% endif %}
|
|
||||||
description: returns a value
|
description: returns a value
|
||||||
params:
|
params:
|
||||||
var2:
|
var2:
|
||||||
|
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
---
|
|
||||||
version: 1.1
|
|
||||||
|
|
||||||
condition: no # a conditional variable
|
|
||||||
|
|
||||||
variable1:
|
|
||||||
description: a first variable
|
|
||||||
multi: true
|
|
||||||
disabled:
|
|
||||||
jinja: |-
|
|
||||||
{% if _.condition == "yes" %}
|
|
||||||
condition is yes
|
|
||||||
{% endif %}
|
|
||||||
description: if condition is egal to "yes"
|
|
||||||
|
|
||||||
variable2:
|
|
||||||
description: a second variable
|
|
||||||
multi: true
|
|
||||||
disabled:
|
|
||||||
jinja: |-
|
|
||||||
{% if _.condition == "yes" %}
|
|
||||||
condition is yes
|
|
||||||
{% endif %}
|
|
||||||
description: if condition is egal to "yes"
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
---
|
|
||||||
version: 1.1
|
|
||||||
|
|
||||||
condition: false # a condition
|
|
||||||
|
|
||||||
variable:
|
|
||||||
description: a variable
|
|
||||||
multi: true
|
|
||||||
disabled:
|
|
||||||
variable: _.condition
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
---
|
|
||||||
version: 1.1
|
|
||||||
|
|
||||||
condition: [] # a condition
|
|
||||||
|
|
||||||
variable:
|
|
||||||
description: a variable
|
|
||||||
multi: true
|
|
||||||
disabled:
|
|
||||||
variable: _.condition
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
---
|
|
||||||
version: 1.1
|
|
||||||
|
|
||||||
condition: # a condition
|
|
||||||
- val1
|
|
||||||
- val2
|
|
||||||
|
|
||||||
variable:
|
|
||||||
description: a variable
|
|
||||||
multi: true
|
|
||||||
disabled:
|
|
||||||
variable: _.condition
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
---
|
|
||||||
version: 1.1
|
|
||||||
|
|
||||||
family:
|
|
||||||
exists: true
|
|
||||||
|
|
||||||
variable:
|
|
||||||
|
|
@ -1,36 +1,27 @@
|
||||||
---
|
---
|
||||||
version: 1.1
|
version: 1.1
|
||||||
|
|
||||||
var1: # first variable
|
var1: # a variable
|
||||||
|
|
||||||
family: # a family
|
family: # a family
|
||||||
|
|
||||||
var2:
|
var2: # a second variable
|
||||||
description: a second variable
|
|
||||||
test:
|
|
||||||
- string6
|
|
||||||
|
|
||||||
subfamily: # a sub family
|
subfamily: # a sub family
|
||||||
|
|
||||||
variable: # third variable
|
variable: # a variable
|
||||||
- variable: ___.var1
|
- variable: ___.var1
|
||||||
- variable: __.var2
|
- variable: __.var2
|
||||||
|
|
||||||
family2: # a family
|
family2: # a family
|
||||||
|
|
||||||
var2:
|
var2:
|
||||||
description: a variable2
|
|
||||||
default:
|
default:
|
||||||
variable: __.family.var2
|
variable: __.family.var2
|
||||||
|
|
||||||
var3:
|
|
||||||
test:
|
|
||||||
- string5
|
|
||||||
default: string4
|
|
||||||
|
|
||||||
subfamily: # a sub family
|
subfamily: # a sub family
|
||||||
|
|
||||||
variable: # fourth variable
|
variable: # a variable
|
||||||
- variable: ___.var1
|
- variable: ___.var1
|
||||||
- variable: ___.family.var2
|
- variable: ___.family.var2
|
||||||
- variable: __.var3
|
- variable: __.var2
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,9 @@ leader:
|
||||||
description: a leadership
|
description: a leadership
|
||||||
type: leadership
|
type: leadership
|
||||||
|
|
||||||
leader: [] # the leader
|
leader:
|
||||||
|
description: the leader
|
||||||
|
multi: true
|
||||||
|
|
||||||
follower1: # the follower1
|
follower1: # the follower1
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,13 @@ leadership:
|
||||||
description: A leadership
|
description: A leadership
|
||||||
type: leadership
|
type: leadership
|
||||||
|
|
||||||
leader: [] # The leader
|
leader:
|
||||||
|
description: The leader
|
||||||
|
multi: true
|
||||||
|
|
||||||
follower1: [] # The first follower
|
follower1:
|
||||||
|
description: The first follower
|
||||||
|
multi: true
|
||||||
|
|
||||||
follower2: # The second follower
|
follower2: # The second follower
|
||||||
- value
|
- value
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,7 @@ int1:
|
||||||
type: number
|
type: number
|
||||||
default:
|
default:
|
||||||
jinja: >-
|
jinja: >-
|
||||||
{% if rougail.bool %}
|
{% if rougail.bool %}1{% else %}2{% endif %}
|
||||||
1
|
|
||||||
{% else %}
|
|
||||||
2
|
|
||||||
{% endif %}
|
|
||||||
description: if bool returns 1 otherwise return 2
|
description: if bool returns 1 otherwise return 2
|
||||||
|
|
||||||
int2:
|
int2:
|
||||||
|
|
@ -20,9 +16,5 @@ int2:
|
||||||
type: number
|
type: number
|
||||||
default:
|
default:
|
||||||
jinja: >-
|
jinja: >-
|
||||||
{% if not rougail.bool %}
|
{% if not rougail.bool %}3{% else %}4{% endif %}
|
||||||
3
|
|
||||||
{% else %}
|
|
||||||
4
|
|
||||||
{% endif %}
|
|
||||||
description: if bool returns 3 otherwise return 4
|
description: if bool returns 3 otherwise return 4
|
||||||
|
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
---
|
|
||||||
version: 1.1
|
|
||||||
|
|
||||||
leader:
|
|
||||||
description: a leadership
|
|
||||||
type: leadership
|
|
||||||
|
|
||||||
leader: # a leader
|
|
||||||
- value1
|
|
||||||
- value2
|
|
||||||
|
|
||||||
follower1: val11 # a follower
|
|
||||||
|
|
||||||
follower2: val21 # an other follower
|
|
||||||
|
|
||||||
calculate:
|
|
||||||
description: a calculated variable
|
|
||||||
multi: true
|
|
||||||
default:
|
|
||||||
jinja: |-
|
|
||||||
{{ _.leader.follower1[0] }}
|
|
||||||
unique: false
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
---
|
|
||||||
version: 1.1
|
|
||||||
|
|
||||||
leader:
|
|
||||||
description: a leadership
|
|
||||||
type: leadership
|
|
||||||
|
|
||||||
leader: # a leader
|
|
||||||
- value1
|
|
||||||
- value2
|
|
||||||
|
|
||||||
follower1: val11 # a follower
|
|
||||||
|
|
||||||
follower2: val21 # an other follower
|
|
||||||
|
|
||||||
calculate:
|
|
||||||
description: a calculated variable
|
|
||||||
multi: true
|
|
||||||
default:
|
|
||||||
jinja: |-
|
|
||||||
{{ _.leader.follower1[-1] }}
|
|
||||||
unique: false
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
---
|
|
||||||
version: 1.1
|
|
||||||
|
|
||||||
leader:
|
|
||||||
description: a leadership
|
|
||||||
type: leadership
|
|
||||||
|
|
||||||
leader: # a leader
|
|
||||||
- value1
|
|
||||||
- value2
|
|
||||||
|
|
||||||
follower1: val11 # a follower
|
|
||||||
|
|
||||||
follower2: val21 # an other follower
|
|
||||||
|
|
||||||
calculate:
|
|
||||||
description: a calculated variable
|
|
||||||
multi: true
|
|
||||||
default:
|
|
||||||
variable: _.leader.follower1
|
|
||||||
unique: false
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
---
|
|
||||||
version: 1.1
|
|
||||||
|
|
||||||
leader:
|
|
||||||
description: a leadership
|
|
||||||
type: leadership
|
|
||||||
|
|
||||||
leader: # a leader
|
|
||||||
- value1
|
|
||||||
- value2
|
|
||||||
|
|
||||||
follower1: val11 # a follower
|
|
||||||
|
|
||||||
follower2: val21 # an other follower
|
|
||||||
|
|
||||||
calculate:
|
|
||||||
description: a calculated variable
|
|
||||||
default:
|
|
||||||
jinja: >-
|
|
||||||
{{ _.leader.leader[0] }}
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
---
|
|
||||||
version: 1.1
|
|
||||||
|
|
||||||
leader:
|
|
||||||
description: a leadership
|
|
||||||
type: leadership
|
|
||||||
|
|
||||||
leader: # a leader
|
|
||||||
- value1
|
|
||||||
- value2
|
|
||||||
|
|
||||||
follower1: val11 # a follower
|
|
||||||
|
|
||||||
follower2: val21 # an other follower
|
|
||||||
|
|
||||||
calculate:
|
|
||||||
description: a calculated variable
|
|
||||||
default:
|
|
||||||
jinja: >-
|
|
||||||
{{ _.leader.leader[-1] }}
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
---
|
|
||||||
version: 1.1
|
|
||||||
|
|
||||||
leader:
|
|
||||||
description: a leadership
|
|
||||||
type: leadership
|
|
||||||
|
|
||||||
leader: # a leader
|
|
||||||
- value1
|
|
||||||
- value2
|
|
||||||
|
|
||||||
follower1: val11 # a follower
|
|
||||||
|
|
||||||
follower2: val21 # an other follower
|
|
||||||
|
|
||||||
calculate:
|
|
||||||
description: a calculated variable
|
|
||||||
default:
|
|
||||||
variable: _.leader.leader
|
|
||||||
|
|
@ -5,7 +5,9 @@ leader:
|
||||||
description: a leadership
|
description: a leadership
|
||||||
type: leadership
|
type: leadership
|
||||||
|
|
||||||
leader: [] # a leader
|
leader:
|
||||||
|
description: a leader
|
||||||
|
multi: true
|
||||||
|
|
||||||
follower1:
|
follower1:
|
||||||
description: a follower
|
description: a follower
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,9 @@ leader:
|
||||||
description: a leadership
|
description: a leadership
|
||||||
type: leadership
|
type: leadership
|
||||||
|
|
||||||
leader: [] # a leader
|
leader:
|
||||||
|
description: a leader
|
||||||
|
multi: true
|
||||||
|
|
||||||
follower:
|
follower:
|
||||||
description: a follower
|
description: a follower
|
||||||
|
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
---
|
|
||||||
version: 1.1
|
|
||||||
|
|
||||||
var: # A suffix variable
|
|
||||||
- val.1
|
|
||||||
- val.2
|
|
||||||
|
|
||||||
dyn{{ identifier }}:
|
|
||||||
description: A dynamic family
|
|
||||||
dynamic:
|
|
||||||
variable: _.var
|
|
||||||
|
|
||||||
var1:
|
|
||||||
description: A dynamic variable
|
|
||||||
default:
|
|
||||||
type: identifier
|
|
||||||
|
|
||||||
var2:
|
|
||||||
description: A dynamic variable
|
|
||||||
default:
|
|
||||||
jinja: >-
|
|
||||||
{{ identifier }}
|
|
||||||
params:
|
|
||||||
identifier:
|
|
||||||
type: identifier
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
---
|
|
||||||
version: 1.1
|
|
||||||
|
|
||||||
var1:
|
|
||||||
description: A suffix variable
|
|
||||||
test:
|
|
||||||
- val1
|
|
||||||
multi: true
|
|
||||||
mandatory: false
|
|
||||||
|
|
||||||
dyn{{ identifier }}:
|
|
||||||
dynamic:
|
|
||||||
variable: _.var1
|
|
||||||
|
|
||||||
var: # A dynamic variable
|
|
||||||
|
|
||||||
var2:
|
|
||||||
description: A variable calculated
|
|
||||||
default:
|
|
||||||
variable: _.dynval1.var
|
|
||||||
optional: true
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
---
|
|
||||||
version: 1.1
|
|
||||||
|
|
||||||
var2:
|
|
||||||
description: A variable calculated
|
|
||||||
default:
|
|
||||||
variable: _.dynval1.var
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
var1:
|
|
||||||
description: A suffix variable
|
|
||||||
test:
|
|
||||||
- val1
|
|
||||||
- val2
|
|
||||||
multi: true
|
|
||||||
mandatory: false
|
|
||||||
|
|
||||||
dyn{{ identifier }}:
|
|
||||||
dynamic:
|
|
||||||
variable: _.var1
|
|
||||||
|
|
||||||
var: # A dynamic variable
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
---
|
|
||||||
version: 1.1
|
|
||||||
|
|
||||||
var: # a suffix variable
|
|
||||||
- val1
|
|
||||||
- val2
|
|
||||||
|
|
||||||
my_dyn_family_{{ identifier }}:
|
|
||||||
description: a dynamic family
|
|
||||||
dynamic:
|
|
||||||
variable: _.var
|
|
||||||
propertyerror: false
|
|
||||||
|
|
||||||
var:
|
|
||||||
description: a variable inside a dynamic family
|
|
||||||
default:
|
|
||||||
type: identifier
|
|
||||||
mandatory: false
|
|
||||||
|
|
||||||
var2:
|
|
||||||
description: a variable
|
|
||||||
multi: true
|
|
||||||
default:
|
|
||||||
variable: _.my_dyn_family_{{ identifier }}.var
|
|
||||||
|
|
@ -14,7 +14,9 @@ dyn{{ identifier }}:
|
||||||
description: a leadership
|
description: a leadership
|
||||||
type: leadership
|
type: leadership
|
||||||
|
|
||||||
leader: [] # a leader
|
leader:
|
||||||
|
description: a leader
|
||||||
|
multi: true
|
||||||
|
|
||||||
follower1:
|
follower1:
|
||||||
description: a follower1
|
description: a follower1
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,9 @@ dyn{{ identifier }}:
|
||||||
description: a leadership
|
description: a leadership
|
||||||
type: leadership
|
type: leadership
|
||||||
|
|
||||||
leader: [] # a leader
|
leader:
|
||||||
|
description: a leader
|
||||||
|
multi: true
|
||||||
|
|
||||||
follower1:
|
follower1:
|
||||||
description: a follower1
|
description: a follower1
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,11 @@ from rougail_tests.utils import get_structures_list, get_rougail_config, config_
|
||||||
|
|
||||||
|
|
||||||
excludes = [
|
excludes = [
|
||||||
# "16_6exists_family",
|
# "24_0family_hidden_condition_sub_family",
|
||||||
]
|
]
|
||||||
|
|
||||||
test_ok = get_structures_list(excludes)
|
test_ok = get_structures_list(excludes)
|
||||||
# test_ok = [Path('../rougail-tests/structures/00_9default_calculation_param_optional')]
|
# test_ok = [Path('../rougail-tests/structures/20_9family_absolute')]
|
||||||
|
|
||||||
|
|
||||||
def idfn(fixture_value):
|
def idfn(fixture_value):
|
||||||
|
|
@ -32,7 +32,7 @@ def _test_structural_files(file_name, namespace, rougailconfig):
|
||||||
rougailconfig['step.output'] = 'formatter'
|
rougailconfig['step.output'] = 'formatter'
|
||||||
##################################
|
##################################
|
||||||
config = None
|
config = None
|
||||||
generated_output = RougailOutput(config, rougailconfig=rougailconfig).run()[1]
|
generated_output = RougailOutput(config, rougailconfig=rougailconfig).run()
|
||||||
output_file = get_output_director(namespace) / file_name.parent.parent.name / file_name.parent.name / file_name.name
|
output_file = get_output_director(namespace) / file_name.parent.parent.name / file_name.parent.name / file_name.name
|
||||||
if not output_file.is_file():
|
if not output_file.is_file():
|
||||||
if not output_file.parent.is_dir():
|
if not output_file.parent.is_dir():
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue