Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 41 additions & 2 deletions documentation/Functions.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,42 @@
You can use the following function:
## Functions
The following functions are already implemented:
* installDevonIde
* installCobiGen
* installCobiGen
* createProject
* cobiGenJava

***

### installDevonIde
#### parameter
1. The tools you want to install within the devonfw ide: string array
#### example
installDevonfwIde(["java","mvn"])

***

### installCobiGen
#### parameter
* No parameters
#### example
installCobiGen()

***

### cobiGenJava
#### parameter
1. The path to the java file you want to generate code for: string
2. The numbers that represent the templates that CobiGen uses to generate code: int array
#### example
cobiGenJava("path/to/java/file/MyEntity.java",[1,3,5,6,8])


***

### createDevon4jProject
#### parameter
1. The project name
#### example
createDevon4jProject("cobigenexample")

***
30 changes: 29 additions & 1 deletion runners/console/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,21 @@ export class Console extends Runner {
return result;
}

runCreateDevon4jProject(step: Step, command: Command): RunResult {
let result = new RunResult();
result.returnCode = 0;

let workspaceDir = path.join(this.getWorkingDirectory(), "devonfw", "workspaces", "main")
let projectName = command.parameters[0];
if(this.platform == ConsolePlatform.WINDOWS) {
this.executeCommandSync("devon java create com.example.application." + projectName, workspaceDir, result);
} else {
this.executeCommandSync("~/.devon/devon java create com.example.application." + projectName, workspaceDir, result);
}

return result;
}

runCobiGenJava(step: Step, command: Command): RunResult {
return null;
}
Expand Down Expand Up @@ -89,7 +104,20 @@ export class Console extends Runner {
}

async assertCobiGenJava(step: Step, command: Command, result: RunResult) {
console.log("assertCobiGenJava");
console.log("there is no assertion yet for the cobiGenJava command");
}

async assertCreateDevon4jProject(step: Step, command: Command, result: RunResult) {
let workspaceDir = path.join(this.getWorkingDirectory(), "devonfw", "workspaces", "main");

new Assertions()
.noErrorCode(result)
.noException(result)
.directoryExits(path.join(workspaceDir, command.parameters[0]))
.directoryExits(path.join(workspaceDir, command.parameters[0], "api", "src", "main", "java"))
.directoryExits(path.join(workspaceDir, command.parameters[0], "core", "src", "main", "java"))
.directoryExits(path.join(workspaceDir, command.parameters[0], "server", "src", "main", "java"))
.fileExits(path.join(workspaceDir, command.parameters[0], "core", "src", "main", "java", "com", "example", "application", command.parameters[0], "SpringBootApp.java"));
}

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