Simple¶
The more recommended design is to explicitly specify the Jinja variables with vars and template folder with templates keys. This allows to use all other keys in the Template schema.
The example in example/simple contains a simple template with all supported functionalities. The fmf tree is defined by:
/main.fmf¶
templates:
path: /template
vars:
var1: 42
var2: Default value
/rootA:
links:
# Create a symlink to the file in rootB
fileB.yaml: /rootB/file.yaml
copy:
# Copy and rename `common_file.txt`
renamed_file.txt: /template/common_file.txt
templates+:
# Do not copy `common_file.txt` because we are renaming instead above
exclude: [ common_file.txt ]
/rootB:
vars+:
var2: Overwritten
This is identical to the minimal example, with additional keys used in /rootA. The
changes in /rootA are:
create a symbolic link to a generated file in
/rootBcopy/rename
common_file.txttorenamed_file.txtexclude
common_file.txtfrom being copied
Running fmf-jinja on this example we get:
$ fmf-jinja -r example/simple generate -o output
$ tree output
output/
├── .fmf
│ └── version
├── main.fmf
├── rootA
│ ├── fileB.yaml -> ../rootB/file.yaml
│ ├── file.yaml
│ └── renamed_file.txt
└── rootB
├── common_file.txt
└── file.yaml