You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@freemarker.apache.org by sg...@apache.org on 2021/02/05 18:31:30 UTC
[freemarker-generator] branch FREEMARKER-172 updated (dcaec24 ->
98cc8e4)
This is an automated email from the ASF dual-hosted git repository.
sgoeschl pushed a change to branch FREEMARKER-172
in repository https://gitbox.apache.org/repos/asf/freemarker-generator.git.
from dcaec24 FREEMARKER-172 [freemarker-generator] Store the data sources directly as map in the FreeMarker context
new e818ab3 FREEMARKER-172 [freemarker-generator] Cleanup of changes
new 98cc8e4 FREEMARKER-172 [freemarker-generator] Cleanup of changes
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
freemarker-generator-cli/CHANGELOG.md | 17 ++++++++++-------
.../generator/cli/config/ConfigurationSupplier.java | 4 ++--
.../generator/cli/config/DataModelSupplier.java | 2 +-
.../cli/picocli/OutputGeneratorDefinition.java | 4 +---
.../freemarker/generator/cli/task/FreeMarkerTask.java | 2 +-
5 files changed, 15 insertions(+), 14 deletions(-)
[freemarker-generator] 02/02: FREEMARKER-172 [freemarker-generator]
Cleanup of changes
Posted by sg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sgoeschl pushed a commit to branch FREEMARKER-172
in repository https://gitbox.apache.org/repos/asf/freemarker-generator.git
commit 98cc8e4f5642c8258bee7f55a4d7739d332ab89f
Author: Siegfried Goeschl <si...@gmail.com>
AuthorDate: Fri Feb 5 19:31:13 2021 +0100
FREEMARKER-172 [freemarker-generator] Cleanup of changes
---
.../org/apache/freemarker/generator/cli/config/DataModelSupplier.java | 2 +-
.../freemarker/generator/cli/picocli/OutputGeneratorDefinition.java | 4 +---
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/freemarker-generator-cli/src/main/java/org/apache/freemarker/generator/cli/config/DataModelSupplier.java b/freemarker-generator-cli/src/main/java/org/apache/freemarker/generator/cli/config/DataModelSupplier.java
index 0684dc6..57591d6 100644
--- a/freemarker-generator-cli/src/main/java/org/apache/freemarker/generator/cli/config/DataModelSupplier.java
+++ b/freemarker-generator-cli/src/main/java/org/apache/freemarker/generator/cli/config/DataModelSupplier.java
@@ -66,7 +66,7 @@ public class DataModelSupplier implements Supplier<Map<String, Object>> {
public Map<String, Object> get() {
return sources.stream()
.filter(StringUtils::isNotEmpty)
- .map(source -> toDataModel(source))
+ .map(this::toDataModel)
.flatMap(map -> map.entrySet().stream())
.collect(Collectors.toMap(Entry::getKey, Entry::getValue));
}
diff --git a/freemarker-generator-cli/src/main/java/org/apache/freemarker/generator/cli/picocli/OutputGeneratorDefinition.java b/freemarker-generator-cli/src/main/java/org/apache/freemarker/generator/cli/picocli/OutputGeneratorDefinition.java
index 78352ec..a8fb389 100644
--- a/freemarker-generator-cli/src/main/java/org/apache/freemarker/generator/cli/picocli/OutputGeneratorDefinition.java
+++ b/freemarker-generator-cli/src/main/java/org/apache/freemarker/generator/cli/picocli/OutputGeneratorDefinition.java
@@ -103,10 +103,8 @@ public class OutputGeneratorDefinition {
private static boolean isFileSource(String source) {
if (source.contains("file://")) {
return true;
- } else if (source.contains("://")) {
- return false;
} else {
- return true;
+ return !source.contains("://");
}
}
}
[freemarker-generator] 01/02: FREEMARKER-172 [freemarker-generator]
Cleanup of changes
Posted by sg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sgoeschl pushed a commit to branch FREEMARKER-172
in repository https://gitbox.apache.org/repos/asf/freemarker-generator.git
commit e818ab3d3df95368b085e560af855c4b802f104d
Author: Siegfried Goeschl <si...@gmail.com>
AuthorDate: Fri Feb 5 19:28:18 2021 +0100
FREEMARKER-172 [freemarker-generator] Cleanup of changes
---
freemarker-generator-cli/CHANGELOG.md | 17 ++++++++++-------
.../generator/cli/config/ConfigurationSupplier.java | 4 ++--
.../freemarker/generator/cli/task/FreeMarkerTask.java | 2 +-
3 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/freemarker-generator-cli/CHANGELOG.md b/freemarker-generator-cli/CHANGELOG.md
index 6565367..757caf0 100644
--- a/freemarker-generator-cli/CHANGELOG.md
+++ b/freemarker-generator-cli/CHANGELOG.md
@@ -5,9 +5,9 @@ All notable changes to this project will be documented in this file. We try to a
## 0.1.0-SNAPSHOT
### Added
-* Parse list of `DataSources` for the various tools
+* Parse a list of `DataSources` for the various tools
+* [FREEMARKER-161] Allow multiple transformations on the CLI
* [FREEMARKER-163] Integrate Java Faker library for test data generation
-* [FREEMARKER-148] Make usage of "DataSources" more "Freemarker" like
* [FREEMARKER-149] Support multiple template transformations on the command line
* [FREEMARKER-144] Proof Of Concept for providing DataFrames
* [FREEMARKER-142] Support Transformation Of Directories
@@ -17,30 +17,31 @@ All notable changes to this project will be documented in this file. We try to a
* [FREEMARKER-129] Support `DataSource` exclude pattern in addition to include pattern
* [FREEMARKER-129] User-defined parameters are passed as `-Pkey=value` instead of using system properties
* [FREEMARKER-129] Migrate `freemarker-cli` into `freemarker-generator` project (see [https://github.com/sgoeschl/freemarker-cli](https://github.com/sgoeschl/freemarker-cli))
+* [FREEMARKER-129] Provide a `toString()` method for all tools
### Changed
-* [FREEMARKER-161] Allow multiple transformations on the CLI
-* [FREEMARKER-155] Migrate the FTL code to terser dotter form
+* [FREEMARKER-148] Make usage of "DataSources" more "Freemarker" like
+* [FREEMARKER-155] Migrate the FTL code to terser dotter form
* [FREEMARKER-153] Packaged templates are now prefixed with `freemarker-generator`, e.g. `freemarker-generator/info.ftl`
* [FREEMARKER-153] Renamed `--basedir` command line option to `--template-dir`
* [FREEMARKER-153] Renamed `freemarker-cli` to `freemarker-generator`
-* Removing `DataSources.first` and use `dataSources.get(0)` instead
* [FREEMARKER-146] Cleanly separate example templates and data from user-supplied content
* `DataSource` use `uri` instead of `location`
* [FREEMARKER-138] freemarker-generator: Rename `Datasource` to `DataSource`
* [FREEMARKER-136] Fix broken `site:stage` build
* [FREEMARKER-134] Rename `Document` to `Datasource` which also changes `--document` to `--datasource`
* [FREEMARKER-129] Use `freemarker.configuration.setting` in `freemarker-cli.properties` to configure FreeMarker
-* [FREEMARKER-129] Provide a `toString()` method for all tools
* [FREEMARKER-129] Use version "0.X.Y" to cater for API changes according to [Semantic Versioning](https://semver.org)
### Fixed
+* [FREEMARKER-156] The Maven plugin unit tests failed randomly
* [FREEMARKER-153] Configuration files are bootstrapped from "app.home" system property
* [FREEMARKER-151] Ensure that build and and examples are running on Windows
* [FREEMARKER-147] Complete Maven site documentation
* [FREEMARKER-127] Site build fails with missing "org/apache/maven/doxia/siterenderer/DocumentContent"
### Internal
+* [FREEMARKER-172] Refactor DataSourceFactory
* [FREEMARKER-164] Use default unsafe FreeMarker configuration
* [FREEMARKER-153] FreeMarker Generator release preparations
* [FREEMARKER-168] Upgrade dependencies of freemarker-generator
@@ -62,7 +63,9 @@ All notable changes to this project will be documented in this file. We try to a
[FREEMARKER-151]: https://issues.apache.org/jira/browse/FREEMARKER-151
[FREEMARKER-153]: https://issues.apache.org/jira/browse/FREEMARKER-153
[FREEMARKER-155]: https://issues.apache.org/jira/browse/FREEMARKER-155
+[FREEMARKER-156]: https://issues.apache.org/jira/browse/FREEMARKER-156
[FREEMARKER-161]: https://issues.apache.org/jira/browse/FREEMARKER-161
[FREEMARKER-163]: https://issues.apache.org/jira/browse/FREEMARKER-163
[FREEMARKER-164]: https://issues.apache.org/jira/browse/FREEMARKER-164
-[FREEMARKER-168]: https://issues.apache.org/jira/browse/FREEMARKER-168
\ No newline at end of file
+[FREEMARKER-168]: https://issues.apache.org/jira/browse/FREEMARKER-168
+[FREEMARKER-172]: https://issues.apache.org/jira/browse/FREEMARKER-172
diff --git a/freemarker-generator-cli/src/main/java/org/apache/freemarker/generator/cli/config/ConfigurationSupplier.java b/freemarker-generator-cli/src/main/java/org/apache/freemarker/generator/cli/config/ConfigurationSupplier.java
index 9c165a3..d936970 100644
--- a/freemarker-generator-cli/src/main/java/org/apache/freemarker/generator/cli/config/ConfigurationSupplier.java
+++ b/freemarker-generator-cli/src/main/java/org/apache/freemarker/generator/cli/config/ConfigurationSupplier.java
@@ -55,8 +55,8 @@ public class ConfigurationSupplier implements Supplier<Configuration> {
// apply all "freemarker.configuration.setting" values
configuration.setSettings(freeMarkerConfigurationSettings());
- // TODO sgoeschl 2021-02-05 Probably not needed at all
- // configuration.setObjectWrapper(new "dataSources"(FREEMARKER_VERSION));
+ // TODO sgoeschl 2021-02-05 Probably not needed at all since we use the map of data source
+ configuration.setObjectWrapper(new GeneratorObjectWrapper(FREEMARKER_VERSION));
// override current configuration with caller-provided settings
configuration.setDefaultEncoding(settings.getTemplateEncoding().name());
diff --git a/freemarker-generator-cli/src/main/java/org/apache/freemarker/generator/cli/task/FreeMarkerTask.java b/freemarker-generator-cli/src/main/java/org/apache/freemarker/generator/cli/task/FreeMarkerTask.java
index d202786..1fe6f57 100644
--- a/freemarker-generator-cli/src/main/java/org/apache/freemarker/generator/cli/task/FreeMarkerTask.java
+++ b/freemarker-generator-cli/src/main/java/org/apache/freemarker/generator/cli/task/FreeMarkerTask.java
@@ -116,7 +116,7 @@ public class FreeMarkerTask implements Callable<Integer> {
private static Map<String, Object> toTemplateDataModel(DataSources dataSources, Map<String, Object>... maps) {
final Map<String, Object> result = new HashMap<>();
Arrays.stream(maps).forEach(result::putAll);
- result.put(Model.DATASOURCES, dataSources.toMap());
+ result.put(Model.DATASOURCES, dataSources);
return result;
}