Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
2215026
added supports for eclipse and vscode wiki runner
EduardKrieger May 9, 2021
7f7c411
removed unnecessary comments
EduardKrieger May 9, 2021
26b08c7
asciidoc template changes
EduardKrieger May 9, 2021
f874717
fixed spelling
EduardKrieger May 12, 2021
496b1a6
fixed spelling
EduardKrieger May 12, 2021
ef4a8d1
changed Prerequisites
EduardKrieger May 12, 2021
894ab51
const var changed to uppercase
EduardKrieger May 14, 2021
1b6ac6b
Merge branch 'main' into feature/wikiRunnerInstallCobiGen
EduardKrieger May 14, 2021
41cb91f
const var changed to uppercase
EduardKrieger May 14, 2021
40d5e64
chenaged asciidoc
EduardKrieger May 19, 2021
f564407
Merge branch 'main' into feature/wikiRunnerInstallCobiGen
EduardKrieger May 19, 2021
b3c9bcc
changed Path usage
EduardKrieger May 21, 2021
b711078
Merge branch 'main' into feature/wikiRunnerInstallCobiGen
EduardKrieger May 21, 2021
30ea773
Merge branch 'main' into feature/wikiRunnerInstallCobiGen
EduardKrieger May 26, 2021
0582c6e
rebase
EduardKrieger May 26, 2021
11eb4f0
removed unnecessary comments
EduardKrieger May 9, 2021
b0bb16e
asciidoc template changes
EduardKrieger May 9, 2021
a37cf27
fixed spelling
EduardKrieger May 12, 2021
ee09150
fixed spelling
EduardKrieger May 12, 2021
17298e9
changed Prerequisites
EduardKrieger May 12, 2021
2698d40
rebase
EduardKrieger May 26, 2021
d776ffa
const var changed to uppercase
EduardKrieger May 14, 2021
e7d6166
chenaged asciidoc
EduardKrieger May 19, 2021
5e3a0e4
changed Path usage
EduardKrieger May 21, 2021
e8085df
merged main
EduardKrieger May 26, 2021
833a572
cleanup
EduardKrieger May 26, 2021
46a13d5
fixed spelling
EduardKrieger May 26, 2021
2a1c771
removed useless import
EduardKrieger May 28, 2021
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
6 changes: 3 additions & 3 deletions engine/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ export abstract class Runner {
public playbookPath: string;
public playbookTitle: string;
public environmentName: string;
protected readonly useDevonCommand: string = "useDevonCommand";
protected readonly workspaceDirectory: string = "workspaceDirectory";
protected readonly USE_DEVON_COMMAND: string = "useDevonCommand";
protected readonly WORKSPACE_DIRECTORY: string = "workspaceDirectory";

private setVariableCallback: (name: string, value: any) => any;
registerSetVariableCallback(callback: (name: string, value: any) => any) {
Expand Down Expand Up @@ -83,7 +83,7 @@ export abstract class Runner {
}

init(playbook: Playbook): void {
this.setVariable(this.useDevonCommand, false);
this.setVariable(this.USE_DEVON_COMMAND, false);
}

run(runCommand: RunCommand): RunResult {
Expand Down
4 changes: 3 additions & 1 deletion engine/wikiRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ import * as ejs from "ejs";
export abstract class WikiRunner extends Runner {

public outputPathTutorial: string;
protected readonly INSTALLED_TOOLS: string = "installedTools";

init(playbook: Playbook): void {
let outputDirectory = this.createFolder(path.join(this.getOutputDirectory(), "wiki", this.environmentName), false)
this.outputPathTutorial = this.createFolder(path.join(outputDirectory, playbook.name), true);
this.setVariable(this.workspaceDirectory, path.join(this.getWorkingDirectory()));
this.setVariable(this.WORKSPACE_DIRECTORY, path.join(this.getWorkingDirectory()));
this.setVariable(this.INSTALLED_TOOLS, "");
}

async destroy(playbook: Playbook): Promise<void> {
Expand Down
99 changes: 49 additions & 50 deletions runners/console/index.ts

Large diffs are not rendered by default.

65 changes: 33 additions & 32 deletions runners/katacoda/index.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion runners/vscode/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class VsCode extends Runner {
let result = new RunResult();
result.returnCode = 0;

let filepath = path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0]);
let filepath = path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0]);
let directoryPath = path.dirname(filepath).replace(/\\/g, "\\\\").replace(/\//g, "//");
let directoryName = filepath.split(path.sep)[filepath.split(path.sep).length - 2];
let testfile = path.join(this.getWorkingDirectory(), "vscode_tests", "runCobiGenJava.js");
Expand Down
25 changes: 16 additions & 9 deletions runners/wikiConsole/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ export class WikiConsole extends WikiRunner {

init(playbook: Playbook): void {
super.init(playbook);
this.setVariable(this.WORKSPACE_DIRECTORY, path.join(this.getWorkingDirectory()));
this.renderWiki(path.join(this.getRunnerDirectory(), "templates", "intro.asciidoc"), {name: playbook.name, title: playbook.title, subtitle: playbook.subtitle, description: playbook.description});
this.setVariable(this.workspaceDirectory, path.join(this.getWorkingDirectory()));
}

async destroy(playbook: Playbook): Promise<void> {
Expand All @@ -26,7 +26,8 @@ export class WikiConsole extends WikiRunner {
version = runCommand.command.parameters[1];
}
this.renderWiki(path.join(this.getRunnerDirectory(), "templates", "installDevonfwIde.asciidoc"), { tools: tools, version:version })
this.setVariable(this.workspaceDirectory, path.join(this.getWorkingDirectory(), "devonfw", "workspaces", "main"));
this.setVariable(this.WORKSPACE_DIRECTORY, path.join(this.getWorkingDirectory(), "devonfw", "workspaces", "main"));
this.setVariable(this.INSTALLED_TOOLS, tools);
return null;
}

Expand All @@ -35,7 +36,7 @@ export class WikiConsole extends WikiRunner {
}

runChangeFile(runCommand: RunCommand): RunResult{
let workspacePath = this.getVariable(this.workspaceDirectory).replace(/\\/g, "/");
let workspacePath = this.getVariable(this.WORKSPACE_DIRECTORY).replace(/\\/g, "/");
let filePath = path.join(workspacePath,runCommand.command.parameters[0]);
let fileName = path.basename(runCommand.command.parameters[0]);
let contentPath, contentString;
Expand All @@ -62,13 +63,13 @@ export class WikiConsole extends WikiRunner {


runRunServerJava(runCommand: RunCommand): RunResult {
let server_path = path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0]);
let server_path = path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0]);
this.renderWiki(path.join(this.getRunnerDirectory(), "templates", "runServerJava.asciidoc"), { server_path: server_path, port: runCommand.command.parameters[1].port, app_path: runCommand.command.parameters[1].path })
return null;
}

runNpmInstall(runCommand: RunCommand): RunResult {
let projectPath = path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0]);
let projectPath = path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0]);
let npmCommand = {
"name": (runCommand.command.parameters.length > 1 && runCommand.command.parameters[1].name) ? runCommand.command.parameters[1].name : undefined,
"global": (runCommand.command.parameters.length > 1 && runCommand.command.parameters[1].global) ? runCommand.command.parameters[1].global : false,
Expand All @@ -80,7 +81,7 @@ export class WikiConsole extends WikiRunner {
}

runCloneRepository(runCommand: RunCommand): RunResult {
let directoryPath = path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0]);
let directoryPath = path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0]);
this.renderWiki(path.join(this.getRunnerDirectory(), "templates", "cloneRepository.asciidoc"), { directoryPath: directoryPath, url: runCommand.command.parameters[1] });
return null;
}
Expand All @@ -95,7 +96,7 @@ export class WikiConsole extends WikiRunner {
}

runBuildNg(runCommand: RunCommand): RunResult {
let angularPath = path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0]);
let angularPath = path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0]);
let outputPath = runCommand.command.parameters.length < 1 ? runCommand.command.parameters[1] : "";
this.renderWiki(path.join(this.getRunnerDirectory(), "template", "buildNg.asciidoc"), {angularPath: angularPath, outputPath: outputPath});

Expand All @@ -110,18 +111,24 @@ export class WikiConsole extends WikiRunner {
}

runCreateFolder(runCommand: RunCommand): RunResult {
let folderPath = path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0]);
let folderPath = path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0]);
this.renderWiki(path.join(this.getRunnerDirectory(), "templates", "createFolder.asciidoc"), { folderPath: folderPath });
return null;
}

runBuildJava(runCommand: RunCommand): RunResult {
let directoryPath = path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0]);
let directoryPath = path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0]);
let skipTest = (runCommand.command.parameters.length == 2 && runCommand.command.parameters[1] == true) ? false : true;
this.renderWiki(path.join(this.getRunnerDirectory(), "templates", "buildJava.asciidoc"), { directoryPath: directoryPath, skipTest: skipTest });
return null;
}

runInstallCobiGen(runCommand: RunCommand): RunResult{
let devonPath = path.relative(this.getWorkingDirectory(), this.getVariable(this.WORKSPACE_DIRECTORY)).replace(/\\/g, "/");;
this.renderWiki(path.join(this.getRunnerDirectory(), "templates", "installCobiGen.asciidoc"), {devonPath: devonPath});
return null;
}

runCreateDevon4jProject(runCommand: RunCommand): RunResult {
this.renderWiki(path.join(this.getRunnerDirectory(), "templates", "createDevon4jProject.asciidoc"), { name: runCommand.command.parameters[0] });
return null;
Expand Down
14 changes: 14 additions & 0 deletions runners/wikiConsole/templates/installCobiGen.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
== Install GobiGen
Installing devonfw code generator (i.e. CobiGen).

=== Prerequisites
* An installed devonfw distribution is needed. To execute the CobiGen CLI, you have to install the devonfw IDE first. Follow the https://devonfw.com/website/pages/docs/devonfw-ide-introduction.asciidoc.html[devonfw-ide] documentation to install the same.

=== Install CobiGen with a command prompt

First, you need to open a command prompt in your current workspace. For Windows, you can use PowerShell and on Linux and macOS, you can use the Terminal.
Navigate to the devonfw installation directory with this command `cd <%= devonPath;%>`.
Execute the command `devon cobigen` and CobiGen will be installed.
To update the environment, you have to execute `devon` and you have successfully installed CobiGen.

Some further information about the usage of CobiGen can be found https://devonfw.com/website/pages/docs/master-cobigen.asciidoc.html[here].
3 changes: 2 additions & 1 deletion runners/wikiConsole/templates/installDevonfwIde.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,5 @@ You can also just execute `.\setup` (Windows) or `bash setup` (Linux) and press

<% if(tools.indexOf("mvn") > 0){ %>
The installer will also ask you if you want to enter secrets for your maven repository. You can simply skip this by pressing 'Enter'.
<% } %>
<% } %>

15 changes: 14 additions & 1 deletion runners/wikiEclipse/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class WikiEclipse extends WikiRunner {
}

runChangeFile(runCommand: RunCommand): RunResult{
let workspacePath = this.getVariable(this.workspaceDirectory).replace(/\\/g, "/");
let workspacePath = this.getVariable(this.WORKSPACE_DIRECTORY).replace(/\\/g, "/");
let fileName = path.basename(runCommand.command.parameters[0]);
let filePath = path.join(workspacePath,runCommand.command.parameters[0].replace(fileName, ""));
let contentPath, contentFile, contentString;
Expand All @@ -40,6 +40,19 @@ export class WikiEclipse extends WikiRunner {
contentFile: contentFile, fileName: fileName});
return null;
}


runInstallCobiGen(runCommand: RunCommand): RunResult{
this.renderWiki(path.join(this.getRunnerDirectory(), "templates", "installCobiGen.asciidoc"), {});
return null;
}

supports(name: string, parameters: any[]): boolean {
return this.getVariable(this.INSTALLED_TOOLS).includes("eclipse")
? super.supports(name, parameters)
: false;
}


runCreateDevon4jProject(runCommand: RunCommand): RunResult {
this.renderWiki(path.join(this.getRunnerDirectory(), "templates", "createDevon4jProject.asciidoc"), { name: runCommand.command.parameters[0]});
Expand Down
12 changes: 12 additions & 0 deletions runners/wikiEclipse/templates/installCobigen.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
== Install GobiGen
Installing devonfw code generator (i.e. CobiGen).

=== Prerequisites
* An installed devonfw Eclipse installation is needed. CobiGen Eclipse plugin will be installed with your devonfw distribution. In order to execute it, you have to install the devonfw IDE first. Follow the https://devonfw.com/website/pages/docs/devonfw-ide-introduction.asciidoc.html[devonfw-ide] documentation to install the same.

=== Install CobiGen for Eclipse IDE

CobiGen is already installed for your Eclipse IDE if you have installed it with the devonfw setup.
You can open the *Help* menu and select *About Eclipse IDE*. To check if CobiGen is installed select *Installation Details* and CobiGen should be in the list of *Installed Software* and *Plug-ins*. You can use CobiGen by right-click on a file and selecting CobiGen in the opened menu. Now you can choose some CobiGen functions you want to execute for the selected file.

Some further information about the usage of CobiGen can be found https://devonfw.com/website/pages/docs/master-cobigen.asciidoc.html[here].
2 changes: 1 addition & 1 deletion runners/wikiEditor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class WikiEditor extends WikiRunner {
}

runChangeFile(runCommand: RunCommand): RunResult{
let workspacePath = this.getVariable(this.workspaceDirectory).replace(/\\/g, "/");
let workspacePath = this.getVariable(this.WORKSPACE_DIRECTORY).replace(/\\/g, "/");
let fileName = path.basename(runCommand.command.parameters[0]);
let filePath = path.join(workspacePath,runCommand.command.parameters[0].replace(fileName, ""));
let contentPath, contentFile, contentString;
Expand Down
16 changes: 15 additions & 1 deletion runners/wikiVsCode/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import * as path from "path";

export class WikiVsCode extends WikiRunner {


init(playbook: Playbook): void {
super.init(playbook);
}
Expand All @@ -15,7 +16,7 @@ export class WikiVsCode extends WikiRunner {
}

runChangeFile(runCommand: RunCommand): RunResult{
let workspacePath = this.getVariable(this.workspaceDirectory).replace(/\\/g, "/");
let workspacePath = this.getVariable(this.WORKSPACE_DIRECTORY).replace(/\\/g, "/");
let fileName = path.basename(runCommand.command.parameters[0]);
let filePath = path.join(workspacePath,runCommand.command.parameters[0].replace(fileName, ""));
let contentPath, contentFile, contentString;
Expand All @@ -40,4 +41,17 @@ export class WikiVsCode extends WikiRunner {
contentFile: contentFile, fileName: fileName});
return null;
}

runInstallCobiGen(runCommand: RunCommand): RunResult{
let dir = path.relative(this.getVariable(this.WORKSPACE_DIRECTORY), this.getWorkingDirectory()).replace(/\\/g, "/");;
this.renderWiki(path.join(this.getRunnerDirectory(), "templates", "installCobiGen.asciidoc"), {dir: dir});
return null;
}

supports(name: string, parameters: any[]): boolean {
return this.getVariable(this.INSTALLED_TOOLS).includes("vscode")
? super.supports(name, parameters)
: false;
}

}
20 changes: 20 additions & 0 deletions runners/wikiVsCode/templates/installCobiGen.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
== Install GobiGen
Installing devonfw code generator (i.e. CobiGen).

=== Prerequisites
* An installed VS Code Editor is needed. VS Code is installed inside your devonfw distribution. If VS Code or devonfw is missing, you have to install it first. Follow the https://devonfw.com/website/pages/docs/devonfw-ide-introduction.asciidoc.html[devonfw ] documentation to install the missing ones.

=== Install CobiGen for VS Code Editor
First, download the VS Code extension file. You can download it from https://github.com/devonfw-forge/cobigen-vscode-plugin/releases/download/0.0.1/cobigen-plugin-0.0.1.vsix[here] or execute the following command in PowerShell or Terminal.


.Operating system
. Windows +
`Invoke-WebRequest https://github.com/devonfw-forge/cobigen-vscode-plugin/releases/download/0.0.1/cobigen-plugin-0.0.1.vsix -O <%= dir;%>cobigen-plugin-0.0.1.vsix`
. Linux and macOS +
`wget https://github.com/devonfw-forge/cobigen-vscode-plugin/releases/download/0.0.1/cobigen-plugin-0.0.1.vsix -O cobigen-plugin-0.0.1.vsix -P $(pwd)/<%= dir;%>`

Install CobiGen by opening VS Code Editor and the *Extensions* menu with ctrl+shift+X and select *...* in the top right corner of the extensions window. Select *Install from VSIX* and select the previously downloaded cobigen-plugin-0.0.1.vsix file, it is located in the directory you startet executing this wiki.
Now CobiGen is installed, use CobiGen by right-clicking on a file and selecting CobiGen in the opened menu. CobiGen generate will be executed with the selected file.

Some further information about the usage of CobiGen can be found https://devonfw.com/website/pages/docs/master-cobigen.asciidoc.html[here].