2025-11-05 17:34:12 +01:00
Getting started
====================
2024-10-14 19:17:44 +02:00
2024-10-21 15:03:34 +02:00
.. objectives :: Objectives
2024-10-14 19:17:44 +02:00
2024-10-21 15:03:34 +02:00
We will learn how to:
2024-10-14 19:17:44 +02:00
2025-11-07 09:05:44 +01:00
- create a :term: `structure description file <structure file>`
- add a :term: `structure file format version <structure file>`
- add a :term: `variable` and set its :term: `value`
2024-10-15 15:50:01 +02:00
2025-02-04 15:48:49 +01:00
.. prerequisites :: Prerequisites
2024-10-21 15:03:34 +02:00
2025-11-05 08:59:36 +01:00
- We assume that Rougail's library is :ref: `installed <installation>` on your computer.
2025-11-07 09:05:44 +01:00
- If you want to follow with this tutorial with the help of the corresponding :tutorial: `Rougail-tutorials git repository <>` ,
this workshop page corresponds to the tags :tutorial: `v1.1_000 <src/tag/v1.1_000>` to :tutorial: `v1.1_011 <src/tag/v1.1_011>`
2025-11-07 17:26:23 +01:00
in the repository:
2024-10-15 15:50:01 +02:00
2025-11-07 09:05:44 +01:00
::
git clone https://forge.cloud.silique.fr/stove/rougail-tutorials.git
git switch v1.1_000
Creating a structure file
--------------------------
2025-02-04 16:38:07 +01:00
2025-06-26 17:17:06 +02:00
.. demo :: The folder structure
2024-10-15 15:50:01 +02:00
2025-02-04 15:48:49 +01:00
Here is the tree structure we want to have::
2024-10-15 15:50:01 +02:00
2025-11-07 09:05:44 +01:00
rougail-tutorials
└── firefox
└── 00-proxy.yml
2024-10-15 15:50:01 +02:00
2025-11-07 09:05:44 +01:00
- Let's make a :file: `rougail-tutorials` directory, with a :file: `firefox` subfolder.
2025-11-07 17:26:23 +01:00
- First, we will create a :term: `structure file <structure file>` , so let's create a :file: `00-proxy.yml` file
2025-02-04 16:38:07 +01:00
located in the :file: `firefox` subfolder.
2025-02-04 15:48:49 +01:00
2025-06-26 12:54:33 +02:00
.. type-along :: An empty structure file
2025-02-04 15:48:49 +01:00
2025-11-07 09:05:44 +01:00
This is an empty Rougail :term: `structure description file: <structure file>`
2025-02-04 15:48:49 +01:00
.. extinclude :: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_000/firefox/00-proxy.yml
:language: yaml
2025-02-04 16:38:07 +01:00
:caption: An empty rougail dictionnary file with the version number only
2025-02-09 11:20:36 +01:00
:name: RougailStructVersion
2025-02-04 15:48:49 +01:00
..
---
version: 1.1
2025-11-07 17:26:23 +01:00
:tutorial: `Download this file from the rougail-tutorials git repository <src/tag/v1.1_000/firefox/00-proxy.yml>`
2025-02-04 15:48:49 +01:00
2025-11-07 09:05:44 +01:00
Let's add our first variable
------------------------------
2025-11-07 17:26:23 +01:00
.. note :: A variable is defined at a minimum by its name.
2025-11-05 06:54:03 +01:00
2025-11-07 09:05:44 +01:00
A :term: `variable` in the :term: `structure description file <structure file>`
2025-02-04 15:48:49 +01:00
2025-11-07 06:45:46 +01:00
.. extinclude :: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_001/firefox/00-proxy.yml
2025-02-04 15:48:49 +01:00
:language: yaml
2025-11-07 09:05:44 +01:00
:caption: A Rougail structure file with only one variable
2025-02-04 15:48:49 +01:00
:name: RougailDictionaryFirstVariableName
..
---
proxy_mode:
2024-10-15 15:50:01 +02:00
2025-11-07 17:26:23 +01:00
:tutorial: `Download this file from the rougail-tutorials git repository <src/tag/v1.1_001/firefox/00-proxy.yml>`
2025-11-05 08:59:36 +01:00
2025-11-07 09:05:44 +01:00
Let's run the Rougail CLI utility command:
2025-02-04 16:38:07 +01:00
2025-02-04 21:35:42 +01:00
.. code-block :: text
:class: terminal
2025-11-05 06:54:03 +01:00
rougail -m firefox/
2025-02-04 16:38:07 +01:00
2025-02-05 07:18:50 +01:00
we will actually have an error:
2025-02-04 16:38:07 +01:00
.. raw :: html
2025-11-07 06:45:46 +01:00
:url: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_001/config/01/output_ro.html
2025-02-04 21:35:42 +01:00
:class: error-box
2025-02-04 16:38:07 +01:00
..
🛑 ERRORS
┣━━ The following variables are mandatory but have no value:
┗━━ - proxy_mode
Because this variable is :term: `mandatory` and needs to be set **but** there's no value yet.
2025-11-07 09:05:44 +01:00
We can therefore deduce the fact that:
.. admonition :: Fact
2025-02-05 07:18:50 +01:00
2025-11-07 09:05:44 +01:00
Once defined, an option configuration :term: `value` is :term: `mandatory` .
That is to say, it is absolutely necessary to assign a value to this variable.
2025-06-26 12:54:33 +02:00
2025-02-05 07:18:50 +01:00
Rougail waits for the `proxy_mode` configuration option's value to be set.
.. glossary ::
mandatory
2025-06-26 12:54:33 +02:00
A variable is mandatory when a value is required, that is, `None` is not a possible value.
2025-02-21 20:26:08 +01:00
It **must** have a defined value.
2025-11-07 09:05:44 +01:00
.. seealso :: To go further, have a look at the :tiramisu: `mandatory option <glossary.html#term-mandatory-option>` according to the definition of Tiramisu.
2025-02-21 20:26:08 +01:00
2025-06-26 12:54:33 +02:00
Let's add a variable's description, which is not mandatory but which is a good practice:
2025-02-04 16:38:07 +01:00
2025-11-07 06:45:46 +01:00
.. extinclude :: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_002/firefox/00-proxy.yml
2025-02-04 16:38:07 +01:00
:language: yaml
:caption: A Rougail dictionnary file with a variable and a description
2025-02-09 11:20:36 +01:00
:name: RougailStructFirstVariableDescription
2025-02-04 16:38:07 +01:00
..
---
2025-11-05 06:54:03 +01:00
proxy_mode: # Configure Proxy Access to the Internet
2025-02-04 16:38:07 +01:00
2025-11-07 17:26:23 +01:00
:tutorial: `Download this file from the rougail-tutorials git repository <src/tag/v1.1_002/firefox/00-proxy.yml>`
2025-06-26 12:54:33 +02:00
.. type-along :: how to set a value -- the default value
We need to set a value to this `proxy_mode` variable. A first way to do it is *to set a value by default* .
2025-02-04 16:38:07 +01:00
.. glossary ::
2025-02-21 20:26:08 +01:00
default value
2025-02-04 16:38:07 +01:00
A default value is a variable value that is predefined, that is, this value is placed
right in the structure file.
2024-10-15 15:50:01 +02:00
2025-02-04 16:38:07 +01:00
So let's define a variable with a description -- **and a default value**
2024-10-15 15:50:01 +02:00
2025-11-07 06:45:46 +01:00
.. extinclude :: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_003/firefox/00-proxy.yml
2025-02-09 10:36:19 +01:00
:language: yaml
2025-02-04 21:52:54 +01:00
:caption: A rougail dictionnary file with a default value for the variable
:name: RougailDictionaryVariableDefault
2025-02-04 21:35:42 +01:00
2025-02-09 10:36:19 +01:00
..
2025-02-04 21:35:42 +01:00
---
2025-11-05 06:54:03 +01:00
proxy_mode: No proxy # Configure Proxy Access to the Internet
2025-02-04 21:35:42 +01:00
2025-11-07 17:26:23 +01:00
:tutorial: `Download this file from the rougail-tutorials git repository <src/tag/v1.1_003/firefox/00-proxy.yml>`
2025-06-26 12:54:33 +02:00
.. type-along :: how to set a value -- the assignment
2025-02-04 16:38:07 +01:00
2025-02-04 21:35:42 +01:00
A default value has been set, great. Now how do I assign a value to a variable?
2025-02-04 16:38:07 +01:00
2025-11-05 16:38:44 +01:00
The different rougail roles and the default values
------------------------------------------------------
2024-10-15 15:50:01 +02:00
2025-06-26 12:54:33 +02:00
So far we have only talked about the one that writes the :term: `structure files <structure file>` \ . It's *role* is called the integrator's role.
2025-02-04 21:52:54 +01:00
2024-10-15 15:50:01 +02:00
.. glossary ::
integrator
2025-06-26 12:54:33 +02:00
An integrator in the Rougail field is the person who writes the :term: `structure files <structure file>` \ .
2024-10-15 15:50:01 +02:00
He has the responsibilité of the integration process, that is,
defines the variables and the relationship between them, the variables that are allowed
(or not) to be set, and so on. His responsabilites are the **structuration** and the **consistency**
of the variables.
2025-02-04 21:52:54 +01:00
Now we will talk about the one that defines the values. It is called the operator.
2024-10-15 15:50:01 +02:00
.. glossary ::
operator
2025-06-26 12:54:33 +02:00
An operator in the Rougail field is the person who assigns :term: `value` \ s to the pre-defined variables,
2024-10-15 15:50:01 +02:00
his responsabilities are to set variable values correctly.
2025-06-26 12:54:33 +02:00
The user :term: `value` \ s, that is the values that have been set by the operator, are of course type validated. The type validation is driven by the definitions in the :term: `structure file <structure file>` .
2024-10-15 15:50:01 +02:00
2025-05-05 21:39:32 +02:00
It is the operator's responsibility to set the user datas variables values.
2025-06-26 12:54:33 +02:00
The operator does not handle the structure files,
he is responsible of other files called the :term: `user data file` \ s.
2024-10-15 17:49:26 +02:00
2025-02-05 07:18:50 +01:00
.. glossary ::
2024-10-15 17:49:26 +02:00
2025-05-05 21:39:32 +02:00
user datas
2025-06-26 12:54:33 +02:00
User datas, as opposed to structured datas, are datas that only concern the assignment of values
and not the consistency of the variables.
The variable's values are also called **user values** .
The consistency field is outside of the user datas scope.
The consistency is handled in the :term: `structured datas <structured data>` \ 's scope.
2024-10-21 15:03:34 +02:00
2025-11-05 17:00:19 +01:00
.. important :: If user datas are not set, default values are mandatory, otherwise Rougail will raise an error.
2025-11-05 16:38:44 +01:00
2025-02-05 07:18:50 +01:00
.. exercise :: Folder structure update
2025-02-04 22:01:19 +01:00
2025-11-07 17:26:23 +01:00
Now we add a :file: `config/config.yaml` file in our project::
2024-10-21 19:50:26 +02:00
2025-11-07 17:26:23 +01:00
rougail-tutorials
2025-02-05 07:18:50 +01:00
├── firefox
2025-11-07 17:26:23 +01:00
│ ├── 00-proxy.yml
2025-02-05 07:18:50 +01:00
└── config
2025-11-07 17:26:23 +01:00
└── config.yaml
2024-10-21 19:50:26 +02:00
2025-05-05 21:39:32 +02:00
.. type-along :: how to set a value in a user datas file
2024-10-21 19:50:26 +02:00
2025-02-05 07:18:50 +01:00
So for example if the integrator has not set any default value in his structure file,
2025-11-07 17:26:23 +01:00
it's up to the operator to do the job in the `config.yaml` file:
2024-10-21 19:50:26 +02:00
2025-11-07 17:26:23 +01:00
.. extinclude :: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_001/config/02/config.yaml
2024-10-21 19:50:26 +02:00
:language: yaml
2025-11-07 17:26:23 +01:00
:caption: A Rougail user datas file :file:`config/config.yaml`, with a default value set.
2025-02-05 07:18:50 +01:00
:name: RougailConfigDefaultValue
2024-10-28 15:29:11 +01:00
2025-02-05 07:18:50 +01:00
..
2024-10-28 15:29:11 +01:00
---
2025-02-05 07:18:50 +01:00
proxy_mode: No proxy
2024-10-21 19:50:26 +02:00
2025-11-07 17:26:23 +01:00
:tutorial: `Download this file from the rougail-tutorials git repository <src/tag/v1.1_001/config/02/config.yaml>`
With the rougail CLI the operator has to add the `-u file -ff config/config.yaml` options:
2024-10-21 19:50:26 +02:00
2025-02-04 22:01:19 +01:00
.. code-block :: text
:class: terminal
2025-11-07 17:26:23 +01:00
:caption: A rougail Command Line Utility call with the :file:`config/config.yaml` Rougail user datas file
rougail -m firefox -u yaml -ff config/02/config.yaml
which gives us this output:
2024-10-21 19:50:26 +02:00
2025-11-07 17:26:23 +01:00
.. raw :: html
:url: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_001/config/02/output_ro.html
:class: output
..
<pre>╭──────── Caption ────────╮
│ Variable Modified value │
╰─────────────────────────╯
Variables:
<span style="color: #5c5cff">┗━━ </span>📓 proxy_mode: No proxy ◀ loaded from the YAML file "config/02/config.yaml"
</pre>
2024-10-21 19:50:26 +02:00
2025-11-07 17:26:23 +01:00
.. admonition :: Important fact
2024-10-28 21:08:22 +01:00
2025-11-07 17:26:23 +01:00
- the integrator works on structure files
- the operator works on user data files
2025-02-05 07:18:50 +01:00
2025-11-07 17:26:23 +01:00
Most of the time, the integrator and the operator are one and the same person, here we are talking about roles and not necessarily about people.
2024-10-28 21:08:22 +01:00
2025-02-05 07:18:50 +01:00
.. type-along :: Defining a choice type
2025-06-26 12:54:33 +02:00
In our firefox use case, the real type of the `proxy_mode` variable will be now set as a `choice` type:
2025-11-08 09:50:20 +01:00
.. seealso :: Have a look at the definition of the :term: `choice type variable <choice type>`
2025-02-05 07:18:50 +01:00
2025-11-07 06:45:46 +01:00
.. extinclude :: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_004/firefox/00-proxy.yml
2024-10-21 19:50:26 +02:00
:linenos:
:language: yaml
2025-02-05 07:18:50 +01:00
:caption: The real :file:`firefox/proxy.yml` Rougail dictionnary file with a choice type
:name: RougailDictionaryChoiceType
2024-10-28 15:29:11 +01:00
..
---
proxy_mode:
description: Configure Proxy Access to the Internet
choices:
- No proxy
- Auto-detect proxy settings for this network
- Use system proxy settings
- Manual proxy configuration
- Automatic proxy configuration URL
default: No proxy
2024-10-21 19:50:26 +02:00
2025-06-26 12:54:33 +02:00
- Let's run the Rougail CLI
2025-02-05 07:18:50 +01:00
.. code-block :: text
:class: terminal
rougail -v 1.1 -m firefox/
2025-06-26 12:54:33 +02:00
We have an output like this one:
2025-02-05 07:18:50 +01:00
2024-10-21 19:50:26 +02:00
.. raw :: html
2025-11-07 06:45:46 +01:00
:url: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/commit/v1.1_004/config/01/output_ro.html
2025-02-04 21:35:42 +01:00
:class: output
2025-02-04 21:52:54 +01:00
2024-10-28 15:29:11 +01:00
..
<pre>╭────────────────────────── Caption ──────────────────────────╮
│ Variable <span style="color: #ffd700">Default value</span> │
│ <span style="color: #5c5cff">Undocumented variable</span> Modified value │
│ <span style="color: #ff0000">Undocumented but modified variable</span> (<span style="color: #00aa00">Original default value</span>) │
│ <span style="color: #ffaf00">Unmodifiable variable</span> │
╰─────────────────────────────────────────────────────────────╯
Variables:
<span style="color: #5c5cff">┗━━ </span>📓 proxy_mode: <span style="color: #ffd700">No proxy</span>
</pre>
2024-10-28 21:08:22 +01:00
The `proxy_mode` variable here, implicitely requires a value. It is a :term: `mandatory` variable.
2025-02-05 07:18:50 +01:00
As we set the `proxy_mode` variable as `No proxy` by default, we actually have specified a value, and the value appears in yellow, which means : "set by default".
2024-10-28 21:08:22 +01:00
2025-11-08 09:50:20 +01:00
The constraints that come with the `choice` type
----------------------------------------------------
2024-10-28 21:08:22 +01:00
We say that the `proxy_mode` variable is *constrained* (by the `choice` type).
We have the list of the possible (authorized) values:
- `No proxy`
- `Auto-detect proxy settings for this network`
- `Use system proxy settings`
- `Manual proxy configuration`
- `Automatic proxy configuration URL`
2024-10-21 18:28:34 +02:00
.. keypoints :: Key points progress
2025-02-05 07:18:50 +01:00
Indeed, in the Firefox configuration, it is possible to define several configuration modes, from no proxy at all (`no proxy` ) to a kind of automatic configuration mode from a file (`set up proxy configuration from a file` ).
2024-10-21 18:28:34 +02:00
**Keywords**
2025-02-09 11:20:36 +01:00
- :term: `structure file <structure file>` : structure description file
2024-10-21 18:28:34 +02:00
- :term: `variable` : an option's name which has a value
- a variable's description
2024-10-28 15:29:11 +01:00
- a variable's type
2024-10-21 18:28:34 +02:00
- a variable's default value
- the :term: `integrator` and :term: `operator` roles
2024-10-28 15:29:11 +01:00
- a mandatory value
2024-10-28 21:08:22 +01:00
- a choice type
2024-10-21 18:28:34 +02:00
2025-02-20 14:32:11 +01:00
**Progress**
2025-02-04 22:01:19 +01:00
To sum up, we have arrived at this point in writing a structure file like this:
2024-10-21 18:28:34 +02:00
2024-10-21 19:58:35 +02:00
**Structure description file**
2024-10-21 18:28:34 +02:00
2025-11-07 06:45:46 +01:00
.. extinclude :: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_004/firefox/00-proxy.yml
2024-10-21 18:28:34 +02:00
:linenos:
:language: yaml
2025-02-04 15:48:49 +01:00
:caption: A Rougail dictionnary file with a variable named `proxy_mode`, with a default value.
2024-10-28 15:29:11 +01:00
..
.. raw :: text
---
proxy_mode:
description: Configure Proxy Access to the Internet
choices:
- No proxy
- Auto-detect proxy settings for this network
- Use system proxy settings
- Manual proxy configuration
- Automatic proxy configuration URL
default: No proxy
2024-10-21 15:03:34 +02:00