Skip to content

Commit 4d9b9f9

Browse files
committed
Migrated publish to camundala.
1 parent c710de3 commit 4d9b9f9

File tree

11 files changed

+533
-46
lines changed

11 files changed

+533
-46
lines changed

00-documentation/src/docs/development/projectDev.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,3 +196,33 @@ This creates the following files:
196196
// the domain NoInput -> NoOutput
197197
02-bpmn - main -> mycompany.myproject.bpmn.myProcess.v1.MyTimerEvent
198198
```
199+
200+
## publish
201+
202+
Creates a new Release for the BPMN project and publishes to the repository(e.g. Artifactory)
203+
204+
Usage:
205+
```
206+
./helper.scala publish <VERSION>
207+
```
208+
209+
Example:
210+
```
211+
./helper.scala publish 0.2.5
212+
```
213+
214+
The following steps are executed:
215+
- Check if there are no SNAPSHOTs as dependencies.
216+
- Release your dependencies first.
217+
- Check if the `CHANGELOG.md` is updated.
218+
- Check and adjust manually `CHANGELOG.md`.
219+
- Remove `//---DRAFT start` / `//---DRAFT end`.
220+
- Run the command again.
221+
- Push the `develop` branch.
222+
- Adjust the version in `ProjectDef.scala` and `ApiProjectCreator.scala`.
223+
- Run `ApiProjectCreator.scala`.
224+
- Publish the project to the repository.
225+
- Uploads the documentation to a webserver.
226+
- Merge the branch (`develop`) into `master`.
227+
- Tag the GIT repository with the version.
228+
- Increase the version to the next minor _SNAPSHOT_ version.
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>ReDoc</title>
5+
<!-- needed for adaptive design -->
6+
<meta charset="utf-8"/>
7+
<meta name="viewport" content="width=device-width, initial-scale=1">
8+
<link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700" rel="stylesheet">
9+
10+
<!-- bpmn styles -->
11+
<link rel="stylesheet" href="https://unpkg.com/bpmn-js@11.5.0/dist/assets/bpmn-js.css">
12+
<!-- dmn styles -->
13+
<link rel="stylesheet" href="https://unpkg.com/dmn-js@14.1.0/dist/assets/dmn-js-shared.css">
14+
<link rel="stylesheet" href="https://unpkg.com/dmn-js@14.1.0/dist/assets/dmn-js-drd.css">
15+
<link rel="stylesheet" href="https://unpkg.com/dmn-js@14.1.0/dist/assets/dmn-js-decision-table.css">
16+
<link rel="stylesheet" href="https://unpkg.com/dmn-js@14.1.0/dist/assets/dmn-js-literal-expression.css">
17+
<link rel="stylesheet" href="https://unpkg.com/dmn-js@14.1.0/dist/assets/dmn-font/css/dmn.css">
18+
19+
<!--
20+
ReDoc doesn't change outer page styles
21+
-->
22+
<style>
23+
body {
24+
margin: 0;
25+
padding: 0;
26+
}
27+
.diagramCanvas {
28+
border: solid 1px grey;
29+
height:500px;
30+
}
31+
.diagram {
32+
padding: 5px;
33+
height: 100%;
34+
}
35+
</style>
36+
<script>
37+
function downloadSVG(id) {
38+
const container = document.getElementById(id);
39+
const svg = container.getElementsByTagName('svg')[1];
40+
console.log(svg)
41+
svg.setAttribute('xmlns', 'http://www.w3.org/2000/svg')
42+
const blob = new Blob([svg.outerHTML.toString()]);
43+
const element = document.createElement("a");
44+
element.download = id +".svg";
45+
element.href = window.URL.createObjectURL(blob);
46+
element.click();
47+
element.remove();
48+
}
49+
</script>
50+
</head>
51+
<body>
52+
<!-- bpmn viewer -->
53+
<script src="https://unpkg.com/bpmn-js@11.5.0/dist/bpmn-viewer.development.js"></script>
54+
<!-- dmn viewer -->
55+
<script src="https://unpkg.com/dmn-js@14.1.0/dist/dmn-viewer.development.js"></script>
56+
<!-- jquery (required for bpmn / dmn example) -->
57+
<script src="https://unpkg.com/jquery@3.3.1/dist/jquery.js"></script>
58+
<script>
59+
function openFromUrl(url, viewer) {
60+
console.log('attempting to open <' + url + '>');
61+
$.ajax("diagrams/" + url, {dataType: 'text'}).done(async function (xml) {
62+
63+
try {
64+
await viewer.importXML(xml);
65+
if(url.endsWith(".bpmn"))
66+
viewer.get('canvas').zoom('fit-viewport');
67+
else {
68+
const activeEditor = viewer.getActiveViewer();
69+
activeEditor.get('canvas').zoom('fit-viewport');
70+
}
71+
} catch (err) {
72+
console.error(err);
73+
}
74+
});
75+
}
76+
</script>
77+
<redoc spec-url='./openApi.yml'></redoc>
78+
<script src="https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js"> </script>
79+
80+
</body>
81+
</html>

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

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

3-
import camundala.helper.util.DevConfig
3+
import camundala.api.ApiConfig
4+
import camundala.helper.dev.publish.PublishHelper
5+
import camundala.helper.util.{DevConfig, PublishConfig}
46
import camundala.helper.dev.update.*
57

68
import scala.util.{Failure, Success, Try}
79

8-
object DevHelper:
10+
trait DevHelper:
11+
def apiConfig: ApiConfig
12+
def devConfig: DevConfig
13+
def publishConfig: Option[PublishConfig]
14+
given DevConfig = devConfig
15+
given ApiConfig = apiConfig
16+
given Option[PublishConfig] = publishConfig
917

10-
def run(command: String, arguments: String*)(using DevConfig): Unit =
18+
def run(command: String, arguments: String*): Unit =
1119
val args = arguments.toSeq
1220
println(s"Running command: $command with args: $args")
1321
Try(Command.valueOf(command)) match
@@ -19,7 +27,7 @@ object DevHelper:
1927
end match
2028
end run
2129

22-
private def runCommand(command: Command, args: Seq[String])(using DevConfig): Unit =
30+
private def runCommand(command: Command, args: Seq[String]): Unit =
2331
command match
2432
case Command.update =>
2533
update
@@ -89,15 +97,15 @@ object DevHelper:
8997
createTimerEvent(processName, bpmnName, version.toIntOption)
9098
case other =>
9199
printBadActivity(command, other)
92-
/*
93100
case Command.publish =>
94101
args match
95102
case Seq(version) =>
96103
PublishHelper().publish(version)
97104
case other =>
98105
println(s"Invalid arguments for command $command: $other")
99106
println(s"Usage: $command <version>")
100-
println(s"Example: $command 1.23.3")
107+
println(s"Example: $command 1.23.3")/*
108+
101109
case Command.deploy =>
102110
args match
103111
case Seq(simulation) =>
@@ -127,14 +135,12 @@ object DevHelper:
127135
case update, process, customTask, serviceTask, userTask, decision, signalEvent, messageEvent,
128136
timerEvent, publish, deploy, dockerUp, dockerStop, dockerDown
129137

130-
def update(using config: DevConfig): Unit =
131-
println(s"Update Project: ${config.projectName}")
132-
println(s" - with Subprojects: ${config.subProjects}")
138+
def update: Unit =
139+
println(s"Update Project: ${devConfig.projectName}")
140+
println(s" - with Subprojects: ${devConfig.subProjects}")
133141
SetupGenerator().generate
134142

135-
def createProcess(processName: String, version: Option[Int])(using
136-
config: DevConfig
137-
): Unit =
143+
def createProcess(processName: String, version: Option[Int]): Unit =
138144
SetupGenerator().createProcess(SetupElement(
139145
"Process",
140146
processName.asProcessName,
@@ -143,53 +149,41 @@ object DevHelper:
143149
))
144150
end createProcess
145151

146-
def createCustomTask(processName: String, bpmnName: String, version: Option[Int])(
147-
using config: DevConfig
148-
): Unit =
152+
def createCustomTask(processName: String, bpmnName: String, version: Option[Int]): Unit =
149153
SetupGenerator().createProcessElement(SetupElement(
150154
"CustomTask",
151155
processName.asProcessName,
152156
bpmnName.asElemName,
153157
version
154158
))
155159

156-
def createServiceTask(processName: String, bpmnName: String, version: Option[Int])(
157-
using config: DevConfig
158-
): Unit =
160+
def createServiceTask(processName: String, bpmnName: String, version: Option[Int]): Unit =
159161
SetupGenerator().createProcessElement(SetupElement(
160162
"ServiceTask",
161163
processName.asProcessName,
162164
bpmnName.asElemName,
163165
version
164166
))
165167

166-
def createUserTask(processName: String, bpmnName: String, version: Option[Int])(
167-
using config: DevConfig
168-
): Unit =
168+
def createUserTask(processName: String, bpmnName: String, version: Option[Int]): Unit =
169169
SetupGenerator().createUserTask(
170170
SetupElement("UserTask", processName.asProcessName, bpmnName.asElemName, version)
171171
)
172172

173-
def createDecision(processName: String, bpmnName: String, version: Option[Int])(
174-
using config: DevConfig
175-
): Unit =
173+
def createDecision(processName: String, bpmnName: String, version: Option[Int]): Unit =
176174
SetupGenerator().createDecision(
177175
SetupElement("Decision", processName.asProcessName, bpmnName.asElemName, version)
178176
)
179177

180-
def createSignalEvent(processName: String, bpmnName: String, version: Option[Int])(
181-
using config: DevConfig
182-
): Unit =
178+
def createSignalEvent(processName: String, bpmnName: String, version: Option[Int]): Unit =
183179
SetupGenerator().createEvent(SetupElement(
184180
"Signal",
185181
processName.asProcessName,
186182
bpmnName.asElemName,
187183
version
188184
))
189185

190-
def createMessageEvent(processName: String, bpmnName: String, version: Option[Int])(
191-
using config: DevConfig
192-
): Unit =
186+
def createMessageEvent(processName: String, bpmnName: String, version: Option[Int]): Unit =
193187
SetupGenerator().createEvent(SetupElement(
194188
"Message",
195189
processName.asProcessName,

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

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,12 @@ case class CompanyWrapperGenerator()(using config: DevConfig):
5454
|trait CompanyApiCreator extends ApiCreator, ApiDsl, CamundaPostmanApiCreator:
5555
|
5656
| // override the config if needed
57-
| protected def apiConfig: ApiConfig = ApiConfig(companyId = "$companyName")
57+
| protected def apiConfig: ApiConfig = CompanyApiCreator.apiConfig
5858
|
5959
| lazy val companyDescr = ??? //TODO Add your Company Description!
60+
|
61+
|object CompanyApiCreator:
62+
| lazy val apiConfig = ApiConfig(companyId = "$companyName")
6063
|""".stripMargin
6164

6265
private lazy val dmnWrapper =
@@ -130,14 +133,20 @@ case class CompanyWrapperGenerator()(using config: DevConfig):
130133
private lazy val helperWrapper =
131134
s"""package $companyName.camundala.helper
132135
|
136+
|import camundala.api.ApiConfig
133137
|import camundala.helper.dev.*
134138
|import camundala.helper.util.*
139+
|import mycompany.camundala.api.CompanyApiCreator
140+
|
141+
|case class CompanyDevHelper(projectName: String, subProjects: Seq[String] = Seq.empty) extends DevHelper:
142+
|
143+
| lazy val apiConfig: ApiConfig = CompanyApiCreator.apiConfig
135144
|
136-
|object CompanyDevHelper:
145+
| lazy val devConfig: DevConfig =
146+
| DevConfig.defaultConfig(projectName) //TODO Implement your Config!
147+
| .copy(subProjects = subProjects)
137148
|
138-
| def config(projectName: String, subProjects: Seq[String] = Seq.empty): DevConfig =
139-
| DevConfig.defaultConfig(projectName) //TODO Implement your Config!
140-
| .copy(subProjects = subProjects)
149+
| lazy val publishConfig: Option[PublishConfig] = None //TODO If you have a webdav server to publish the docs, add the config here
141150
|""".stripMargin
142151
end helperWrapper
143152

0 commit comments

Comments
 (0)