This is an automated email from the ASF dual-hosted git repository.

sgoeschl pushed a commit to branch FREEMARKER-146
in repository https://gitbox.apache.org/repos/asf/freemarker-generator.git


The following commit(s) were added to refs/heads/FREEMARKER-146 by this push:
     new 9f2b2e4  FREEMARKER-146 Cleanly separate example templates and data 
from user-supplied content
9f2b2e4 is described below

commit 9f2b2e41636932ed37ec064006128256f68b218a
Author: Siegfried Goeschl <[email protected]>
AuthorDate: Sat Jun 20 21:53:41 2020 +0200

    FREEMARKER-146 Cleanly separate example templates and data from 
user-supplied content
---
 freemarker-generator-cli/README.md                             | 10 ++++------
 freemarker-generator-cli/run-examples.sh                       |  8 ++++----
 freemarker-generator-cli/src/main/scripts/run-examples.sh      |  8 ++++----
 .../java/org/apache/freemarker/generator/cli/ExamplesTest.java |  4 ++--
 .../{examples => }/templates/json/yaml/transform.ftl           |  0
 .../{examples => }/templates/yaml/json/transform.ftl           |  0
 6 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/freemarker-generator-cli/README.md 
b/freemarker-generator-cli/README.md
index 3060216..b8b7d2a 100644
--- a/freemarker-generator-cli/README.md
+++ b/freemarker-generator-cli/README.md
@@ -152,12 +152,12 @@ templates/excel/csv/transform.ftl
 examples/templates/excel/csv/custom.ftl
 examples/templates/html/csv/dependencies.ftl
 examples/templates/json/csv/swagger-endpoints.ftl
-examples/templates/json/yaml/transform.ftl
+templates/json/yaml/transform.ftl
 examples/templates/json/md/github-users.ftl
 examples/templates/properties/csv/locker-test-users.ftl
 examples/data/template
 examples/templates/yaml/txt/transform.ftl
-examples/templates/yaml/json/transform.ftl
+templates/yaml/json/transform.ftl
 examples/templates/xml/txt/recipients.ftl
 Created the following sample files in ./target/out
 total 1576
@@ -1022,8 +1022,6 @@ So lets start the filtering & transformation using the 
following command line
 ```text
 > bin/freemarker-cli -e UTF-8 -l de_AT -Pcolumn="Order ID" \
   -Pvalues=226939189,957081544 \
-  -Pformat=DEFAULT \
-  -Pdelimiter=COMMA \
   -t examples/templates/csv/md/filter.ftl examples/data/csv/sales-records.csv
 ```
 
@@ -1116,11 +1114,11 @@ yields
 Sometimes we simply need to transform a JSON into an equivalent YAML or the 
other way around
 
 ```
-> ./bin/freemarker-cli -t examples/templates/yaml/json/transform.ftl 
examples/data/yaml/swagger-spec.yaml 
+> ./bin/freemarker-cli -t templates/yaml/json/transform.ftl 
examples/data/yaml/swagger-spec.yaml 
 > ./bin/freemarker-cli -i 
 > '${GsonTool.toJson(YamlTool.parse(DataSources.get(0)))}' 
 > examples/data/yaml/swagger-spec.yaml
 > ./bin/freemarker-cli -i '${GsonTool.toJson(yaml)}' -m 
 > yaml=examples/data/yaml/swagger-spec.yaml
 
-> ./bin/freemarker-cli -t examples/templates/json/yaml/transform.ftl 
examples/data/json/swagger-spec.json
+> ./bin/freemarker-cli -t templates/json/yaml/transform.ftl 
examples/data/json/swagger-spec.json
 > ./bin/freemarker-cli -i 
 > '${YamlTool.toYaml(GsonTool.parse(DataSources.get(0)))}' 
 > examples/data/json/swagger-spec.json
 > ./bin/freemarker-cli -i '${YamlTool.toYaml(json)}' -m 
 > json=examples/data/json/swagger-spec.json
 ```
diff --git a/freemarker-generator-cli/run-examples.sh 
b/freemarker-generator-cli/run-examples.sh
index 37e6d4e..a8993da 100755
--- a/freemarker-generator-cli/run-examples.sh
+++ b/freemarker-generator-cli/run-examples.sh
@@ -150,8 +150,8 @@ $FREEMARKER_CMD -t 
examples/templates/html/csv/dependencies.ftl examples/data/ht
 echo "examples/templates/json/csv/swagger-endpoints.ftl"
 $FREEMARKER_CMD -t examples/templates/json/csv/swagger-endpoints.ftl 
examples/data/json/swagger-spec.json > target/out/swagger-spec.csv || { echo 
>&2 "Test failed.  Aborting."; exit 1; }
 
-echo "examples/templates/json/yaml/transform.ftl"
-$FREEMARKER_CMD -t examples/templates/json/yaml/transform.ftl 
examples/data/json/swagger-spec.json > target/out/swagger-spec.yaml || { echo 
>&2 "Test failed.  Aborting."; exit 1; }
+echo "templates/json/yaml/transform.ftl"
+$FREEMARKER_CMD -t templates/json/yaml/transform.ftl 
examples/data/json/swagger-spec.json > target/out/swagger-spec.yaml || { echo 
>&2 "Test failed.  Aborting."; exit 1; }
 
 if hash curl 2>/dev/null; then
 echo "examples/templates/json/md/github-users.ftl"
@@ -179,8 +179,8 @@ $FREEMARKER_CMD -t examples/data/template 
-PNGINX_HOSTNAME=localhost -o target/o
 echo "examples/templates/yaml/txt/transform.ftl"
 $FREEMARKER_CMD -t examples/templates/yaml/txt/transform.ftl 
examples/data/yaml/customer.yaml > target/out/customer.txt || { echo >&2 "Test 
failed.  Aborting."; exit 1; }
 
-echo "examples/templates/yaml/json/transform.ftl"
-$FREEMARKER_CMD -t examples/templates/yaml/json/transform.ftl 
examples/data/yaml/swagger-spec.yaml > target/out/swagger-spec.json || { echo 
>&2 "Test failed.  Aborting."; exit 1; }
+echo "templates/yaml/json/transform.ftl"
+$FREEMARKER_CMD -t templates/yaml/json/transform.ftl 
examples/data/yaml/swagger-spec.yaml > target/out/swagger-spec.json || { echo 
>&2 "Test failed.  Aborting."; exit 1; }
 
 #############################################################################
 # XML
diff --git a/freemarker-generator-cli/src/main/scripts/run-examples.sh 
b/freemarker-generator-cli/src/main/scripts/run-examples.sh
index c81cb71..f467c9d 100755
--- a/freemarker-generator-cli/src/main/scripts/run-examples.sh
+++ b/freemarker-generator-cli/src/main/scripts/run-examples.sh
@@ -150,8 +150,8 @@ $FREEMARKER_CMD -t 
examples/templates/html/csv/dependencies.ftl examples/data/ht
 echo "examples/templates/json/csv/swagger-endpoints.ftl"
 $FREEMARKER_CMD -t examples/templates/json/csv/swagger-endpoints.ftl 
examples/data/json/swagger-spec.json > target/out/swagger-spec.csv || { echo 
>&2 "Test failed.  Aborting."; exit 1; }
 
-echo "examples/templates/json/yaml/transform.ftl"
-$FREEMARKER_CMD -t examples/templates/json/yaml/transform.ftl 
examples/data/json/swagger-spec.json > target/out/swagger-spec.yaml || { echo 
>&2 "Test failed.  Aborting."; exit 1; }
+echo "templates/json/yaml/transform.ftl"
+$FREEMARKER_CMD -t templates/json/yaml/transform.ftl 
examples/data/json/swagger-spec.json > target/out/swagger-spec.yaml || { echo 
>&2 "Test failed.  Aborting."; exit 1; }
 
 if hash curl 2>/dev/null; then
 echo "examples/templates/json/md/github-users.ftl"
@@ -179,8 +179,8 @@ $FREEMARKER_CMD -t examples/data/template 
-PNGINX_HOSTNAME=localhost -o target/o
 echo "examples/templates/yaml/txt/transform.ftl"
 $FREEMARKER_CMD -t examples/templates/yaml/txt/transform.ftl 
examples/data/yaml/customer.yaml > target/out/customer.txt || { echo >&2 "Test 
failed.  Aborting."; exit 1; }
 
-echo "examples/templates/yaml/json/transform.ftl"
-$FREEMARKER_CMD -t examples/templates/yaml/json/transform.ftl 
examples/data/yaml/swagger-spec.yaml > target/out/swagger-spec.json || { echo 
>&2 "Test failed.  Aborting."; exit 1; }
+echo "templates/yaml/json/transform.ftl"
+$FREEMARKER_CMD -t templates/yaml/json/transform.ftl 
examples/data/yaml/swagger-spec.yaml > target/out/swagger-spec.json || { echo 
>&2 "Test failed.  Aborting."; exit 1; }
 
 #############################################################################
 # XML
diff --git 
a/freemarker-generator-cli/src/test/java/org/apache/freemarker/generator/cli/ExamplesTest.java
 
b/freemarker-generator-cli/src/test/java/org/apache/freemarker/generator/cli/ExamplesTest.java
index 45a027d..1d72527 100644
--- 
a/freemarker-generator-cli/src/test/java/org/apache/freemarker/generator/cli/ExamplesTest.java
+++ 
b/freemarker-generator-cli/src/test/java/org/apache/freemarker/generator/cli/ExamplesTest.java
@@ -74,7 +74,7 @@ public class ExamplesTest extends AbstractMainTest {
     public void shouldRunJsonExamples() throws IOException {
         assertValid(execute("-t 
examples/templates/json/csv/swagger-endpoints.ftl 
examples/data/json/swagger-spec.json"));
         assertValid(execute("-t examples/templates/json/md/github-users.ftl 
examples/data/json/github-users.json"));
-        assertValid(execute("-t examples/templates/json/yaml/transform.ftl 
examples/data/json/swagger-spec.json"));
+        assertValid(execute("-t templates/json/yaml/transform.ftl 
examples/data/json/swagger-spec.json"));
     }
 
     @Test
@@ -85,7 +85,7 @@ public class ExamplesTest extends AbstractMainTest {
     @Test
     public void shouldRunYamlExamples() throws IOException {
         assertValid(execute("-t examples/templates/yaml/txt/transform.ftl 
examples/data/yaml/customer.yaml"));
-        assertValid(execute("-t examples/templates/yaml/json/transform.ftl 
examples/data/yaml/swagger-spec.yaml"));
+        assertValid(execute("-t templates/yaml/json/transform.ftl 
examples/data/yaml/swagger-spec.yaml"));
     }
 
     @Test
diff --git 
a/freemarker-generator-cli/examples/templates/json/yaml/transform.ftl 
b/freemarker-generator-cli/templates/json/yaml/transform.ftl
similarity index 100%
rename from freemarker-generator-cli/examples/templates/json/yaml/transform.ftl
rename to freemarker-generator-cli/templates/json/yaml/transform.ftl
diff --git 
a/freemarker-generator-cli/examples/templates/yaml/json/transform.ftl 
b/freemarker-generator-cli/templates/yaml/json/transform.ftl
similarity index 100%
rename from freemarker-generator-cli/examples/templates/yaml/json/transform.ftl
rename to freemarker-generator-cli/templates/yaml/json/transform.ftl

Reply via email to