Skip to content

Commit

Permalink
refactor: documentation generator
Browse files Browse the repository at this point in the history
  • Loading branch information
sakurawald committed Jul 6, 2024
1 parent e02707d commit e4b37e6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion fuji-fabric.wiki
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
import java.util.List;
import java.util.Map;

public class BuildConfigurationDocumentTest {
public class DocumentationGeneratorTest {

private JsonObject buildJsonObjectWithComments(Object obj) {
private JsonObject processJavaObject(Object obj) {
JsonObject jsonObject = new JsonObject();
processFields(obj, jsonObject);
return jsonObject;
Expand Down Expand Up @@ -77,8 +77,9 @@ private boolean isPrimitiveOrWrapper(Class<?> clazz) {

private void writeToFile(String fileName, JsonObject content) {
Gson gson = new GsonBuilder().setPrettyPrinting().create();
String filePath = "./build/document/" + fileName;
String filePath = "./build/documentation/" + fileName;
new File(filePath).getParentFile().mkdirs();

try (FileWriter writer = new FileWriter(filePath)) {
writer.write(gson.toJson(content));
System.out.println("File " + fileName + " has been written successfully.");
Expand All @@ -88,7 +89,9 @@ private void writeToFile(String fileName, JsonObject content) {
}

@Test
void buildConfigurationDocument() {
writeToFile("config.json", buildJsonObjectWithComments(new ConfigModel()));
void buildConfigurationDocumentation() {
writeToFile("config.json", processJavaObject(new ConfigModel()));
}

// todo: a generator for Module.md
}

0 comments on commit e4b37e6

Please sign in to comment.