Skip to content

Commit 9aaec94

Browse files
committed
Added 00-docs generator.
1 parent c3d9d3d commit 9aaec94

File tree

6 files changed

+110
-13
lines changed

6 files changed

+110
-13
lines changed
7.76 KB
Binary file not shown.

04-helper/src/main/scala/camundala/helper/dev/DevCompanyHelper.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package camundala.helper.dev
22

3-
import camundala.helper.dev.company.InitCompanyGenerator
3+
import camundala.helper.dev.company.CompanyGenerator
44
import camundala.helper.util.{DevConfig, RepoConfig}
55

66
import scala.util.{Failure, Success, Try}
@@ -36,16 +36,16 @@ object DevCompanyHelper:
3636
enum Command:
3737
case init, project
3838

39-
def initCompany: Unit =
39+
private def initCompany: Unit =
4040
println(s"Init Company $companyName")
41-
given config: DevConfig = InitCompanyGenerator.init(companyName)
42-
InitCompanyGenerator().generate
41+
given config: DevConfig = CompanyGenerator.init(companyName)
42+
CompanyGenerator().generate
4343

4444

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

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

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
package camundala.helper.dev.company
2+
3+
import camundala.helper.dev.update.createIfNotExists
4+
5+
case class CompanyDocsGenerator (companyCamundala: os.Path):
6+
private lazy val docs = companyCamundala / s"00-docs" / "src" / "docs"
7+
8+
lazy val generate: Unit =
9+
println("Generate Company Docs")
10+
// generate docs
11+
directory("dependencies", "Dependencies", isVersioned = true)
12+
directory("helium", "Helium", isVersioned = false)
13+
contact
14+
instructions
15+
favicon
16+
pattern
17+
statistics
18+
style
19+
20+
private lazy val contact =
21+
createIfNotExists(docs / "contact.md",
22+
s"""|## Contact
23+
|If you have questions, spot a bug or you miss something, please let us know🤓.
24+
|
25+
|- _Business_
26+
| - [Peter Blank](mailto:peter.blank@todo.ch)
27+
|- _Technical_
28+
| - [Maya Blue](mailto:maya.blue@todo.ch)
29+
|""".stripMargin
30+
)
31+
private lazy val instructions =
32+
createIfNotExists(docs / "instructions.md",
33+
s"""|## Create This Page
34+
|This is a semi-automatic process. This should be done either to prepare a Release or after a Release.
35+
|
36+
|Do the following steps:
37+
|
38+
|- TODO describe your process here
39+
|""".stripMargin
40+
)
41+
42+
private lazy val pattern =
43+
createIfNotExists(docs / "pattern.md",
44+
s"""|# Process Pattern
45+
|We try to establish Patterns for doing the same tasks.
46+
|This documentation lists them and gives you some examples.
47+
|
48+
|TODO: Describe the Patterns here that you want to establish.
49+
|""".stripMargin
50+
)
51+
private lazy val statistics =
52+
createIfNotExists(docs / "statistics.md",
53+
s"""|# Process Statistics
54+
|
55+
|The Process Statistics you find new in Camunda Optimize.
56+
|
57+
|TODO - Create here a link to the Optimize Dashboard or add some statistics manually.
58+
|
59+
|<iframe id="optimizeFrame" src="https://TODO/" frameborder="0" style="width: 1000px; height: 700px; allowtransparency; overflow: scroll"></iframe>
60+
|""".stripMargin)
61+
private lazy val style =
62+
createIfNotExists(docs / "style.md",
63+
s"""|.mermaid svg {
64+
| height: 400px;
65+
|}
66+
|.colorLegend {
67+
| margin-left: auto;
68+
| margin-right: 40px;
69+
| width: 400px;
70+
|}
71+
|""".stripMargin)
72+
73+
private lazy val favicon =
74+
val faviconPath = docs / "favicon.ico"
75+
if !os.exists(faviconPath) then
76+
os.write(faviconPath, (os.resource / "favicon.ico").toSource)
77+
78+
private def directory(name: String, title: String, isVersioned: Boolean) =
79+
os.makeDir.all(docs / name)
80+
createIfNotExists(docs / name / "directory.md",
81+
s"""|${laikaVersioned(isVersioned)}
82+
|
83+
|${laikaTitle(title)}
84+
|
85+
|$laikaNavigationOrder
86+
|""".stripMargin
87+
)
88+
89+
private def laikaVersioned(isVersioned: Boolean) = s"laika.versioned = $isVersioned"
90+
private def laikaTitle(title: String) = s"laika.title = $title"
91+
private lazy val laikaNavigationOrder = s"laika.navigationOrder = [\n]"

04-helper/src/main/scala/camundala/helper/dev/company/CompanyGenerator.scala

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,20 @@ package camundala.helper.dev.company
22

33
import camundala.helper.dev.update.*
44

5-
case class InitCompanyGenerator()(using config: DevConfig):
5+
case class CompanyGenerator()(using config: DevConfig):
66

77
lazy val generate: Unit =
88
generateDirectories
99
DirectoryGenerator().generate // generates myCompany-camundala project
10+
1011
// needed helper classes
1112
CompanyWrapperGenerator().generate
1213
// override helperCompany.scala
1314
createOrUpdate(os.pwd / "helperCompany.scala", CompanyScriptCreator().companyHelper)
1415
// sbt
1516
CompanySbtGenerator().generate
17+
// docs
18+
CompanyDocsGenerator(companyCamundala).generate
1619
end generate
1720

1821
lazy val createProject: Unit =
@@ -26,24 +29,23 @@ case class InitCompanyGenerator()(using config: DevConfig):
2629
private lazy val generateDirectories: Unit =
2730
os.makeDir.all(gitTemp)
2831
os.makeDir.all(docker)
29-
os.makeDir.all(docs)
3032
os.makeDir.all(companyCamundala)
3133
os.makeDir.all(projects)
34+
3235
end generateDirectories
36+
3337
private lazy val generateProjectDirectories: Unit =
3438
os.makeDir.all(projects / projectName)
3539

3640
private lazy val gitTemp = os.pwd / "git-temp"
3741
private lazy val docker = os.pwd / "docker"
38-
private lazy val docs = os.pwd / s"$companyName-docs"
3942
private lazy val companyCamundala = os.pwd / s"$companyName-camundala"
4043
private lazy val projects = os.pwd / "projects"
44+
end CompanyGenerator
4145

42-
end InitCompanyGenerator
43-
44-
object InitCompanyGenerator:
46+
object CompanyGenerator:
4547
def init(companyName: String) = //, repoConfig: RepoConfig.Artifactory) =
4648
DevConfig.defaultConfig(s"$companyName-camundala")
4749
end init
4850

49-
end InitCompanyGenerator
51+
end CompanyGenerator

04-helper/src/main/scala/camundala/helper/dev/company/docs/DocCreator.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ trait DocCreator extends DependencyCreator, Helpers:
113113
val table =
114114
s"""
115115
|{%
116+
|// auto generated - do not change!
116117
|laika.versioned = true
117118
|%}
118119
|

05-examples/myCompany/src/main/scala/camundala/myCompany/MyCompanyDocCreator.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package camundala.myCompany
22

33
import camundala.api.*
44
import camundala.helper.dev.company.docs.DocCreator
5+
import camundala.helper.util.PublishConfig
56

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

1617
prepareDocs()
18+
19+
override protected def publishConfig: Option[PublishConfig] = None
1720
end MyCompanyDocCreator

0 commit comments

Comments
 (0)