Skip to content

Commit c918597

Browse files
command cobiGenJava for katacoda runner
1 parent eba3fa3 commit c918597

File tree

5 files changed

+45
-0
lines changed

5 files changed

+45
-0
lines changed

playbooks/cobigen-cli/index.asciidoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,9 @@ Now, you have to download cobigen
1818
--
1919
installCobiGen()
2020
--
21+
22+
The CobiGen plugin for VS Code is already installed. You can use it right away.
23+
[step]
24+
--
25+
cobiGenJava(devonfw/workspaces/main/Test.java,[1 2 3 4])
26+
--

runners/katacoda/index.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,25 @@ export class Katacoda extends Runner {
9494
return null;
9595
}
9696

97+
runCobiGenJava(step: Step, command: Command): RunResult {
98+
let params = command.parameters.split(",");
99+
let cobiGenTemplates = params[1].replace(/\[/, "").replace("\]", "").replace(/ /g, ",");
100+
101+
this.renderTemplate(path.join("scripts", "installCobiGenPlugin.sh"), path.join(this.setupDir, "installCobiGenPlugin.sh"), { vsixFile: "cobigen-0.0.1.vsix", pluginName: "cobigen" });
102+
this.setupScripts.push({
103+
"name": "Install CobiGen plugin",
104+
"script": "installCobiGenPlugin.sh"
105+
});
106+
this.assetManager.registerFile(path.join(this.getRunnerDirectory(), "templates", "files", "cobigen-0.0.1.vsix"), "setup/cobigen-0.0.1.vsix", "/root/setup", true)
107+
108+
this.steps.push({
109+
"title": "CobiGen Java",
110+
"text": "step" + this.stepsCount + ".md"
111+
});
112+
this.renderTemplate("cobiGenJava.md", this.outputPathTutorial + "step" + (this.stepsCount++) + ".md", { text: step.text, textAfter: step.textAfter, javaFile: params[0], cobiGenTemplates: cobiGenTemplates });
113+
return null;
114+
}
115+
97116
private renderTemplate(name: string, targetPath: string, variables) {
98117
let template = fs.readFileSync(path.join(this.getRunnerDirectory(),"templates", name), 'utf8');
99118
let result = ejs.render(template, variables);
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<%= text; %>
2+
3+
## CobiGen Java
4+
5+
Open the following java file in the IDE.
6+
`<%= javaFile; %>`{{open}}
7+
8+
You can use the plugin simply via the context menu. Make a right click on the java file (in the explorer on the left or in the editor itself). The context menu will open and you can start the CobiGen Plugin by clicking on 'CobiGen'.
9+
10+
A terminal will open on the bottom of the IDE and CobiGen CLI will start.
11+
12+
You can choose the templates CobiGen should use by entering the numbers.
13+
14+
`<%= cobiGenTemplates; %>`{{execute}}
2.85 KB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
3+
apt install libarchive-tools -y
4+
cd /root/setup/
5+
bsdtar -xvf <%= vsixFile; %> - extension
6+
mv extension /opt/.katacodacode/extensions/<%= pluginName; %>

0 commit comments

Comments
 (0)