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

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


The following commit(s) were added to refs/heads/FREEMARKER-153 by this push:
     new 5ad52bf  FREEMARKER-153 Add FTL to generate LICENCE file to examples
5ad52bf is described below

commit 5ad52bf1e82410c95c247f3523338bfdc8db63fd
Author: Siegfried Goeschl <[email protected]>
AuthorDate: Fri Jul 31 21:34:23 2020 +0200

    FREEMARKER-153 Add FTL to generate LICENCE file to examples
---
 freemarker-generator-cli/run-examples.bat                 |  3 +++
 freemarker-generator-cli/run-examples.sh                  |  8 ++++----
 .../src/main/scripts/run-examples.bat                     | 15 +++++++++------
 freemarker-generator-cli/src/main/scripts/run-examples.sh | 15 +++++++++------
 .../org/apache/freemarker/generator/cli/ExamplesTest.java |  1 +
 5 files changed, 26 insertions(+), 16 deletions(-)

diff --git a/freemarker-generator-cli/run-examples.bat 
b/freemarker-generator-cli/run-examples.bat
index 95bbfd9..b8ba172 100644
--- a/freemarker-generator-cli/run-examples.bat
+++ b/freemarker-generator-cli/run-examples.bat
@@ -123,6 +123,9 @@ REM 
=========================================================================
 echo "examples\templates\html\csv\dependencies.ftl"
 %FREEMARKER_CMD% -t examples\templates\html\csv\dependencies.ftl 
examples\data\html\dependencies.html > target\out\dependencies.csv
 
+echo "examples\templates\html\txt\licence.ftl"
+%FREEMARKER_CMD% -t examples\templates\html\txt\licence.ftl 
examples\data\html\dependencies.html > target\out\licence.txt
+
 REM =========================================================================
 REM JSON
 REM =========================================================================
diff --git a/freemarker-generator-cli/run-examples.sh 
b/freemarker-generator-cli/run-examples.sh
index 719c199..ff8c2e9 100755
--- a/freemarker-generator-cli/run-examples.sh
+++ b/freemarker-generator-cli/run-examples.sh
@@ -18,7 +18,6 @@
 # Check that java is on the path
 
 hash java 2>/dev/null || { echo >&2 "I require JDK but it's not installed.  
Aborting."; exit 1; }
-hash mvn 2>/dev/null || { echo >&2 "I require Maven but it's not installed.  
Aborting."; exit 1; }
 
 # Run all the samples being documented
 
@@ -143,6 +142,9 @@ $FREEMARKER_CMD -t examples/templates/excel/csv/custom.ftl 
-Pcsv.format=MYSQL ex
 echo "examples/templates/html/csv/dependencies.ftl"
 $FREEMARKER_CMD -t examples/templates/html/csv/dependencies.ftl 
examples/data/html/dependencies.html > target/out/dependencies.csv || { echo 
>&2 "Test failed.  Aborting."; exit 1; }
 
+echo "examples/templates/html/txt/licence.ftl"
+$FREEMARKER_CMD -t examples/templates/html/txt/licence.ftl 
examples/data/html/dependencies.html > target/out/licence.txt || { echo >&2 
"Test failed.  Aborting."; exit 1; }
+
 #############################################################################
 # JSON
 #############################################################################
@@ -153,10 +155,8 @@ $FREEMARKER_CMD -t 
examples/templates/json/csv/swagger-endpoints.ftl examples/da
 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"
-$FREEMARKER_CMD -t examples/templates/json/md/github-users.ftl 
examples/data/json/github-users.json > target/out/github-users-curl.md || { 
echo >&2 "Test failed.  Aborting."; exit 1; }
-fi
+$FREEMARKER_CMD -t examples/templates/json/md/github-users.ftl 
examples/data/json/github-users.json > target/out/github-users.md || { echo >&2 
"Test failed.  Aborting."; exit 1; }
 
 #############################################################################
 # Properties
diff --git a/freemarker-generator-cli/src/main/scripts/run-examples.bat 
b/freemarker-generator-cli/src/main/scripts/run-examples.bat
index 98d6654..80dbf46 100644
--- a/freemarker-generator-cli/src/main/scripts/run-examples.bat
+++ b/freemarker-generator-cli/src/main/scripts/run-examples.bat
@@ -41,12 +41,12 @@ REM 
=========================================================================
 REM Interactive Mode
 REM =========================================================================
 
-%FREEMARKER_CMD% -i 
'${tools.jsonpath.parse(dataSources.get(0)).read("""$.info.title""")}' 
examples\data\json\swagger-spec.json > target\out\interactive-json.txt
-%FREEMARKER_CMD% -i 
'${tools.xml.parse(dataSources.get(0))["""recipients/person[1]/name"""]}' 
examples\data\xml\recipients.xml > target\out\interactive-xml.txt
-%FREEMARKER_CMD% -i 
'${tools.jsoup.parse(dataSources.get(0)).select("""a""")[0]}' 
examples\data\html\dependencies.html > target\out\interactive-html.txt
-%FREEMARKER_CMD% -i 
'${tools.gson.toJson(tools.yaml.parse(dataSources.get(0)))}' 
examples\data\yaml\swagger-spec.yaml > target\out\interactive-swagger.json
-%FREEMARKER_CMD% -i 
'${tools.yaml.toYaml(tools.gson.parse(dataSources.get(0)))}' 
examples\data\json\swagger-spec.json > target\out\interactive-swagger.yaml
-%FREEMARKER_CMD% -i 
'${tools.dataframe.print(tools.dataframe.fromMaps(tools.gson.parse(dataSources.get(0))))}'
 examples\data\json\github-users.json > target\out\interactive-dataframe.txt
+%FREEMARKER_CMD% -i 
'${tools.jsonpath.parse(dataSources?values[0]).read("""$.info.title""")}' 
examples\data\json\swagger-spec.json > target\out\interactive-json.txt
+%FREEMARKER_CMD% -i 
'${tools.xml.parse(dataSources?values[0])["""recipients/person[1]/name"""]}' 
examples\data\xml\recipients.xml > target\out\interactive-xml.txt
+%FREEMARKER_CMD% -i 
'${tools.jsoup.parse(dataSources?values[0]).select("""a""")[0]}' 
examples\data\html\dependencies.html > target\out\interactive-html.txt
+%FREEMARKER_CMD% -i 
'${tools.gson.toJson(tools.yaml.parse(dataSources?values[0]))}' 
examples\data\yaml\swagger-spec.yaml > target\out\interactive-swagger.json
+%FREEMARKER_CMD% -i 
'${tools.yaml.toYaml(tools.gson.parse(dataSources?values[0]))}' 
examples\data\json\swagger-spec.json > target\out\interactive-swagger.yaml
+%FREEMARKER_CMD% -i 
'${tools.dataframe.print(tools.dataframe.fromMaps(tools.gson.parse(dataSources?values[0])))}'
 examples\data\json\github-users.json > target\out\interactive-dataframe.txt
 
 REM =========================================================================
 REM CSV
@@ -123,6 +123,9 @@ REM 
=========================================================================
 echo "examples\templates\html\csv\dependencies.ftl"
 %FREEMARKER_CMD% -t examples\templates\html\csv\dependencies.ftl 
examples\data\html\dependencies.html > target\out\dependencies.csv
 
+echo "examples\templates\html\txt\licence.ftl"
+%FREEMARKER_CMD% -t examples\templates\html\txt\licence.ftl 
examples\data\html\dependencies.html > target\out\licence.txt
+
 REM =========================================================================
 REM JSON
 REM =========================================================================
diff --git a/freemarker-generator-cli/src/main/scripts/run-examples.sh 
b/freemarker-generator-cli/src/main/scripts/run-examples.sh
index f18c9e2..13eb994 100755
--- a/freemarker-generator-cli/src/main/scripts/run-examples.sh
+++ b/freemarker-generator-cli/src/main/scripts/run-examples.sh
@@ -46,12 +46,12 @@ $FREEMARKER_CMD -t examples/templates/demo.ftl README.md > 
target/out/demo.txt |
 # Interactive Mode
 #############################################################################
 
-$FREEMARKER_CMD -i 
'${tools.jsonpath.parse(dataSources.get(0)).read("$.info.title")}' 
examples/data/json/swagger-spec.json > target/out/interactive-json.txt || { 
echo >&2 "Test failed.  Aborting."; exit 1; }
-$FREEMARKER_CMD -i 
'${tools.xml.parse(dataSources.get(0))["recipients/person[1]/name"]}' 
examples/data/xml/recipients.xml > target/out/interactive-xml.txt || { echo >&2 
"Test failed.  Aborting."; exit 1; }
-$FREEMARKER_CMD -i '${tools.jsoup.parse(dataSources.get(0)).select("a")[0]}' 
examples/data/html/dependencies.html > target/out/interactive-html.txt || { 
echo >&2 "Test failed.  Aborting."; exit 1; }
-$FREEMARKER_CMD -i 
'${tools.gson.toJson(tools.yaml.parse(dataSources.get(0)))}' 
examples/data/yaml/swagger-spec.yaml > target/out/interactive-swagger.json || { 
echo >&2 "Test failed.  Aborting."; exit 1; }
-$FREEMARKER_CMD -i 
'${tools.yaml.toYaml(tools.gson.parse(dataSources.get(0)))}' 
examples/data/json/swagger-spec.json > target/out/interactive-swagger.yaml || { 
echo >&2 "Test failed.  Aborting."; exit 1; }
-$FREEMARKER_CMD -i 
'${tools.dataframe.print(tools.dataframe.fromMaps(tools.gson.parse(dataSources.get(0))))}'
 examples/data/json/github-users.json > target/out/interactive-dataframe.txt || 
{ echo >&2 "Test failed.  Aborting."; exit 1; }
+$FREEMARKER_CMD -i 
'${tools.jsonpath.parse(dataSources?values[0]).read("$.info.title")}' 
examples/data/json/swagger-spec.json > target/out/interactive-json.txt || { 
echo >&2 "Test failed.  Aborting."; exit 1; }
+$FREEMARKER_CMD -i 
'${tools.xml.parse(dataSources?values[0])["recipients/person[1]/name"]}' 
examples/data/xml/recipients.xml > target/out/interactive-xml.txt || { echo >&2 
"Test failed.  Aborting."; exit 1; }
+$FREEMARKER_CMD -i 
'${tools.jsoup.parse(dataSources?values[0]).select("a")[0]}' 
examples/data/html/dependencies.html > target/out/interactive-html.txt || { 
echo >&2 "Test failed.  Aborting."; exit 1; }
+$FREEMARKER_CMD -i 
'${tools.gson.toJson(tools.yaml.parse(dataSources?values[0]))}' 
examples/data/yaml/swagger-spec.yaml > target/out/interactive-swagger.json || { 
echo >&2 "Test failed.  Aborting."; exit 1; }
+$FREEMARKER_CMD -i 
'${tools.yaml.toYaml(tools.gson.parse(dataSources?values[0]))}' 
examples/data/json/swagger-spec.json > target/out/interactive-swagger.yaml || { 
echo >&2 "Test failed.  Aborting."; exit 1; }
+$FREEMARKER_CMD -i 
'${tools.dataframe.print(tools.dataframe.fromMaps(tools.gson.parse(dataSources?values[0])))}'
 examples/data/json/github-users.json > target/out/interactive-dataframe.txt || 
{ echo >&2 "Test failed.  Aborting."; exit 1; }
 
 #############################################################################
 # CSV
@@ -143,6 +143,9 @@ $FREEMARKER_CMD -t examples/templates/excel/csv/custom.ftl 
-Pcsv.format=MYSQL ex
 echo "examples/templates/html/csv/dependencies.ftl"
 $FREEMARKER_CMD -t examples/templates/html/csv/dependencies.ftl 
examples/data/html/dependencies.html > target/out/dependencies.csv || { echo 
>&2 "Test failed.  Aborting."; exit 1; }
 
+echo "examples/templates/html/txt/licence.ftl"
+$FREEMARKER_CMD -t examples/templates/html/txt/licence.ftl 
examples/data/html/dependencies.html > target/out/licence.txt || { echo >&2 
"Test failed.  Aborting."; exit 1; }
+
 #############################################################################
 # JSON
 #############################################################################
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 3548b78..d4bf8b2 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
@@ -69,6 +69,7 @@ public class ExamplesTest extends AbstractMainTest {
     @Test
     public void shouldRunHtmlExamples() throws IOException {
         assertValid(execute("-t examples/templates/html/csv/dependencies.ftl 
examples/data/html/dependencies.html"));
+        assertValid(execute("-t examples/templates/html/txt/licence.ftl 
examples/data/html/dependencies.html"));
     }
 
     @Test

Reply via email to