add returnText option to writeYaml

XMLWordPrintable

      Currently theĀ writeYaml step is only able to output the yaml to a file. However, sometimes we need the resulting yaml as a string in Groovy, such as when building a kubernetes pod spec. The only workaround is either to write to some temp file and then call readYaml, or to directly call into SnakeYaml, neither of which is ideal.

      I propose adding a booleanĀ returnText parameter to writeYaml. If it is omitted or false, thenĀ writeYaml preserves its existing behavior. If it is true, then file and ovewrite must not be specified and writeYaml will return the yaml as a string.

      Example usage:

      String yaml = writeYaml data: object, returnText: true

      Ā 

            Assignee:
            rsandell
            Reporter:
            Jesse Rittner
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: