The process to create a formula it is done through the
rit create formula command. It creates the necessary structure for the user to start developing a new formula on his local machine.
rit create formula command is executed on the terminal, a few information are requested from the user :
new formula command
The ideal is to follow the pattern rit + group + verb + noun.
new formula programming language
A Hello World template will be created in this language.
workspace where the new formula will be added
It can be an existing formula workspace. If there isn't any available, a default formula workspace will be created automatically, named
ritchie-formulas-local in the HOME of the user's machine.
rit create formula command also build the formula automatically (it generates the formula executables files and add them to the .rit folder).
That means it is possible to execute the new command directly after its creation. In that case, the formula Hello World template will be executed as shown below :
This Hello World template is currently composed of 3 inputs parameters :
a sample text variable
a sample list of variables
a sample boolean variable
Those represents the 3 kinds of inputs currently available when using Ritchie.
All Ritchie formulas workspaces follow the same architecture, you can find more information in the formulas section.
When executing the
rit create formula command, the new formula is added to the informed workspace, updating automatically the workspace structure with the Hello World template files.
With the new formula structure generated successfully inside the chosen workspace, it is possible to start implementing the new automation, updating the Hello World template.
To implement the desired operation, it is necessary to update 3 files located inside the /src package of the new formula’s root folder :
config.json, to configure the inputs.
main file (generally used to extract those inputs)
files in the /pkg folder.
Observation : Depending on the chosen language, it may be necessary to update more files, for example to manipulate dependencies.
Once the new automation has been implemented, it necessary to execute the
rit build formula command to update the formula executable files which has been generated at its creation.
When the rit build formula command is executed on the terminal, a few information are requested from the user :
workspace where the formula has been implemented
path to the formula /src package (group / verb / noun, if this pattern has been followed)
That’s it ! After building successfully the formula, it is possible to execute the formula command again to see the updated implementation.