rougail/docs/gettingstarted.rst

154 lines
5.2 KiB
ReStructuredText
Raw Normal View History

2023-12-17 20:25:53 +01:00
Getting started
====================
2025-02-20 11:35:55 +01:00
.. _installation:
Installation
----------------
2025-06-26 12:54:33 +02:00
- Open a shell session
2025-02-20 11:35:55 +01:00
2025-06-26 12:54:33 +02:00
.. type-along:: Optional: install the Rougail library in a virtual environment
2025-02-20 11:35:55 +01:00
2025-06-26 12:54:33 +02:00
- install the virtual environment: `python -m"venv' .venv`
- activate it `./.venv/bin/activate` (or `.venv\Scripts\activate.exe` under windows)
2025-02-20 11:35:55 +01:00
2025-06-26 12:54:33 +02:00
.. type-along:: Rougail's library installation
2025-02-20 11:35:55 +01:00
2025-06-26 12:54:33 +02:00
You can use the `pip` python installer, here is the install command:
2025-05-26 22:09:29 +02:00
.. code-block:: text
pip install rougail
2023-12-17 20:25:53 +01:00
What is a consistency handling system ?
------------------------------------------------
2025-06-26 12:54:33 +02:00
.. questions:: Rougail, Tiramisu: What is it all about?
2024-10-14 19:17:44 +02:00
2025-06-26 12:54:33 +02:00
**Question**: OK, I have understood that the Rougail library allows me to take advantage of the :xref:`tiramisu` consistency handling library. But what is all this for? What is exactly a consistency handling system? And again, what is this :xref:`Tiramisu library <tiramisu library>` used for?
2023-12-17 20:25:53 +01:00
2025-05-27 11:03:29 +02:00
**Answer**: Well, we will explain in details what this :xref:`tiramisu` library is and what Rougail is.
In (very) short:
2025-06-26 12:54:33 +02:00
- Rougail is the YAML consistency description of a :term:`context`\ 's situation
2025-05-27 11:03:29 +02:00
- Tiramisu is the consistency engine linter
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
2025-06-26 12:54:33 +02:00
in the configuration management scope. Until now,
2023-12-17 20:25:53 +01:00
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*.
2025-02-20 11:35:55 +01:00
Here is the :xref:`tiramisu documentation <tiramisu>`.
2024-10-14 19:17:44 +02:00
2025-06-26 12:54:33 +02:00
In the Rougail scope, we call it :term:`variables <variable>` and :term:`families <family>`.
2025-02-09 11:20:36 +01:00
In Rougail, the families and variables are located in the :term:`structure files <structure file>`.
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
A structure file in the Rougail meaning is a YAML file that describes variables
2025-06-26 12:54:33 +02:00
and their dependencies.
There can be a lot of structure files located in many different folders.
2023-12-17 20:25:53 +01:00
2025-06-26 12:54:33 +02:00
Rougail reads all the structure files and loads them into a single object
that represents the whole :term:`context`.
.. figure:: images/schema.png
:alt: The Rougail process
:align: center
The Rougail process from structure files to Tiramisu object
.. glossary::
2023-12-17 20:25:53 +01:00
2025-06-26 12:54:33 +02:00
structured data
We sometimes call 'structured datas' the datas that are in the structure files,
as opposed to :term:`user datas <user data>`\ .
For example when a value of a variable is defined in the structured datas, that is
in a structured file, the assigned value's status is that the variable's value is a default value.
If the assigned value of the variable is defined in a user data file,
it is an user assigned value.
2023-12-17 20:25:53 +01:00
2025-06-26 12:54:33 +02:00
We'll see later on some examples of default values and user assigned values.
The main advantage of all of this that declaring variables and writing consistency is as simple
2024-01-23 10:57:01 +01:00
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
The variables
-----------------
2025-02-20 11:35:55 +01:00
Here is a :term:`structure file` example with only a variable **variable** named `proxy_mode`
2024-10-15 09:20:01 +02:00
A variable can be defined with no default value at all.
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-20 11:35:55 +01:00
A :term:`family` is simply a container of variables and/ore some subfamilies.
2025-02-20 11:35:55 +01:00
Here how a YAML structure file with a family looks like:
2025-02-20 11:35:55 +01:00
.. code-block:: yaml
:caption: A :file:`hello.yml` structure sample file
2025-02-20 11:35:55 +01:00
---
version: '1.1'
world:
description: Hello world family container
name:
description: Somebody to say hello
default: rougail
Here, we have a family named `world`.
This family contains a variable named `name`