Skip to content

Commit 997bd28

Browse files
changed createProject command in console runner
1 parent 2cb0213 commit 997bd28

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

documentation/Functions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ cobiGenJava("path/to/java/file/MyEntity.java",[1,3,5,6,8])
3535

3636
### createProject
3737
#### parameter
38-
1. the programming language that you will use for this project
38+
1. the template used for project generation
3939
2. the project name
4040

4141
#### example
42-
createProject("java","cobigenexample")
42+
createProject("devon4j","cobigenexample")
4343

4444
***

runners/console/index.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,17 @@ export class Console extends Runner {
6565
result.returnCode = 0;
6666

6767
let workspaceDir = path.join(this.getWorkingDirectory(), "devonfw", "workspaces", "main")
68-
if(this.platform == ConsolePlatform.WINDOWS) {
69-
this.executeCommandSync("devon " + command.parameters[0] + " create com.example.application." + command.parameters[1], workspaceDir, result);
68+
let template = command.parameters[0];
69+
let projectName = command.parameters[1];
70+
if(template == "devon4j") {
71+
if(this.platform == ConsolePlatform.WINDOWS) {
72+
this.executeCommandSync("devon java create com.example.application." + projectName, workspaceDir, result);
73+
} else {
74+
this.executeCommandSync("~/.devon/devon java create com.example.application." + projectName, workspaceDir, result);
75+
}
7076
} else {
71-
this.executeCommandSync("~/.devon/devon " + command.parameters[0] + " create com.example.application." + command.parameters[1], workspaceDir, result);
77+
// TODO: implement generation of devon4ng, devon4node and devon4net projects
78+
result.exceptions.push(new Error("template not supported: " + template));
7279
}
7380

7481
return result;
@@ -114,7 +121,7 @@ export class Console extends Runner {
114121
.noException(result)
115122
.directoryExits(path.join(workspaceDir, command.parameters[1]));
116123

117-
if(command.parameters[0] == "java") {
124+
if(command.parameters[0] == "devon4j") {
118125
assert.directoryExits(path.join(workspaceDir, command.parameters[1], "api", "src", "main", "java"))
119126
.directoryExits(path.join(workspaceDir, command.parameters[1], "core", "src", "main", "java"))
120127
.directoryExits(path.join(workspaceDir, command.parameters[1], "server", "src", "main", "java"))

0 commit comments

Comments
 (0)