cfengine/core — pull request #1211 by tzz (2013-12-19 00:06:53+00:00)
Title: Redmine#3899: write tool to produce example outputs

See https://cfengine.com/dev/issues/3899

This has only been tested with `accessedbefore.cf` so far. It will **rewrite** any file you pass to it.

It introduces a new `prep` piece to the examples, which are simple shell commands that you can't achieve in CFEngine internally. For example, for the `accessedbefore` function, we don't have a way in CFEngine to set the atime of a file. I hope `prep` pieces will not be needed too much. When they are needed, we should include them in the documentation page with something like the patch below:

```
diff --git a/reference/functions/accessedbefore.markdown b/reference/functions/accessedbefore.markdown
index 3e18887..28025cb 100644
--- a/reference/functions/accessedbefore.markdown
+++ b/reference/functions/accessedbefore.markdown
@@ -17,6 +17,11 @@ Return true if `newer` was accessed before `older`.

**Example:**

+Prepare:
+
+[%CFEngine_include_snippet(accessedbefore.cf, #\+begin_src prep, .*end_src)%]
+
+Run:

[%CFEngine_include_snippet(accessedbefore.cf, #\+begin_src cfengine3, .*end_src)%]

```

@vohi @teroka let me know what you think. Review but don't merge yet.

@teroka I will add more of the features you had in your script, this is just the beginning stage.