From 58ad0a33e7be582db024f5e6976fa0a74ae2eca4 Mon Sep 17 00:00:00 2001 From: Oliver Drotbohm Date: Thu, 19 Jan 2023 16:12:34 +0100 Subject: [PATCH] GH-120 - Use *.puml as default file extension for PlantUML files generated. --- .../java/org/springframework/modulith/docs/Documenter.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/spring-modulith-docs/src/main/java/org/springframework/modulith/docs/Documenter.java b/spring-modulith-docs/src/main/java/org/springframework/modulith/docs/Documenter.java index 7633210c..c6f7db7d 100644 --- a/spring-modulith-docs/src/main/java/org/springframework/modulith/docs/Documenter.java +++ b/spring-modulith-docs/src/main/java/org/springframework/modulith/docs/Documenter.java @@ -76,6 +76,9 @@ public class Documenter { private static final String INVALID_FILE_NAME_PATTERN = "Configured file name pattern does not include a '%s' placeholder for the module name!"; private static final String DEFAULT_LOCATION = "spring-modulith-docs"; + private static final String DEFAULT_COMPONENTS_FILE = "components.puml"; + private static final String DEFAULT_MODULE_COMPONENTS_FILE = "module-%s.puml"; + static { DEPENDENCY_DESCRIPTIONS.put(DependencyType.EVENT_LISTENER, "listens to"); DEPENDENCY_DESCRIPTIONS.put(DependencyType.DEFAULT, "depends on"); @@ -203,7 +206,7 @@ public class Documenter { Assert.notNull(options, "Options must not be null!"); - Path file = recreateFile(options.getTargetFileName().orElse("components.uml")); + Path file = recreateFile(options.getTargetFileName().orElse(DEFAULT_COMPONENTS_FILE)); try (Writer writer = new FileWriter(file.toFile())) { writer.write(createPlantUml(options)); @@ -264,7 +267,7 @@ public class Documenter { addComponentsToView(module, view, options); - var fileNamePattern = options.getTargetFileName().orElse("module-%s.uml"); + var fileNamePattern = options.getTargetFileName().orElse(DEFAULT_MODULE_COMPONENTS_FILE); Assert.isTrue(fileNamePattern.contains("%s"), () -> String.format(INVALID_FILE_NAME_PATTERN, fileNamePattern));