1
1
package camundala .helper .dev
2
2
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 }
4
6
import camundala .helper .dev .update .*
5
7
6
8
import scala .util .{Failure , Success , Try }
7
9
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
9
17
10
- def run (command : String , arguments : String * )( using DevConfig ) : Unit =
18
+ def run (command : String , arguments : String * ): Unit =
11
19
val args = arguments.toSeq
12
20
println(s " Running command: $command with args: $args" )
13
21
Try (Command .valueOf(command)) match
@@ -19,7 +27,7 @@ object DevHelper:
19
27
end match
20
28
end run
21
29
22
- private def runCommand (command : Command , args : Seq [String ])( using DevConfig ) : Unit =
30
+ private def runCommand (command : Command , args : Seq [String ]): Unit =
23
31
command match
24
32
case Command .update =>
25
33
update
@@ -89,15 +97,15 @@ object DevHelper:
89
97
createTimerEvent(processName, bpmnName, version.toIntOption)
90
98
case other =>
91
99
printBadActivity(command, other)
92
- /*
93
100
case Command .publish =>
94
101
args match
95
102
case Seq (version) =>
96
103
PublishHelper ().publish(version)
97
104
case other =>
98
105
println(s " Invalid arguments for command $command: $other" )
99
106
println(s " Usage: $command <version> " )
100
- println(s"Example: $command 1.23.3")
107
+ println(s " Example: $command 1.23.3 " )/*
108
+
101
109
case Command.deploy =>
102
110
args match
103
111
case Seq(simulation) =>
@@ -127,14 +135,12 @@ object DevHelper:
127
135
case update, process, customTask, serviceTask, userTask, decision, signalEvent, messageEvent,
128
136
timerEvent, publish, deploy, dockerUp, dockerStop, dockerDown
129
137
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}" )
133
141
SetupGenerator ().generate
134
142
135
- def createProcess (processName : String , version : Option [Int ])(using
136
- config : DevConfig
137
- ): Unit =
143
+ def createProcess (processName : String , version : Option [Int ]): Unit =
138
144
SetupGenerator ().createProcess(SetupElement (
139
145
" Process" ,
140
146
processName.asProcessName,
@@ -143,53 +149,41 @@ object DevHelper:
143
149
))
144
150
end createProcess
145
151
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 =
149
153
SetupGenerator ().createProcessElement(SetupElement (
150
154
" CustomTask" ,
151
155
processName.asProcessName,
152
156
bpmnName.asElemName,
153
157
version
154
158
))
155
159
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 =
159
161
SetupGenerator ().createProcessElement(SetupElement (
160
162
" ServiceTask" ,
161
163
processName.asProcessName,
162
164
bpmnName.asElemName,
163
165
version
164
166
))
165
167
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 =
169
169
SetupGenerator ().createUserTask(
170
170
SetupElement (" UserTask" , processName.asProcessName, bpmnName.asElemName, version)
171
171
)
172
172
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 =
176
174
SetupGenerator ().createDecision(
177
175
SetupElement (" Decision" , processName.asProcessName, bpmnName.asElemName, version)
178
176
)
179
177
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 =
183
179
SetupGenerator ().createEvent(SetupElement (
184
180
" Signal" ,
185
181
processName.asProcessName,
186
182
bpmnName.asElemName,
187
183
version
188
184
))
189
185
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 =
193
187
SetupGenerator ().createEvent(SetupElement (
194
188
" Message" ,
195
189
processName.asProcessName,
0 commit comments