Skip to content

Commit

Permalink
Added 00-docs generator.
Browse files Browse the repository at this point in the history
  • Loading branch information
pme123 committed Dec 14, 2024
1 parent c3d9d3d commit 9aaec94
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 13 deletions.
Binary file added 04-helper/src/main/resources/favicon.ico
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package camundala.helper.dev

import camundala.helper.dev.company.InitCompanyGenerator
import camundala.helper.dev.company.CompanyGenerator
import camundala.helper.util.{DevConfig, RepoConfig}

import scala.util.{Failure, Success, Try}
Expand Down Expand Up @@ -36,16 +36,16 @@ object DevCompanyHelper:
enum Command:
case init, project

def initCompany: Unit =
private def initCompany: Unit =
println(s"Init Company $companyName")
given config: DevConfig = InitCompanyGenerator.init(companyName)
InitCompanyGenerator().generate
given config: DevConfig = CompanyGenerator.init(companyName)
CompanyGenerator().generate


def createProject(projectName: String): Unit =
private def createProject(projectName: String): Unit =
println(s"Create Project: $projectName - Company: $companyName")
given config: DevConfig = DevConfig.defaultConfig(s"$companyName-$projectName")
InitCompanyGenerator().createProject
CompanyGenerator().createProject

private lazy val companyName = os.pwd.last.replace("dev-", "").toLowerCase

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
package camundala.helper.dev.company

import camundala.helper.dev.update.createIfNotExists

case class CompanyDocsGenerator (companyCamundala: os.Path):
private lazy val docs = companyCamundala / s"00-docs" / "src" / "docs"

lazy val generate: Unit =
println("Generate Company Docs")
// generate docs
directory("dependencies", "Dependencies", isVersioned = true)
directory("helium", "Helium", isVersioned = false)
contact
instructions
favicon
pattern
statistics
style

private lazy val contact =
createIfNotExists(docs / "contact.md",
s"""|## Contact
|If you have questions, spot a bug or you miss something, please let us know🤓.
|
|- _Business_
| - [Peter Blank](mailto:peter.blank@todo.ch)
|- _Technical_
| - [Maya Blue](mailto:maya.blue@todo.ch)
|""".stripMargin
)
private lazy val instructions =
createIfNotExists(docs / "instructions.md",
s"""|## Create This Page
|This is a semi-automatic process. This should be done either to prepare a Release or after a Release.
|
|Do the following steps:
|
|- TODO describe your process here
|""".stripMargin
)

private lazy val pattern =
createIfNotExists(docs / "pattern.md",
s"""|# Process Pattern
|We try to establish Patterns for doing the same tasks.
|This documentation lists them and gives you some examples.
|
|TODO: Describe the Patterns here that you want to establish.
|""".stripMargin
)
private lazy val statistics =
createIfNotExists(docs / "statistics.md",
s"""|# Process Statistics
|
|The Process Statistics you find new in Camunda Optimize.
|
|TODO - Create here a link to the Optimize Dashboard or add some statistics manually.
|
|<iframe id="optimizeFrame" src="https://TODO/" frameborder="0" style="width: 1000px; height: 700px; allowtransparency; overflow: scroll"></iframe>
|""".stripMargin)
private lazy val style =
createIfNotExists(docs / "style.md",
s"""|.mermaid svg {
| height: 400px;
|}
|.colorLegend {
| margin-left: auto;
| margin-right: 40px;
| width: 400px;
|}
|""".stripMargin)

private lazy val favicon =
val faviconPath = docs / "favicon.ico"
if !os.exists(faviconPath) then
os.write(faviconPath, (os.resource / "favicon.ico").toSource)

private def directory(name: String, title: String, isVersioned: Boolean) =
os.makeDir.all(docs / name)
createIfNotExists(docs / name / "directory.md",
s"""|${laikaVersioned(isVersioned)}
|
|${laikaTitle(title)}
|
|$laikaNavigationOrder
|""".stripMargin
)

private def laikaVersioned(isVersioned: Boolean) = s"laika.versioned = $isVersioned"
private def laikaTitle(title: String) = s"laika.title = $title"
private lazy val laikaNavigationOrder = s"laika.navigationOrder = [\n]"
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@ package camundala.helper.dev.company

import camundala.helper.dev.update.*

case class InitCompanyGenerator()(using config: DevConfig):
case class CompanyGenerator()(using config: DevConfig):

lazy val generate: Unit =
generateDirectories
DirectoryGenerator().generate // generates myCompany-camundala project

// needed helper classes
CompanyWrapperGenerator().generate
// override helperCompany.scala
createOrUpdate(os.pwd / "helperCompany.scala", CompanyScriptCreator().companyHelper)
// sbt
CompanySbtGenerator().generate
// docs
CompanyDocsGenerator(companyCamundala).generate
end generate

lazy val createProject: Unit =
Expand All @@ -26,24 +29,23 @@ case class InitCompanyGenerator()(using config: DevConfig):
private lazy val generateDirectories: Unit =
os.makeDir.all(gitTemp)
os.makeDir.all(docker)
os.makeDir.all(docs)
os.makeDir.all(companyCamundala)
os.makeDir.all(projects)

end generateDirectories

private lazy val generateProjectDirectories: Unit =
os.makeDir.all(projects / projectName)

private lazy val gitTemp = os.pwd / "git-temp"
private lazy val docker = os.pwd / "docker"
private lazy val docs = os.pwd / s"$companyName-docs"
private lazy val companyCamundala = os.pwd / s"$companyName-camundala"
private lazy val projects = os.pwd / "projects"
end CompanyGenerator

end InitCompanyGenerator

object InitCompanyGenerator:
object CompanyGenerator:
def init(companyName: String) = //, repoConfig: RepoConfig.Artifactory) =
DevConfig.defaultConfig(s"$companyName-camundala")
end init

end InitCompanyGenerator
end CompanyGenerator
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ trait DocCreator extends DependencyCreator, Helpers:
val table =
s"""
|{%
|// auto generated - do not change!
|laika.versioned = true
|%}
|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package camundala.myCompany

import camundala.api.*
import camundala.helper.dev.company.docs.DocCreator
import camundala.helper.util.PublishConfig

/*
Starting point to use Camundala for Company wide documentation
Expand All @@ -14,4 +15,6 @@ object MyCompanyDocCreator extends DocCreator, App:
println("Uploaded to Web Server")

prepareDocs()

override protected def publishConfig: Option[PublishConfig] = None
end MyCompanyDocCreator

0 comments on commit 9aaec94

Please sign in to comment.