Skip to content

Commit 8b45796

Browse files
changed method from createProject to createDevon4jProject
1 parent 997bd28 commit 8b45796

File tree

2 files changed

+15
-25
lines changed

2 files changed

+15
-25
lines changed

documentation/Functions.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,11 @@ cobiGenJava("path/to/java/file/MyEntity.java",[1,3,5,6,8])
3333

3434
***
3535

36-
### createProject
36+
### createDevon4jProject
3737
#### parameter
38-
1. the template used for project generation
39-
2. the project name
38+
1. the project name
4039

4140
#### example
42-
createProject("devon4j","cobigenexample")
41+
createDevon4jProject("cobigenexample")
4342

4443
***

runners/console/index.ts

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -60,22 +60,16 @@ export class Console extends Runner {
6060
return result;
6161
}
6262

63-
runCreateProject(step: Step, command: Command): RunResult {
63+
runCreateDevon4jProject(step: Step, command: Command): RunResult {
6464
let result = new RunResult();
6565
result.returnCode = 0;
6666

6767
let workspaceDir = path.join(this.getWorkingDirectory(), "devonfw", "workspaces", "main")
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-
}
68+
let projectName = command.parameters[0];
69+
if(this.platform == ConsolePlatform.WINDOWS) {
70+
this.executeCommandSync("devon java create com.example.application." + projectName, workspaceDir, result);
7671
} else {
77-
// TODO: implement generation of devon4ng, devon4node and devon4net projects
78-
result.exceptions.push(new Error("template not supported: " + template));
72+
this.executeCommandSync("~/.devon/devon java create com.example.application." + projectName, workspaceDir, result);
7973
}
8074

8175
return result;
@@ -113,20 +107,17 @@ export class Console extends Runner {
113107
console.log("assertCobiGenJava");
114108
}
115109

116-
async assertCreateProject(step: Step, command: Command, result: RunResult) {
110+
async assertCreateDevon4jProject(step: Step, command: Command, result: RunResult) {
117111
let workspaceDir = path.join(this.getWorkingDirectory(), "devonfw", "workspaces", "main");
118112

119-
let assert = new Assertions()
113+
new Assertions()
120114
.noErrorCode(result)
121115
.noException(result)
122-
.directoryExits(path.join(workspaceDir, command.parameters[1]));
123-
124-
if(command.parameters[0] == "devon4j") {
125-
assert.directoryExits(path.join(workspaceDir, command.parameters[1], "api", "src", "main", "java"))
126-
.directoryExits(path.join(workspaceDir, command.parameters[1], "core", "src", "main", "java"))
127-
.directoryExits(path.join(workspaceDir, command.parameters[1], "server", "src", "main", "java"))
128-
.fileExits(path.join(workspaceDir, command.parameters[1], "core", "src", "main", "java", "com", "example", "application", command.parameters[1], "SpringBootApp.java"));
129-
}
116+
.directoryExits(path.join(workspaceDir, command.parameters[0]))
117+
.directoryExits(path.join(workspaceDir, command.parameters[0], "api", "src", "main", "java"))
118+
.directoryExits(path.join(workspaceDir, command.parameters[0], "core", "src", "main", "java"))
119+
.directoryExits(path.join(workspaceDir, command.parameters[0], "server", "src", "main", "java"))
120+
.fileExits(path.join(workspaceDir, command.parameters[0], "core", "src", "main", "java", "com", "example", "application", command.parameters[0], "SpringBootApp.java"));
130121
}
131122

132123
private executeCommandSync(command: string, directory: string, result: RunResult, input?: string) {

0 commit comments

Comments
 (0)