From 7163e2b6ead4ca9f23bd18b9b95da5458ffaf8d5 Mon Sep 17 00:00:00 2001 From: jlangch Date: Wed, 18 Oct 2023 14:47:26 +0200 Subject: [PATCH] refactoring --- .../impl/docgen/cheatsheet/DocGenerator.java | 5 +- .../modules/ModuleTimingSection.java | 57 +++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/github/jlangch/venice/impl/docgen/cheatsheet/modules/ModuleTimingSection.java diff --git a/src/main/java/com/github/jlangch/venice/impl/docgen/cheatsheet/DocGenerator.java b/src/main/java/com/github/jlangch/venice/impl/docgen/cheatsheet/DocGenerator.java index 8ebd61ed5..e45fd4b9f 100644 --- a/src/main/java/com/github/jlangch/venice/impl/docgen/cheatsheet/DocGenerator.java +++ b/src/main/java/com/github/jlangch/venice/impl/docgen/cheatsheet/DocGenerator.java @@ -62,6 +62,7 @@ import com.github.jlangch.venice.impl.docgen.cheatsheet.modules.ModuleSemverSection; import com.github.jlangch.venice.impl.docgen.cheatsheet.modules.ModuleShellSection; import com.github.jlangch.venice.impl.docgen.cheatsheet.modules.ModuleTestSection; +import com.github.jlangch.venice.impl.docgen.cheatsheet.modules.ModuleTimingSection; import com.github.jlangch.venice.impl.docgen.cheatsheet.modules.ModuleTracingSection; import com.github.jlangch.venice.impl.docgen.cheatsheet.modules.ModuleXmlSection; import com.github.jlangch.venice.impl.docgen.cheatsheet.section.ArraySection; @@ -322,6 +323,7 @@ private List getTOC() { extmod.addSection(new DocSection("Test", "modules.test")); extmod.addSection(new DocSection("Tracing", "modules.tracing")); extmod.addSection(new DocSection("Benchmark", "modules.benchmark")); + extmod.addSection(new DocSection("Timing", "modules.timing")); extmod.addSection(new DocSection("App", "modules.app")); extmod.addSection(new DocSection("QR\u00A0Ref", "modules.qrref")); content.add(extmod); @@ -421,7 +423,8 @@ private List getModulesRightSections() { new ModuleConfigSection(diBuilder).section(), new ModuleComponentSection(diBuilder).section(), new ModuleAppSection(diBuilder).section(), - new ModuleBenchmarkSection(diBuilder).section()); + new ModuleBenchmarkSection(diBuilder).section(), + new ModuleTimingSection(diBuilder).section()); } private List getDocItems(final List sections) { diff --git a/src/main/java/com/github/jlangch/venice/impl/docgen/cheatsheet/modules/ModuleTimingSection.java b/src/main/java/com/github/jlangch/venice/impl/docgen/cheatsheet/modules/ModuleTimingSection.java new file mode 100644 index 000000000..def9ecce6 --- /dev/null +++ b/src/main/java/com/github/jlangch/venice/impl/docgen/cheatsheet/modules/ModuleTimingSection.java @@ -0,0 +1,57 @@ +/* __ __ _ + * \ \ / /__ _ __ (_) ___ ___ + * \ \/ / _ \ '_ \| |/ __/ _ \ + * \ / __/ | | | | (_| __/ + * \/ \___|_| |_|_|\___\___| + * + * + * Copyright 2017-2023 Venice + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.github.jlangch.venice.impl.docgen.cheatsheet.modules; + +import com.github.jlangch.venice.impl.docgen.cheatsheet.DocItemBuilder; +import com.github.jlangch.venice.impl.docgen.cheatsheet.DocSection; +import com.github.jlangch.venice.impl.docgen.cheatsheet.ISectionBuilder; + + +public class ModuleTimingSection implements ISectionBuilder { + + public ModuleTimingSection(final DocItemBuilder diBuilder) { + this.diBuilder = diBuilder; + } + + @Override + public DocSection section() { + final DocSection section = new DocSection( + "Timing", + "Timing", + "modules.timing"); + + final DocSection all = new DocSection("(load-module :timing)", id()); + section.addSection(all); + + final DocSection docker = new DocSection("Timing", id()); + all.addSection(docker); + docker.addItem(diBuilder.getDocItem("timing/run", true)); + + return section; + } + + private String id() { + return diBuilder.id(); + } + + private final DocItemBuilder diBuilder; +}