rougail/docs/gettingstarted.rst

179 lines
5.4 KiB
ReStructuredText
Raw Normal View History

2023-12-17 20:25:53 +01:00
Getting started
====================
What is a consistency handling system ?
------------------------------------------------
2025-02-03 20:20:15 +01:00
.. questions:: Question
2024-10-14 19:17:44 +02:00
"OK, I have understood that the Rougail stuff enables me to take advantage of :xref:`tiramisu`.
But what is all this for?
What is exactly a consistency handling system?
And again, what is this :xref:`tiramisu` library used for?"
2023-12-17 20:25:53 +01:00
2025-02-03 20:20:15 +01:00
**Answer**: Well, now we explain what this :xref:`tiramisu` library is, and how we are using it.
2023-12-17 20:25:53 +01:00
.. glossary::
Tiramisu
2024-10-14 19:17:44 +02:00
:xref:`tiramisu` is a consistency handling system that has initially been designed
2023-12-17 20:25:53 +01:00
in the configuration management scope. To put it more simply,
this library is generally used to handle configuration options.
It manages variables and group of variables. In the Tiramisu scope we call
it *options* and *option descriptions*.
2024-10-14 19:17:44 +02:00
Here is the :xref:`tiramisu library`.
2023-12-17 20:25:53 +01:00
In the Rougail scope, we call it :term:`variable`\ s and :term:`families`.
2025-02-03 20:20:15 +01:00
In Rougail, the families and variables are located in the :term:`structure files <dictionaries>` (the term "dictionary" is also used as a synonym).
2023-12-17 20:25:53 +01:00
2024-10-21 19:50:26 +02:00
The structure files
2023-12-17 20:25:53 +01:00
---------------------
.. glossary::
2024-10-21 19:50:26 +02:00
structure file
2023-12-17 20:25:53 +01:00
dictionary
dictionaries
2025-02-03 20:20:15 +01:00
A dictionary or a a structure file in the Rougail meaning is a YAML file that describes variables
2023-12-17 20:25:53 +01:00
and their dependencies / consistencies.
There can be a lot of dictionary files located in many different folders.
Rougail reads all the dictionaries and loads them into a single object
that handles the variables consistency.
.. image:: images/schema.png
2024-01-23 10:57:01 +01:00
The main advantage is that declaring variables and writing consistency is as simple
as writing YAML. With Rougail it is not necessary to write :term:`Tiramisu` code any more.
2023-12-17 20:25:53 +01:00
It simplifies a lot of things.
2025-02-03 20:20:15 +01:00
And rather than writing :term:`Tiramisu` code, we can declare variables and describe the relationships between variables in a declarative style (that is, in a YAML file).
2023-12-17 20:25:53 +01:00
2025-02-03 20:20:15 +01:00
Once the structure files are loaded by Rougail, the Tiramisu configuration management tool can check the consistency of the variables between them.
2023-12-17 20:25:53 +01:00
2024-10-21 19:50:26 +02:00
The YAML structure files format
------------------------------------
2023-12-17 20:25:53 +01:00
2025-02-03 20:20:15 +01:00
We need to learn first the specifics of the YAML dictionaries file format in Rougail, as well as some templating concepts.
2024-10-14 19:17:44 +02:00
Here is an empty Rougail dictionary YAML file
2024-10-14 19:17:44 +02:00
2024-10-28 15:29:11 +01:00
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_000/firefox/00-proxy.yml
2024-10-14 22:51:05 +02:00
:linenos:
:language: yaml
:caption: An empty Rougail dictionnary file. It's a YAML format.
2024-10-15 07:31:31 +02:00
:name: RougailDictionaryEmptyFile
2024-10-14 19:17:44 +02:00
2024-10-28 15:29:11 +01:00
..
---
version: 1.1
:download:`source file <https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_000/firefox/00-proxy.yml>`
2024-10-14 19:17:44 +02:00
2024-10-15 09:20:01 +02:00
You can see that there is just a `version` specification.
2023-12-17 20:25:53 +01:00
2024-10-15 09:20:01 +02:00
.. glossary::
2023-12-17 20:25:53 +01:00
2024-10-15 09:20:01 +02:00
version
The version is here a Rougail YAML dictionary version format.
It is set in the beginning of a YAML dictionary, or globaly in the Rougail settings
for example from the command line
2023-12-17 20:25:53 +01:00
2024-10-15 09:20:01 +02:00
.. note:: You can set the format in the Rougail command line tool like this:
2023-12-17 20:25:53 +01:00
2024-10-15 09:20:01 +02:00
.. code-block:: bash
foo@bar:~$ rougail -v 1.1
2023-12-17 20:25:53 +01:00
The variables
-----------------
2024-10-21 19:50:26 +02:00
Here is a :term:`structure file <dictionary>` example with a variable into it:
2024-10-15 09:20:01 +02:00
2024-10-28 15:29:11 +01:00
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_010/firefox/00-proxy.yml
2024-10-15 09:20:01 +02:00
:language: yaml
:caption: A Rougail dictionnary file with a variable named `proxy_mode`. It's the Rougail YAML dictionary format.
2024-10-15 09:20:01 +02:00
:name: RougailDictionaryFirstVariable
2024-10-28 15:29:11 +01:00
..
---
proxy_mode:
2024-10-21 19:50:26 +02:00
Here we declare a **variable** named `proxy_mode` without a default value.
2024-10-15 09:20:01 +02:00
A variable can be defined with no default value at all.
2024-10-15 15:50:01 +02:00
Here is the same variable with a description label:
2024-10-28 15:29:11 +01:00
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_011/firefox/00-proxy.yml
2024-10-15 15:50:01 +02:00
:language: yaml
:caption: A Rougail dictionnary file with a variable named `proxy_mode`, with a description.
2024-10-15 15:50:01 +02:00
:name: RougailDictionaryFirstVariableDescription
2024-10-28 15:29:11 +01:00
..
---
proxy_mode:
description: Configure Proxy Access to the Internet
2024-10-15 15:50:01 +02:00
2024-10-28 15:29:11 +01:00
The same with a default value:
2024-10-15 15:50:01 +02:00
2024-10-28 15:29:11 +01:00
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_012/firefox/00-proxy.yml
2024-10-15 15:50:01 +02:00
:language: yaml
:caption: A Rougail dictionnary file with a variable named `proxy_mode`, with a default value.
2024-10-15 15:50:01 +02:00
:name: RougailDictionaryFirstVariableDefault
2024-10-28 15:29:11 +01:00
..
---
proxy_mode:
description: Configure Proxy Access to the Internet
default: No proxy
2023-12-17 20:25:53 +01:00
variable
2025-02-03 20:20:15 +01:00
A :term:`variable` is a declaration unit that represents a business domain metaphor,
2024-01-23 10:57:01 +01:00
the most common example is that a variable that represents a configuration option
2023-12-17 20:25:53 +01:00
in a application, but a variable represents something more that a configuration option.
It provides a business domain specific representation unit.
Families of variables
--------------------------
2025-02-03 20:20:15 +01:00
family
2024-01-23 10:57:01 +01:00
2025-02-03 20:20:15 +01:00
A :term:`family` is simply a container of variables and subfamily.
2024-10-14 19:17:44 +02:00
.. _installation:
Installation
----------------
You just have to type this in your preferred terminal:
.. code-block:: text
pip install rougail
a better way to install the Rougail library in to do this in a virtual environment:
.. code-block:: text
python -m"venv' .venv
And, under linux or Mac:
.. code-block:: shell
./.venv/bin/activate
or, under windows:
.. code-block:: text
.venv\Scripts\activate.exe