87 lines
2.1 KiB
ReStructuredText
87 lines
2.1 KiB
ReStructuredText
`Rougail`'s library description
|
|
=================================
|
|
|
|
Rougail is a configuration management library that allows you to load variables in a simple and convenient way.
|
|
|
|
In the following examples, we will use a specific configuration of Rougail.
|
|
|
|
|
|
.. FIXME: You will find all the configuration options in doc:`configuration`
|
|
find a document with all the configuration options
|
|
|
|
To load the configuration you must import the `RougailConfig` class and set the `main_structural_directories` values:
|
|
|
|
.. code-block:: python
|
|
|
|
from rougail import RougailConfig
|
|
|
|
RougailConfig['main_structural_directories'] = ['dict']
|
|
|
|
Let's convert a our first structural file
|
|
-----------------------------------------
|
|
|
|
As a reminder, a :term:`structure file` is a set of instructions that will allow us to create :term:`families <family>` and :term:`variables <variable>`.
|
|
|
|
Let's start by creating a simple structure file.
|
|
|
|
Here is a first :file:`dict/00-base.yml` structure file:
|
|
|
|
.. code-block:: yaml
|
|
|
|
%YAML 1.2
|
|
---
|
|
version: 1.1
|
|
|
|
my_variable: my_value # my variable
|
|
...
|
|
|
|
Then, let's create the :term:`Tiramisu` objects via the following script:
|
|
|
|
.. code-block:: python
|
|
:caption: the `script.py` file content
|
|
|
|
from rougail import Rougail, RougailConfig
|
|
|
|
RougailConfig['main_structural_directories'] = ['dict']
|
|
rougail = Rougail()
|
|
config = rougail.run()
|
|
print(config.value.get())
|
|
|
|
.. demo:: Let's execute `script.py`:
|
|
|
|
.. code-block:: bash
|
|
|
|
$ python3 script.py
|
|
{'rougail.my_variable': 'my_value'}
|
|
|
|
The operator role
|
|
--------------------
|
|
|
|
The :term:`operator` role corresponds to the :term:`tiramisu` settings:
|
|
|
|
.. image:: ../images/tiramisu_get_set.png
|
|
|
|
.. index:: questionary
|
|
|
|
But instead of coding in the end user developer way, the opterator will prefer using the Rougail CLI interface:
|
|
|
|
.. image:: ../images/QuestionaryChoice.png
|
|
|
|
|
|
The Rougail CLI can output a rather complete view of the dataset:
|
|
|
|
.. image:: ../images/UserDataOutput.png
|
|
|
|
.. toctree::
|
|
:titlesonly:
|
|
:caption: Use library
|
|
|
|
user_datas
|
|
output
|
|
parse
|
|
tags
|
|
rougailconfig_load_from_cli
|
|
extra
|
|
custom_function
|
|
own_type
|
|
upgrade
|