diff --git a/pkg/plugins/jinja2/README.md b/pkg/plugins/jinja2/README.md new file mode 100644 index 0000000..717cb3e --- /dev/null +++ b/pkg/plugins/jinja2/README.md @@ -0,0 +1,34 @@ +# Makeshift Jinja 2 Plugin + +This is a `makeshift` plugin that allows rendering files with Jinja 2 grammar. The plugin reads from a `storage.KVStore` passed to the `Run()` function and substitute the values in files provided with key `file`. Profiles can also be used to inject data into the store as well. + +Compile the plugin if not done already. + +```bash +makeshift compile pkg/plugins/jinja2/jinja2.go -o $MAKESHIFT_ROOT/plugins/jinja.so +``` + +Then, try download a file that contains Jinja2 variables. The `makeshift` server includes a `help.txt` and `default.json` profile to show how rendering can be done with downloads, profiles, and plugins. + +First, try downloading the `help.txt` file *without* rendering. + +```bash +makeshift download -p help.txt +``` + +Notice that there are Jinja2 variables with no substitutions done here. Now, try it again with the `jinja2` plugin and the `default` profile. + +```bash +makeshift download -p help.txt --plugins jinja2 --profile default +``` + +You should see the same file, but now the values are populated with the content stored in the profile. Remember...the data can also be populated using other plugins as well (see the [`smd`](../smd/README.md) plugin regarding this). + +Also, keep in mind that rendering happens across directories as well. + +```bash +makeshift download -p templates --plugins jinja2 --profile +default +``` + +This will render all Jinja 2 templates before archiving and downloading the files with the client. diff --git a/pkg/plugins/smd/README.md b/pkg/plugins/smd/README.md new file mode 100644 index 0000000..ef49a20 --- /dev/null +++ b/pkg/plugins/smd/README.md @@ -0,0 +1,13 @@ +# Makeshift SMD Plugin + +This `makeshift` plugin fetchs data from [SMD](https://github.com/OpenCHAMI/smd) and stores it in the `storage.KVStore` passed to the `Run()` function. This plugin can be used in conjunction with other plugins like the `jinja2` plugin to render files using the data stored. + +Here's a simple example. + +```bash +makeshift download -p /etc/hosts --plugins smd,jinja2 -xr +``` + +This example downloads all the files in the `/etc/hosts` directory and renders the Jinja 2 templates with the data fetched from SMD. Then, the `-x` and `-r` flags tells the CLI to extract and remove the archive respectively. + +Since plugins are ran in the order specified with the CLI, be sure to always call the `smd` plugin before reading from the `storage.KVStore` like in the example above or else the fetched data will not exist!