From 221502662d28187e2338450ede74ae10e4652c8e Mon Sep 17 00:00:00 2001 From: EduardKrieger Date: Sun, 9 May 2021 16:00:48 +0200 Subject: [PATCH 01/23] added supports for eclipse and vscode wiki runner --- engine/wikiRunner.ts | 2 ++ runners/wikiConsole/index.ts | 9 +++++++++ .../wikiConsole/templates/installCobiGen.asciidoc | 14 ++++++++++++++ .../templates/installDevonfwIde.asciidoc | 3 ++- runners/wikiEclipse/index.ts | 12 ++++++++++++ .../wikiEclipse/templates/installCobigen.asciidoc | 12 ++++++++++++ runners/wikiVsCode/index.ts | 13 +++++++++++++ .../wikiVsCode/templates/installCobiGen.asciidoc | 13 +++++++++++++ 8 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 runners/wikiConsole/templates/installCobiGen.asciidoc create mode 100644 runners/wikiEclipse/templates/installCobigen.asciidoc create mode 100644 runners/wikiVsCode/templates/installCobiGen.asciidoc diff --git a/engine/wikiRunner.ts b/engine/wikiRunner.ts index cc132c1b..23b5ccbf 100644 --- a/engine/wikiRunner.ts +++ b/engine/wikiRunner.ts @@ -7,11 +7,13 @@ import * as ejs from "ejs"; export abstract class WikiRunner extends Runner { public outputPathTutorial: string; + protected readonly installedTools: 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.installedTools, ""); } async destroy(playbook: Playbook): Promise { diff --git a/runners/wikiConsole/index.ts b/runners/wikiConsole/index.ts index ef1ec3da..cb366385 100644 --- a/runners/wikiConsole/index.ts +++ b/runners/wikiConsole/index.ts @@ -26,6 +26,7 @@ export class WikiConsole extends WikiRunner { } 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.installedTools, tools); return null; } @@ -72,6 +73,7 @@ export class WikiConsole extends WikiRunner { }; this.renderWiki(path.join(this.getRunnerDirectory(), "templates", "npmInstall.asciidoc"), { projectPath: projectPath, npmCommand: npmCommand }); + // add NPM tools return null; } @@ -110,5 +112,12 @@ export class WikiConsole extends WikiRunner { this.renderWiki(path.join(this.getRunnerDirectory(), "templates", "buildJava.asciidoc"), { directoryPath: directoryPath, skipTest: skipTest }); return null; } + + runInstallCobiGen(runCommand: RunCommand): RunResult{ + let devonPath = this.getWorkingDirectory(); + this.renderWiki(path.join(this.getRunnerDirectory(), "templates", "installCobiGen.asciidoc"), {devonPath: devonPath}); + // vielleicht auch cobigen als Tools + return null; + } } diff --git a/runners/wikiConsole/templates/installCobiGen.asciidoc b/runners/wikiConsole/templates/installCobiGen.asciidoc new file mode 100644 index 00000000..a93948f6 --- /dev/null +++ b/runners/wikiConsole/templates/installCobiGen.asciidoc @@ -0,0 +1,14 @@ +== Install GobiGen +Installing devonfw CodeGenerator(i.e. CobiGen). + +=== Prerequisites +CobiGen CLI is installed inside your devonfw distribution. In order to execute it, you have to install the devonfw IDE first. + +=== 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 conigen` 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]. diff --git a/runners/wikiConsole/templates/installDevonfwIde.asciidoc b/runners/wikiConsole/templates/installDevonfwIde.asciidoc index 856a45e9..19fc43ed 100644 --- a/runners/wikiConsole/templates/installDevonfwIde.asciidoc +++ b/runners/wikiConsole/templates/installDevonfwIde.asciidoc @@ -44,4 +44,5 @@ For now clone the repository on https://github.com/devonfw/ide-settings or your For this tutorial you have to write `DEVON_IDE_TOOLS=(<%= tools; %>)` into the devon.properties file of the cloned settings repository. These settings will now be passed into the installation process of the devonfw IDE. Start the setup process by executing `.\setup 'path/to/settings'` (Windows) or `bash setup path/to/settings.git` (Linux). -You can also just execute `.\setup` (Windows) or `bash setup` (Linux) and press Enter when the setup assistent asks for the URL to the settings repository. This will also download the default settings and install the default tools within the devonfw IDE. \ No newline at end of file +You can also just execute `.\setup` (Windows) or `bash setup` (Linux) and press Enter when the setup assistent asks for the URL to the settings repository. This will also download the default settings and install the default tools within the devonfw IDE. + diff --git a/runners/wikiEclipse/index.ts b/runners/wikiEclipse/index.ts index 344a8c89..6dba7649 100644 --- a/runners/wikiEclipse/index.ts +++ b/runners/wikiEclipse/index.ts @@ -40,4 +40,16 @@ 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.installedTools).includes("eclipse") + ? super.supports(name, parameters) + : false; + } } \ No newline at end of file diff --git a/runners/wikiEclipse/templates/installCobigen.asciidoc b/runners/wikiEclipse/templates/installCobigen.asciidoc new file mode 100644 index 00000000..bc37ac4e --- /dev/null +++ b/runners/wikiEclipse/templates/installCobigen.asciidoc @@ -0,0 +1,12 @@ +== Install GobiGen +Installing devonfw CodeGenerator(i.e. CobiGen). + +=== Prerequisites +CobiGen Eclipse plugin is installed inside your devonfw distribution. In order to execute it, you have to install the devonfw IDE first. + +=== 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]. \ No newline at end of file diff --git a/runners/wikiVsCode/index.ts b/runners/wikiVsCode/index.ts index 6544093d..28a04a84 100644 --- a/runners/wikiVsCode/index.ts +++ b/runners/wikiVsCode/index.ts @@ -6,6 +6,7 @@ import * as path from "path"; export class WikiVsCode extends WikiRunner { + init(playbook: Playbook): void { super.init(playbook); } @@ -40,4 +41,16 @@ export class WikiVsCode 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.installedTools).includes("vscode") + ? super.supports(name, parameters) + : false; + } + } \ No newline at end of file diff --git a/runners/wikiVsCode/templates/installCobiGen.asciidoc b/runners/wikiVsCode/templates/installCobiGen.asciidoc new file mode 100644 index 00000000..8df05b8b --- /dev/null +++ b/runners/wikiVsCode/templates/installCobiGen.asciidoc @@ -0,0 +1,13 @@ +== Install GobiGen +Installing devonfw CodeGenerator(i.e. CobiGen). + +=== Prerequisites +CobiGen VSCode extension is installed inside your devonfw distribution. In order to execute it, you have to install the devonfw IDE first. + +=== Install CobiGen for VSCode Editor + +CobiGen is already installed for your VSCode Editor if you have installed it with the devonfw setup. +You can open the *Extensions* menu with ctrl+shift+X and you will see CobiGen under the installed extensions. +You can use CobiGen by right-click on a file and selecting CobiGen in the opened menu. This will execute CobiGen generate 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]. From 7f7c411c969eff2e87cfc5d52202404c3365ab7b Mon Sep 17 00:00:00 2001 From: EduardKrieger Date: Sun, 9 May 2021 16:17:01 +0200 Subject: [PATCH 02/23] removed unnecessary comments --- runners/wikiConsole/index.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/runners/wikiConsole/index.ts b/runners/wikiConsole/index.ts index cb366385..a3a70afc 100644 --- a/runners/wikiConsole/index.ts +++ b/runners/wikiConsole/index.ts @@ -73,7 +73,6 @@ export class WikiConsole extends WikiRunner { }; this.renderWiki(path.join(this.getRunnerDirectory(), "templates", "npmInstall.asciidoc"), { projectPath: projectPath, npmCommand: npmCommand }); - // add NPM tools return null; } @@ -116,7 +115,6 @@ export class WikiConsole extends WikiRunner { runInstallCobiGen(runCommand: RunCommand): RunResult{ let devonPath = this.getWorkingDirectory(); this.renderWiki(path.join(this.getRunnerDirectory(), "templates", "installCobiGen.asciidoc"), {devonPath: devonPath}); - // vielleicht auch cobigen als Tools return null; } } From 26b08c7a7f2524346094dcc20b85513fc08cabee Mon Sep 17 00:00:00 2001 From: EduardKrieger Date: Sun, 9 May 2021 18:19:45 +0200 Subject: [PATCH 03/23] asciidoc template changes --- runners/wikiConsole/templates/installCobiGen.asciidoc | 2 +- runners/wikiEclipse/templates/installCobigen.asciidoc | 2 +- runners/wikiVsCode/templates/installCobiGen.asciidoc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/runners/wikiConsole/templates/installCobiGen.asciidoc b/runners/wikiConsole/templates/installCobiGen.asciidoc index a93948f6..ac16fbee 100644 --- a/runners/wikiConsole/templates/installCobiGen.asciidoc +++ b/runners/wikiConsole/templates/installCobiGen.asciidoc @@ -2,7 +2,7 @@ Installing devonfw CodeGenerator(i.e. CobiGen). === Prerequisites -CobiGen CLI is installed inside your devonfw distribution. In order to execute it, you have to install the devonfw IDE first. +CobiGen CLI is installed inside 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 with a command prompt diff --git a/runners/wikiEclipse/templates/installCobigen.asciidoc b/runners/wikiEclipse/templates/installCobigen.asciidoc index bc37ac4e..e8b829f3 100644 --- a/runners/wikiEclipse/templates/installCobigen.asciidoc +++ b/runners/wikiEclipse/templates/installCobigen.asciidoc @@ -2,7 +2,7 @@ Installing devonfw CodeGenerator(i.e. CobiGen). === Prerequisites -CobiGen Eclipse plugin is installed inside your devonfw distribution. In order to execute it, you have to install the devonfw IDE first. +CobiGen Eclipse plugin is installed inside 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 diff --git a/runners/wikiVsCode/templates/installCobiGen.asciidoc b/runners/wikiVsCode/templates/installCobiGen.asciidoc index 8df05b8b..352887c7 100644 --- a/runners/wikiVsCode/templates/installCobiGen.asciidoc +++ b/runners/wikiVsCode/templates/installCobiGen.asciidoc @@ -2,7 +2,7 @@ Installing devonfw CodeGenerator(i.e. CobiGen). === Prerequisites -CobiGen VSCode extension is installed inside your devonfw distribution. In order to execute it, you have to install the devonfw IDE first. +CobiGen VSCode extension is installed inside 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 VSCode Editor From f874717832c56af56cf6e4344b880f56b8c3cb20 Mon Sep 17 00:00:00 2001 From: EduardKrieger Date: Wed, 12 May 2021 16:37:37 +0200 Subject: [PATCH 04/23] fixed spelling --- .../templates/installCobiGen.asciidoc | 10 +++++----- .../templates/installCobigen.asciidoc | 2 +- runners/wikiVsCode/index.ts | 3 ++- .../templates/installCobiGen.asciidoc | 19 +++++++++++++------ 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/runners/wikiConsole/templates/installCobiGen.asciidoc b/runners/wikiConsole/templates/installCobiGen.asciidoc index ac16fbee..8b98949d 100644 --- a/runners/wikiConsole/templates/installCobiGen.asciidoc +++ b/runners/wikiConsole/templates/installCobiGen.asciidoc @@ -1,14 +1,14 @@ == Install GobiGen -Installing devonfw CodeGenerator(i.e. CobiGen). +Installing devonfw code generator (i.e. CobiGen). === Prerequisites CobiGen CLI is installed inside 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 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 conigen` and CobiGen will be installed. -To update the environment you have to execute `devon` and you have successfully installed CobiGen. +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]. diff --git a/runners/wikiEclipse/templates/installCobigen.asciidoc b/runners/wikiEclipse/templates/installCobigen.asciidoc index e8b829f3..931ae81b 100644 --- a/runners/wikiEclipse/templates/installCobigen.asciidoc +++ b/runners/wikiEclipse/templates/installCobigen.asciidoc @@ -1,5 +1,5 @@ == Install GobiGen -Installing devonfw CodeGenerator(i.e. CobiGen). +Installing devonfw code generator (i.e. CobiGen). === Prerequisites CobiGen Eclipse plugin is installed inside 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. diff --git a/runners/wikiVsCode/index.ts b/runners/wikiVsCode/index.ts index 28a04a84..0b5f35de 100644 --- a/runners/wikiVsCode/index.ts +++ b/runners/wikiVsCode/index.ts @@ -43,7 +43,8 @@ export class WikiVsCode extends WikiRunner { } runInstallCobiGen(runCommand: RunCommand): RunResult{ - this.renderWiki(path.join(this.getRunnerDirectory(), "templates", "installCobiGen.asciidoc"), {}); + let dir = this.getWorkingDirectory(); + this.renderWiki(path.join(this.getRunnerDirectory(), "templates", "installCobiGen.asciidoc"), {dir: dir}); return null; } diff --git a/runners/wikiVsCode/templates/installCobiGen.asciidoc b/runners/wikiVsCode/templates/installCobiGen.asciidoc index 352887c7..ec6c4102 100644 --- a/runners/wikiVsCode/templates/installCobiGen.asciidoc +++ b/runners/wikiVsCode/templates/installCobiGen.asciidoc @@ -1,13 +1,20 @@ == Install GobiGen -Installing devonfw CodeGenerator(i.e. CobiGen). +Installing devonfw code generator (i.e. CobiGen). === Prerequisites -CobiGen VSCode extension is installed inside 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. +To install CobiGen VS Code extension 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-ide] documentation to install the missing ones. -=== Install CobiGen for VSCode Editor +=== Install CobiGen for VS Code Editor +First, download the VS Code extension file. You can download it https://github.com/devonfw-forge/cobigen-vscode-plugin/releases/download/0.0.1/cobigen-plugin-0.0.1.vsix[here] or execute this command in PowerShell or Terminal. -CobiGen is already installed for your VSCode Editor if you have installed it with the devonfw setup. -You can open the *Extensions* menu with ctrl+shift+X and you will see CobiGen under the installed extensions. -You can use CobiGen by right-click on a file and selecting CobiGen in the opened menu. This will execute CobiGen generate for the selected file. + +.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 <%= 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. +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]. From 496b1a68153306f8220c061a2f48e278c5153ef8 Mon Sep 17 00:00:00 2001 From: EduardKrieger Date: Wed, 12 May 2021 16:44:41 +0200 Subject: [PATCH 05/23] fixed spelling --- runners/wikiVsCode/templates/installCobiGen.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runners/wikiVsCode/templates/installCobiGen.asciidoc b/runners/wikiVsCode/templates/installCobiGen.asciidoc index ec6c4102..3a81be72 100644 --- a/runners/wikiVsCode/templates/installCobiGen.asciidoc +++ b/runners/wikiVsCode/templates/installCobiGen.asciidoc @@ -2,7 +2,7 @@ Installing devonfw code generator (i.e. CobiGen). === Prerequisites -To install CobiGen VS Code extension 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-ide] documentation to install the missing ones. +To install CobiGen VS Code extension 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 IDE] documentation to install the missing ones. === Install CobiGen for VS Code Editor First, download the VS Code extension file. You can download it https://github.com/devonfw-forge/cobigen-vscode-plugin/releases/download/0.0.1/cobigen-plugin-0.0.1.vsix[here] or execute this command in PowerShell or Terminal. From ef4a8d1c092e857a9683b3c4b1831fdb60918e73 Mon Sep 17 00:00:00 2001 From: EduardKrieger Date: Wed, 12 May 2021 17:54:45 +0200 Subject: [PATCH 06/23] changed Prerequisites --- runners/wikiConsole/templates/installCobiGen.asciidoc | 2 +- runners/wikiEclipse/templates/installCobigen.asciidoc | 2 +- runners/wikiVsCode/templates/installCobiGen.asciidoc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/runners/wikiConsole/templates/installCobiGen.asciidoc b/runners/wikiConsole/templates/installCobiGen.asciidoc index 8b98949d..677e8934 100644 --- a/runners/wikiConsole/templates/installCobiGen.asciidoc +++ b/runners/wikiConsole/templates/installCobiGen.asciidoc @@ -2,7 +2,7 @@ Installing devonfw code generator (i.e. CobiGen). === Prerequisites -CobiGen CLI is installed inside 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. +* 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 diff --git a/runners/wikiEclipse/templates/installCobigen.asciidoc b/runners/wikiEclipse/templates/installCobigen.asciidoc index 931ae81b..a53da028 100644 --- a/runners/wikiEclipse/templates/installCobigen.asciidoc +++ b/runners/wikiEclipse/templates/installCobigen.asciidoc @@ -2,7 +2,7 @@ Installing devonfw code generator (i.e. CobiGen). === Prerequisites -CobiGen Eclipse plugin is installed inside 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. +* 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 diff --git a/runners/wikiVsCode/templates/installCobiGen.asciidoc b/runners/wikiVsCode/templates/installCobiGen.asciidoc index 3a81be72..2024b50c 100644 --- a/runners/wikiVsCode/templates/installCobiGen.asciidoc +++ b/runners/wikiVsCode/templates/installCobiGen.asciidoc @@ -2,7 +2,7 @@ Installing devonfw code generator (i.e. CobiGen). === Prerequisites -To install CobiGen VS Code extension 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 IDE] documentation to install the missing ones. +* 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 https://github.com/devonfw-forge/cobigen-vscode-plugin/releases/download/0.0.1/cobigen-plugin-0.0.1.vsix[here] or execute this command in PowerShell or Terminal. From 894ab5134c8b31e6abc7c4ea13f342ead2c8bfeb Mon Sep 17 00:00:00 2001 From: EduardKrieger Date: Fri, 14 May 2021 12:44:51 +0200 Subject: [PATCH 07/23] const var changed to uppercase --- engine/runner.ts | 6 +-- engine/wikiRunner.ts | 6 +-- runners/console/index.ts | 90 ++++++++++++++++++------------------ runners/katacoda/index.ts | 58 +++++++++++------------ runners/vscode/index.ts | 2 +- runners/wikiConsole/index.ts | 18 ++++---- runners/wikiEclipse/index.ts | 4 +- runners/wikiEditor/index.ts | 2 +- runners/wikiVsCode/index.ts | 4 +- 9 files changed, 95 insertions(+), 95 deletions(-) diff --git a/engine/runner.ts b/engine/runner.ts index 2e49f325..9c7d98c6 100644 --- a/engine/runner.ts +++ b/engine/runner.ts @@ -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) { @@ -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 { diff --git a/engine/wikiRunner.ts b/engine/wikiRunner.ts index 23b5ccbf..e7cd1b21 100644 --- a/engine/wikiRunner.ts +++ b/engine/wikiRunner.ts @@ -7,13 +7,13 @@ import * as ejs from "ejs"; export abstract class WikiRunner extends Runner { public outputPathTutorial: string; - protected readonly installedTools: string = "installedTools"; + 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.installedTools, ""); + this.setVariable(this.WORKSPACE_DIRECTORY, path.join(this.getWorkingDirectory())); + this.setVariable(this.INSTALLED_TOOLS, ""); } async destroy(playbook: Playbook): Promise { diff --git a/runners/console/index.ts b/runners/console/index.ts index f902da7c..58041fd9 100644 --- a/runners/console/index.ts +++ b/runners/console/index.ts @@ -32,7 +32,7 @@ export class Console extends Runner { ConsoleUtils.createBackupDevonDirectory(); this.createFolder(path.normalize(this.getWorkingDirectory()), true); - this.setVariable(this.workspaceDirectory, path.join(this.getWorkingDirectory())); + this.setVariable(this.WORKSPACE_DIRECTORY, path.join(this.getWorkingDirectory())); this.env = process.env; } @@ -81,8 +81,8 @@ export class Console extends Runner { ConsoleUtils.executeCommandSync("bash setup " + path.join(settingsDir, "settings.git").replace(/\\/g, "/"), installDir, result, this.env, "yes"); } - this.setVariable(this.workspaceDirectory, path.join(this.getWorkingDirectory(), "devonfw", "workspaces", "main")); - this.setVariable(this.useDevonCommand, true); + this.setVariable(this.WORKSPACE_DIRECTORY, path.join(this.getWorkingDirectory(), "devonfw", "workspaces", "main")); + this.setVariable(this.USE_DEVON_COMMAND, true); return result; } @@ -100,7 +100,7 @@ export class Console extends Runner { ? runCommand.command.parameters[0].workspace : this.playbookName.replace("/", "").replace(" ","-")); - let workspacesDir = this.getVariable(this.useDevonCommand) + let workspacesDir = this.getVariable(this.USE_DEVON_COMMAND) ? path.join(this.getWorkingDirectory(), "devonfw", "workspaces") : path.join(this.getWorkingDirectory(), 'workspaces'); @@ -136,8 +136,8 @@ export class Console extends Runner { ConsoleUtils.executeCommandSync("git clone https://github.com/devonfw-tutorials/" + workspacesName + ".git .", workspacesDir, result, this.env); } - if(!this.getVariable(this.useDevonCommand)){ - this.setVariable(this.workspaceDirectory, path.join(this.getWorkingDirectory(), 'workspaces')); + if(!this.getVariable(this.USE_DEVON_COMMAND)){ + this.setVariable(this.WORKSPACE_DIRECTORY, path.join(this.getWorkingDirectory(), 'workspaces')); } return result; @@ -148,7 +148,7 @@ export class Console extends Runner { let result = new RunResult(); result.returnCode = 0; - if(!this.getVariable(this.useDevonCommand)){ + if(!this.getVariable(this.USE_DEVON_COMMAND)){ console.warn("Devonfw IDE is not installed"); } @@ -160,7 +160,7 @@ export class Console extends Runner { let result = new RunResult(); result.returnCode = 0; - if(!this.getVariable(this.useDevonCommand)){ + if(!this.getVariable(this.USE_DEVON_COMMAND)){ console.warn("Devonfw IDE is not installed"); } @@ -174,7 +174,7 @@ export class Console 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]); if(!fs.existsSync(filepath.substr(0, filepath.lastIndexOf(path.sep)))) { fs.mkdirSync(filepath.substr(0, filepath.lastIndexOf(path.sep)), { recursive: true }); } @@ -193,12 +193,12 @@ export class Console extends Runner { let result = new RunResult(); result.returnCode = 0; - let projectDir = path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0]); + let projectDir = path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0]); let buildCommand = (runCommand.command.parameters.length == 2 && runCommand.command.parameters[1] == true) ? "mvn clean install" : "mvn clean install -Dmaven.test.skip=true"; - this.getVariable(this.useDevonCommand) + this.getVariable(this.USE_DEVON_COMMAND) ? ConsoleUtils.executeDevonCommandSync(buildCommand, projectDir, path.join(this.getWorkingDirectory(), "devonfw"), result, this.env) : ConsoleUtils.executeCommandSync(buildCommand, projectDir, result, this.env); @@ -209,7 +209,7 @@ export class Console extends Runner { let result = new RunResult(); result.returnCode = 0; - if(!this.getVariable(this.useDevonCommand)){ + if(!this.getVariable(this.USE_DEVON_COMMAND)){ console.warn("Devonfw IDE is not installed"); } @@ -222,7 +222,7 @@ export class Console 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 content = fs.readFileSync(filepath, { encoding: "utf-8" }); if(runCommand.command.parameters[1].placeholder) { @@ -270,7 +270,7 @@ export class Console 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]); if(runCommand.command.parameters.length == 2 && runCommand.command.parameters[1].port){ let process = ConsoleUtils.executeCommandAsync("docker-compose up", filepath, result, this.env); process.on('close', (code) => { @@ -293,9 +293,9 @@ export class Console extends Runner { let result = new RunResult(); result.returnCode = 0; - let serverDir = path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0]); + let serverDir = path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0]); if(runCommand.command.parameters.length == 2 && runCommand.command.parameters[1].port){ - let process = (this.getVariable(this.useDevonCommand)) + let process = (this.getVariable(this.USE_DEVON_COMMAND)) ? ConsoleUtils.executeDevonCommandAsync("mvn spring-boot:run", serverDir, path.join(this.getWorkingDirectory(), "devonfw"), result, this.env) : ConsoleUtils.executeCommandAsync("mvn spring-boot:run", serverDir, result, this.env); @@ -314,7 +314,7 @@ export class Console extends Runner { let result = new RunResult(); result.returnCode = 0; - 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]); if(runCommand.command.parameters[0] != "") { this.createFolder(directorypath, true); } @@ -327,14 +327,14 @@ export class Console extends Runner { let result = new RunResult(); result.returnCode = 0; - 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 = "npm install"; if(runCommand.command.parameters.length > 1){ if (runCommand.command.parameters[1].global) npmCommand += " -g"; if (runCommand.command.parameters[1].args) npmCommand += " " + runCommand.command.parameters[1].args.join(" "); if (runCommand.command.parameters[1].name) npmCommand += " " + runCommand.command.parameters[1].name; } - this.getVariable(this.useDevonCommand) + this.getVariable(this.USE_DEVON_COMMAND) ? ConsoleUtils.executeDevonCommandSync(npmCommand, projectPath, path.join(this.getWorkingDirectory(), "devonfw"), result, this.env) : ConsoleUtils.executeCommandSync(npmCommand, projectPath, result, this.env); @@ -345,7 +345,7 @@ export class Console extends Runner { let result = new RunResult(); result.returnCode = 0; - let downloadlDir = this.getVariable(this.workspaceDirectory); + let downloadlDir = this.getVariable(this.WORKSPACE_DIRECTORY); if (runCommand.command.parameters.length == 3) { downloadlDir = path.join(downloadlDir, runCommand.command.parameters[2]); this.createFolder(downloadlDir, false); @@ -362,9 +362,9 @@ export class Console extends Runner { let result = new RunResult(); result.returnCode = 0; - let projectDir = path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0]); + let projectDir = path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0]); if(runCommand.command.parameters.length == 2 && runCommand.command.parameters[1].port){ - let process = this.getVariable(this.useDevonCommand) + let process = this.getVariable(this.USE_DEVON_COMMAND) ? ConsoleUtils.executeDevonCommandAsync("ng serve", projectDir, path.join(this.getWorkingDirectory(), "devonfw"), result, this.env) : ConsoleUtils.executeCommandAsync("ng serve", projectDir, result, this.env); if(process.pid) { @@ -381,12 +381,12 @@ export class Console extends Runner { let result = new RunResult(); result.returnCode = 0; - let projectDir = path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0]); + let projectDir = path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0]); let command1 = "ng build"; if(runCommand.command.parameters.length == 2) { command1 = command1 + " --output-path " + runCommand.command.parameters[1]; } - this.getVariable(this.useDevonCommand) + this.getVariable(this.USE_DEVON_COMMAND) ? ConsoleUtils.executeDevonCommandSync(command1, projectDir, path.join(this.getWorkingDirectory(), "devonfw"), result, this.env) : ConsoleUtils.executeCommandSync(command1, projectDir, result, this.env); @@ -397,7 +397,7 @@ export class Console extends Runner { let result = new RunResult(); result.returnCode = 0; - 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]); if(folderPath && !fs.existsSync(folderPath)) { this.createFolder(folderPath, true); } @@ -414,7 +414,7 @@ export class Console extends Runner { let result = new RunResult(); result.returnCode = 0; - if(!this.getVariable(this.useDevonCommand)){ + if(!this.getVariable(this.USE_DEVON_COMMAND)){ console.warn("Devonfw IDE is not installed"); } ConsoleUtils.executeDevonCommandSync("cobigen adapt-templates",path.join(this.getWorkingDirectory(), "devonfw"), path.join(this.getWorkingDirectory(), "devonfw"), result, this.env); @@ -425,9 +425,9 @@ export class Console extends Runner { let result = new RunResult(); result.returnCode = 0; - let projectDir = path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[1]); + let projectDir = path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[1]); let params = runCommand.command.parameters.length > 2 && (runCommand.command.parameters[2] instanceof Array) ? (" " + runCommand.command.parameters[2].join(" ")) : ""; - this.getVariable(this.useDevonCommand) + this.getVariable(this.USE_DEVON_COMMAND) ? ConsoleUtils.executeDevonCommandSync("ng create " + runCommand.command.parameters[0] + params, projectDir, path.join(this.getWorkingDirectory(), "devonfw"), result, this.env) : ConsoleUtils.executeCommandSync("ng new " + runCommand.command.parameters[0] + params, projectDir, result, this.env); @@ -441,7 +441,7 @@ export class Console extends Runner { let workspacesDir = path.join(this.getWorkingDirectory(), runCommand.command.parameters[0]); if(!fs.existsSync(workspacesDir)) fs.mkdirSync(workspacesDir); - this.setVariable(this.workspaceDirectory, workspacesDir); + this.setVariable(this.WORKSPACE_DIRECTORY, workspacesDir); return result; } @@ -454,7 +454,7 @@ export class Console extends Runner { ? "powershell.exe " + path.join(this.playbookPath, runCommand.command.parameters[1]) : "bash " + path.join(this.playbookPath, runCommand.command.parameters[0]); - ConsoleUtils.executeCommandSync(scriptCommand, this.getVariable(this.workspaceDirectory), result, this.env); + ConsoleUtils.executeCommandSync(scriptCommand, this.getVariable(this.WORKSPACE_DIRECTORY), result, this.env); return result; } @@ -484,9 +484,9 @@ export class Console extends Runner { } async assertRestoreWorkspace(runCommand: RunCommand, result: RunResult) { - let workspacesDir = this.getVariable(this.useDevonCommand) + let workspacesDir = this.getVariable(this.USE_DEVON_COMMAND) ? path.join(this.getWorkingDirectory(), "devonfw", "workspaces") - : this.getVariable(this.workspaceDirectory); + : this.getVariable(this.WORKSPACE_DIRECTORY); try{ new Assertions() @@ -519,9 +519,9 @@ export class Console extends Runner { new Assertions() .noErrorCode(result) .noException(result) - .directoryExits(path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0], "api", "target")) - .directoryExits(path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0], "core", "target")) - .directoryExits(path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0], "server", "target")); + .directoryExits(path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0], "api", "target")) + .directoryExits(path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0], "core", "target")) + .directoryExits(path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0], "server", "target")); } catch(error) { await this.cleanUp(); throw error; @@ -566,7 +566,7 @@ export class Console extends Runner { new Assertions() .noErrorCode(result) .noException(result) - .fileExits(path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0])); + .fileExits(path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0])); } catch(error) { await this.cleanUp(); throw error; @@ -582,7 +582,7 @@ export class Console extends Runner { content = fs.readFileSync(path.join(this.playbookPath, runCommand.command.parameters[1].file), { encoding: "utf-8" }); } - 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]); new Assertions() .noErrorCode(result) .noException(result) @@ -640,13 +640,13 @@ export class Console extends Runner { try { let repository = runCommand.command.parameters[1]; let repoName = repository.slice(repository.lastIndexOf("/"), -4); - let directorypath = path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0], repoName); + let directorypath = path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0], repoName); new Assertions() .noErrorCode(result) .noException(result) - .directoryExits(path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0], repoName)) - .directoryNotEmpty(path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0], repoName)) + .directoryExits(path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0], repoName)) + .directoryNotEmpty(path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0], repoName)) .repositoryIsClean(directorypath); } catch(error) { await this.cleanUp(); @@ -656,7 +656,7 @@ export class Console extends Runner { async assertNpmInstall(runCommand: RunCommand, result: RunResult) { try { - let projectDir = path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0]); + let projectDir = path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0]); new Assertions() .noErrorCode(result) .noException(result) @@ -674,7 +674,7 @@ export class Console extends Runner { async assertDownloadFile(runCommand: RunCommand, result: RunResult){ try { - let directory = this.getVariable(this.workspaceDirectory); + let directory = this.getVariable(this.WORKSPACE_DIRECTORY); if(runCommand.command.parameters.length == 3) { directory = path.join(directory, runCommand.command.parameters[2]); } @@ -713,7 +713,7 @@ export class Console extends Runner { async assertBuildNg(runCommand: RunCommand, result: RunResult) { try { - 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]); var outputpath; if(runCommand.command.parameters.length == 2) { outputpath = runCommand.command.parameters[1].trim(); @@ -738,7 +738,7 @@ export class Console extends Runner { async assertCreateFolder(runCommand: RunCommand, result: RunResult){ try { - 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]); new Assertions() .noErrorCode(result) .noException(result) @@ -766,7 +766,7 @@ export class Console extends Runner { async assertCreateDevon4ngProject(runCommand: RunCommand, result: RunResult) { try { - let projectDir = path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[1], runCommand.command.parameters[0]); + let projectDir = path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[1], runCommand.command.parameters[0]); new Assertions() .noErrorCode(result) .noException(result) diff --git a/runners/katacoda/index.ts b/runners/katacoda/index.ts index 80a57b87..0e65993e 100644 --- a/runners/katacoda/index.ts +++ b/runners/katacoda/index.ts @@ -46,7 +46,7 @@ export class Katacoda extends Runner { this.createFolder(this.setupDir, false); //set working direktory - this.setVariable(this.workspaceDirectory, path.join("/root")); + this.setVariable(this.WORKSPACE_DIRECTORY, path.join("/root")); this.assetManager = new KatacodaAssetManager(path.join(this.outputPathTutorial, "assets")); @@ -100,8 +100,8 @@ export class Katacoda extends Runner { //update current and working directory this.currentDir = path.join(this.currentDir, "devonfw"); - this.setVariable(this.workspaceDirectory, path.join("/root", "devonfw", "workspaces", "main")); - this.setVariable(this.useDevonCommand, true); + this.setVariable(this.WORKSPACE_DIRECTORY, path.join("/root", "devonfw", "workspaces", "main")); + this.setVariable(this.USE_DEVON_COMMAND, true); fs.appendFileSync(path.join(this.getRunnerDirectory(),"templates","scripts", "intro_foreground.sh"), "\nexport NG_CLI_ANALYTICS=CI"); fs.appendFileSync(path.join(this.getRunnerDirectory(),"templates","scripts", "intro_background.sh"), "\necho \'export NG_CLI_ANALYTICS=CI\' >> /root/.profile\n"); @@ -126,8 +126,8 @@ export class Katacoda extends Runner { "script": "restoreDevonfwIde.sh" }); //update working directory - this.setVariable(this.workspaceDirectory, path.join("/root", "devonfw", "workspaces", "main")); - this.setVariable(this.useDevonCommand, true); + this.setVariable(this.WORKSPACE_DIRECTORY, path.join("/root", "devonfw", "workspaces", "main")); + this.setVariable(this.USE_DEVON_COMMAND, true); fs.appendFileSync(path.join(this.getRunnerDirectory(),"templates","scripts", "intro_foreground.sh"), "\n. ~/.bashrc\nexport NG_CLI_ANALYTICS=CI"); fs.appendFileSync(path.join(this.getRunnerDirectory(),"templates","scripts", "intro_background.sh"), "\necho \'export NG_CLI_ANALYTICS=CI\' >> /root/.profile\n"); @@ -141,20 +141,20 @@ export class Katacoda extends Runner { ? runCommand.command.parameters[0].workspace : this.playbookName.replace("/", "").replace(" ","-")); - let workspacesDir = this.getVariable(this.useDevonCommand) + let workspacesDir = this.getVariable(this.USE_DEVON_COMMAND) ? path.join('/root', "devonfw", "workspaces").replace(/\\/g, "/") : path.join('/root', "workspaces").replace(/\\/g, "/"); let user = this.getVariable('user') ? this.getVariable('user') : 'devonfw-tutorials'; - this.renderTemplate(path.join("scripts", "restoreWorkspace.sh"), path.join(this.setupDir, "restoreWorkspace.sh"), {user: user, branch: this.getVariable("branch"), workspace: workspacesName, workspaceDir: workspacesDir, useDevonCommand: !!this.getVariable(this.useDevonCommand)}); + this.renderTemplate(path.join("scripts", "restoreWorkspace.sh"), path.join(this.setupDir, "restoreWorkspace.sh"), {user: user, branch: this.getVariable("branch"), workspace: workspacesName, workspaceDir: workspacesDir, USE_DEVON_COMMAND: !!this.getVariable(this.USE_DEVON_COMMAND)}); this.setupScripts.push({ "name": "Restore Workspace", "script": "restoreWorkspace.sh" }); - if(!this.getVariable(this.useDevonCommand)) - this.setVariable(this.workspaceDirectory, path.join('/root', "workspaces")); + if(!this.getVariable(this.USE_DEVON_COMMAND)) + this.setVariable(this.WORKSPACE_DIRECTORY, path.join('/root', "workspaces")); this.pushStep(runCommand); return null; @@ -197,8 +197,8 @@ export class Katacoda extends Runner { } runCreateFile(runCommand: RunCommand): RunResult{ - let workspaceDir = path.join(this.getVariable(this.workspaceDirectory).concat(path.sep).replace(path.sep + "root" + path.sep, "")); - let filePath = path.join(this.getVariable(this.workspaceDirectory), path.dirname(runCommand.command.parameters[0])).replace(/\\/g, "/"); + let workspaceDir = path.join(this.getVariable(this.WORKSPACE_DIRECTORY).concat(path.sep).replace(path.sep + "root" + path.sep, "")); + let filePath = path.join(this.getVariable(this.WORKSPACE_DIRECTORY), path.dirname(runCommand.command.parameters[0])).replace(/\\/g, "/"); let fileDir = path.join(workspaceDir, runCommand.command.parameters[0]).replace(/\\/g, "/"); let fileName = path.basename(path.join(runCommand.command.parameters[0])); let content = ""; @@ -212,7 +212,7 @@ export class Katacoda extends Runner { } runChangeFile(runCommand: RunCommand): RunResult{ - let workspaceDir = path.join(this.getVariable(this.workspaceDirectory).concat(path.sep).replace(path.sep + "root" + path.sep, "")); + let workspaceDir = path.join(this.getVariable(this.WORKSPACE_DIRECTORY).concat(path.sep).replace(path.sep + "root" + path.sep, "")); let fileName = path.basename(path.join(runCommand.command.parameters[0])); let fileDir = path.join(workspaceDir, runCommand.command.parameters[0]).replace(/\\/g, "/"); let placeholder = runCommand.command.parameters[1].placeholder ? runCommand.command.parameters[1].placeholder : ""; @@ -249,30 +249,30 @@ export class Katacoda extends Runner { runBuildJava(runCommand: RunCommand): RunResult{ - let cdCommand = this.changeCurrentDir(path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0])); + let cdCommand = this.changeCurrentDir(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.pushStep(runCommand, "Build the java project", "step" + runCommand.stepIndex + ".md"); - this.renderTemplate("buildJava.md", this.outputPathTutorial + "step" + runCommand.stepIndex + ".md", { text: runCommand.text, textAfter: runCommand.textAfter, cdCommand: cdCommand, skipTest: skipTest, useDevonCommand: this.getVariable(this.useDevonCommand)}); + this.renderTemplate("buildJava.md", this.outputPathTutorial + "step" + runCommand.stepIndex + ".md", { text: runCommand.text, textAfter: runCommand.textAfter, cdCommand: cdCommand, skipTest: skipTest, USE_DEVON_COMMAND: this.getVariable(this.USE_DEVON_COMMAND)}); return null; } runBuildNg(runCommand: RunCommand): RunResult { - let cdCommand = this.changeCurrentDir(path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0])); + let cdCommand = this.changeCurrentDir(path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0])); this.pushStep(runCommand, "Build the Angular Project", "step" + runCommand.stepIndex + ".md"); - this.renderTemplate("buildNg.md", this.outputPathTutorial + "step" + runCommand.stepIndex + ".md", { text: runCommand.text, textAfter: runCommand.textAfter, cdCommand: cdCommand, outputDir: runCommand.command.parameters[1], useDevonCommand: this.getVariable(this.useDevonCommand) }); + this.renderTemplate("buildNg.md", this.outputPathTutorial + "step" + runCommand.stepIndex + ".md", { text: runCommand.text, textAfter: runCommand.textAfter, cdCommand: cdCommand, outputDir: runCommand.command.parameters[1], USE_DEVON_COMMAND: this.getVariable(this.USE_DEVON_COMMAND) }); return null; } runCloneRepository(runCommand: RunCommand): RunResult { - let cdCommand = this.changeCurrentDir(path.join(this.getVariable(this.workspaceDirectory))); + let cdCommand = this.changeCurrentDir(path.join(this.getVariable(this.WORKSPACE_DIRECTORY))); let directoryPath = ""; if(runCommand.command.parameters[0].trim()) { directoryPath = path.join(runCommand.command.parameters[0]).replace(/\\/g, "/"); @@ -286,17 +286,17 @@ export class Katacoda extends Runner { } runRunServerJava(runCommand: RunCommand): RunResult{ - let serverDir = path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0]); + let serverDir = path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0]); let terminal = this.getTerminal('runServerJava'); let cdCommand = this.changeCurrentDir(serverDir, terminal.terminalId, terminal.isRunning); this.pushStep(runCommand, "Start the java server", "step" + runCommand.stepIndex + ".md"); - this.renderTemplate("runServerJava.md", this.outputPathTutorial + "step" + runCommand.stepIndex + ".md", { text: runCommand.text, textAfter: runCommand.textAfter, cdCommand: cdCommand, terminalId: terminal.terminalId, interrupt: terminal.isRunning, useDevonCommand: this.getVariable(this.useDevonCommand)}); + this.renderTemplate("runServerJava.md", this.outputPathTutorial + "step" + runCommand.stepIndex + ".md", { text: runCommand.text, textAfter: runCommand.textAfter, cdCommand: cdCommand, terminalId: terminal.terminalId, interrupt: terminal.isRunning, USE_DEVON_COMMAND: this.getVariable(this.USE_DEVON_COMMAND)}); return null; } runNpmInstall(runCommand: RunCommand): RunResult { - let cdCommand = this.changeCurrentDir(path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0])); + let cdCommand = this.changeCurrentDir(path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0])); let packageTitle = (runCommand.command.parameters.length > 1 && runCommand.command.parameters[1].name) ? runCommand.command.parameters[1].name : "the dependencies"; let npmCommand = { "name": (runCommand.command.parameters.length > 1 && runCommand.command.parameters[1].name) ? runCommand.command.parameters[1].name : undefined, @@ -306,12 +306,12 @@ export class Katacoda extends Runner { this.pushStep(runCommand, "Install " + packageTitle, "step" + runCommand.stepIndex + ".md") - this.renderTemplate("npmInstall.md", this.outputPathTutorial + "step" + runCommand.stepIndex + ".md", { text: runCommand.text, textAfter: runCommand.textAfter, cdCommand: cdCommand, useDevonCommand: this.getVariable(this.useDevonCommand), npmCommand: npmCommand}); + this.renderTemplate("npmInstall.md", this.outputPathTutorial + "step" + runCommand.stepIndex + ".md", { text: runCommand.text, textAfter: runCommand.textAfter, cdCommand: cdCommand, USE_DEVON_COMMAND: this.getVariable(this.USE_DEVON_COMMAND), npmCommand: npmCommand}); return null; } runRunClientNg(runCommand: RunCommand): RunResult { - let serverDir = path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0]); + let serverDir = path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0]); let terminal = this.getTerminal('runClientNg'); let cdCommand = this.changeCurrentDir(serverDir, terminal.terminalId, terminal.isRunning); @@ -319,12 +319,12 @@ export class Katacoda extends Runner { fs.appendFileSync(path.join(this.getRunnerDirectory(),"templates","scripts", "intro_background.sh"), "\necho \'export NODE_OPTIONS=\"--max-old-space-size=16384\"\' >> /root/.profile\n"); - this.renderTemplate("runClientNg.md", this.outputPathTutorial + "step" + runCommand.stepIndex + ".md", { text: runCommand.text, textAfter: runCommand.textAfter, cdCommand: cdCommand, terminalId: terminal.terminalId, interrupt: terminal.isRunning, port: runCommand.command.parameters[1].port, useDevonCommand: this.getVariable(this.useDevonCommand)}); + this.renderTemplate("runClientNg.md", this.outputPathTutorial + "step" + runCommand.stepIndex + ".md", { text: runCommand.text, textAfter: runCommand.textAfter, cdCommand: cdCommand, terminalId: terminal.terminalId, interrupt: terminal.isRunning, port: runCommand.command.parameters[1].port, USE_DEVON_COMMAND: this.getVariable(this.USE_DEVON_COMMAND)}); return null; } runCreateFolder(runCommand: RunCommand): RunResult { - let folderPath = new DirUtils().getCdParam(this.currentDir, path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0])); + let folderPath = new DirUtils().getCdParam(this.currentDir, path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0])); this.pushStep(runCommand, "Create a new folder", "step" + runCommand.stepIndex + ".md"); @@ -335,7 +335,7 @@ export class Katacoda extends Runner { runDownloadFile(runCommand: RunCommand): RunResult { this.pushStep(runCommand, "Download a file", "step" + runCommand.stepIndex + ".md"); - let downloadDir = this.getVariable(this.workspaceDirectory).replace(/\\/g, "/") + let downloadDir = this.getVariable(this.WORKSPACE_DIRECTORY).replace(/\\/g, "/") if (runCommand.command.parameters.length == 3) { downloadDir = downloadDir.concat("/", runCommand.command.parameters[2]) } @@ -366,7 +366,7 @@ export class Katacoda extends Runner { this.renderTemplate("nextKatacodaStep.md", this.outputPathTutorial + "step" + runCommand.stepIndex + ".md", { text: runCommand.text, textAfter: runCommand.textAfter, content: content }); if(runCommand.command.parameters[2]) { - this.currentDir = path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[2]); + this.currentDir = path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[2]); } return null; @@ -382,7 +382,7 @@ export class Katacoda extends Runner { runDockerCompose(runCommand: RunCommand) : RunResult { let terminal = this.getTerminal('runDockerCompose'); - let cdCommand = this.changeCurrentDir(path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0]), terminal.terminalId, terminal.isRunning); + let cdCommand = this.changeCurrentDir(path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0]), terminal.terminalId, terminal.isRunning); this.pushStep(runCommand, "Execute Docker Compose", "step" + runCommand.stepIndex + ".md"); @@ -392,12 +392,12 @@ export class Katacoda extends Runner { } runCreateDevon4ngProject(runCommand: RunCommand): RunResult { - let cdCommand = this.changeCurrentDir(path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[1])); + let cdCommand = this.changeCurrentDir(path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[1])); let params = runCommand.command.parameters.length > 2 && (runCommand.command.parameters[2] instanceof Array) ? runCommand.command.parameters[2].join(" ") : ""; this.pushStep(runCommand, "Create Angular Project", "step" + runCommand.stepIndex + ".md"); - this.renderTemplate("createDevon4ngProject.md", this.outputPathTutorial + "step" + runCommand.stepIndex + ".md", { text: runCommand.text, textAfter: runCommand.textAfter, cdCommand: cdCommand, projectName: runCommand.command.parameters[0], params: params, useDevonCommand: this.getVariable(this.useDevonCommand) }); + this.renderTemplate("createDevon4ngProject.md", this.outputPathTutorial + "step" + runCommand.stepIndex + ".md", { text: runCommand.text, textAfter: runCommand.textAfter, cdCommand: cdCommand, projectName: runCommand.command.parameters[0], params: params, USE_DEVON_COMMAND: this.getVariable(this.USE_DEVON_COMMAND) }); return null; } diff --git a/runners/vscode/index.ts b/runners/vscode/index.ts index 8306c129..d1866973 100644 --- a/runners/vscode/index.ts +++ b/runners/vscode/index.ts @@ -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"); diff --git a/runners/wikiConsole/index.ts b/runners/wikiConsole/index.ts index a3a70afc..e4795192 100644 --- a/runners/wikiConsole/index.ts +++ b/runners/wikiConsole/index.ts @@ -8,7 +8,7 @@ export class WikiConsole extends WikiRunner { init(playbook: Playbook): void { super.init(playbook); - this.setVariable(this.workspaceDirectory, path.join(this.getWorkingDirectory())); + this.setVariable(this.WORKSPACE_DIRECTORY, path.join(this.getWorkingDirectory())); } async destroy(playbook: Playbook): Promise { @@ -25,14 +25,14 @@ 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.installedTools, tools); + this.setVariable(this.WORKSPACE_DIRECTORY, path.join(this.getWorkingDirectory(), "devonfw", "workspaces", "main")); + this.setVariable(this.INSTALLED_TOOLS, tools); return null; } 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; @@ -59,13 +59,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, @@ -77,7 +77,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; } @@ -92,7 +92,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}); @@ -106,7 +106,7 @@ export class WikiConsole extends WikiRunner { } 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; diff --git a/runners/wikiEclipse/index.ts b/runners/wikiEclipse/index.ts index 6dba7649..151e0c9f 100644 --- a/runners/wikiEclipse/index.ts +++ b/runners/wikiEclipse/index.ts @@ -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; @@ -48,7 +48,7 @@ export class WikiEclipse extends WikiRunner { } supports(name: string, parameters: any[]): boolean { - return this.getVariable(this.installedTools).includes("eclipse") + return this.getVariable(this.INSTALLED_TOOLS).includes("eclipse") ? super.supports(name, parameters) : false; } diff --git a/runners/wikiEditor/index.ts b/runners/wikiEditor/index.ts index 73a3fb11..01d2b8f3 100644 --- a/runners/wikiEditor/index.ts +++ b/runners/wikiEditor/index.ts @@ -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; diff --git a/runners/wikiVsCode/index.ts b/runners/wikiVsCode/index.ts index 0b5f35de..eb83f4d6 100644 --- a/runners/wikiVsCode/index.ts +++ b/runners/wikiVsCode/index.ts @@ -16,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; @@ -49,7 +49,7 @@ export class WikiVsCode extends WikiRunner { } supports(name: string, parameters: any[]): boolean { - return this.getVariable(this.installedTools).includes("vscode") + return this.getVariable(this.INSTALLED_TOOLS).includes("vscode") ? super.supports(name, parameters) : false; } From 41cb91fec2be354fa17cb688561b4fcae6ec8c4d Mon Sep 17 00:00:00 2001 From: EduardKrieger Date: Fri, 14 May 2021 13:23:13 +0200 Subject: [PATCH 08/23] const var changed to uppercase --- runners/katacoda/index.ts | 2 +- runners/wikiConsole/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/runners/katacoda/index.ts b/runners/katacoda/index.ts index a1ec4ff8..d3d4396f 100644 --- a/runners/katacoda/index.ts +++ b/runners/katacoda/index.ts @@ -403,7 +403,7 @@ export class Katacoda extends Runner { runChangeWorkspace(runCommand: RunCommand): RunResult { let workspacesDir = path.join('/root', runCommand.command.parameters[0]); - this.setVariable(this.workspaceDirectory, workspacesDir); + this.setVariable(this.WORKSPACE_DIRECTORY, workspacesDir); this.pushStep(runCommand); return null; } diff --git a/runners/wikiConsole/index.ts b/runners/wikiConsole/index.ts index d8476312..21f6f615 100644 --- a/runners/wikiConsole/index.ts +++ b/runners/wikiConsole/index.ts @@ -109,7 +109,7 @@ 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; } From 40d5e64f150a61cd259fd80c98b9f30b8c388dd9 Mon Sep 17 00:00:00 2001 From: EduardKrieger Date: Wed, 19 May 2021 10:57:52 +0200 Subject: [PATCH 09/23] chenaged asciidoc --- runners/wikiConsole/templates/installCobiGen.asciidoc | 2 +- runners/wikiVsCode/templates/installCobiGen.asciidoc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/runners/wikiConsole/templates/installCobiGen.asciidoc b/runners/wikiConsole/templates/installCobiGen.asciidoc index 677e8934..360a148e 100644 --- a/runners/wikiConsole/templates/installCobiGen.asciidoc +++ b/runners/wikiConsole/templates/installCobiGen.asciidoc @@ -2,7 +2,7 @@ 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. +* 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 diff --git a/runners/wikiVsCode/templates/installCobiGen.asciidoc b/runners/wikiVsCode/templates/installCobiGen.asciidoc index 2024b50c..9d86efc3 100644 --- a/runners/wikiVsCode/templates/installCobiGen.asciidoc +++ b/runners/wikiVsCode/templates/installCobiGen.asciidoc @@ -5,7 +5,7 @@ Installing devonfw code generator (i.e. CobiGen). * 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 https://github.com/devonfw-forge/cobigen-vscode-plugin/releases/download/0.0.1/cobigen-plugin-0.0.1.vsix[here] or execute this command in PowerShell or Terminal. +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 From b3c9bccf8bf41af76a3770f7cc908882ac026029 Mon Sep 17 00:00:00 2001 From: EduardKrieger Date: Fri, 21 May 2021 16:08:01 +0200 Subject: [PATCH 10/23] changed Path usage --- runners/console/index.ts | 2 +- runners/katacoda/index.ts | 4 ++-- runners/wikiConsole/index.ts | 3 ++- runners/wikiEclipse/templates/installCobigen.asciidoc | 2 +- runners/wikiVsCode/index.ts | 2 +- runners/wikiVsCode/templates/installCobiGen.asciidoc | 4 ++-- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/runners/console/index.ts b/runners/console/index.ts index 467c20fe..d566fe51 100644 --- a/runners/console/index.ts +++ b/runners/console/index.ts @@ -816,7 +816,7 @@ export class Console extends Runner { new Assertions() .noErrorCode(result) .noException(result) - .fileExits(path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0])); + .fileExits(path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0])); } catch(error) { await this.cleanUp(); diff --git a/runners/katacoda/index.ts b/runners/katacoda/index.ts index d7e78f84..ca0ebe27 100644 --- a/runners/katacoda/index.ts +++ b/runners/katacoda/index.ts @@ -214,7 +214,7 @@ export class Katacoda extends Runner { runChangeFile(runCommand: RunCommand): RunResult{ let workspaceDir = path.join(this.getVariable(this.WORKSPACE_DIRECTORY).concat(path.sep).replace(path.sep + "root" + path.sep, "")); let fileName = path.basename(path.join(runCommand.command.parameters[0])); - let fileDir = path.relative('/root', path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0])).replace(/\\/g, "/"); + let fileDir = path.relative('/root', path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0])).replace(/\\/g, "/"); let placeholder = runCommand.command.parameters[1].placeholder ? runCommand.command.parameters[1].placeholder : ""; let dataTarget = runCommand.command.parameters[1].placeholder ? "insert" : "replace"; let content = ""; @@ -424,7 +424,7 @@ export class Katacoda extends Runner { runOpenFile(runCommand: RunCommand): RunResult { let fileName = path.basename(runCommand.command.parameters[0]); - let filePath = path.relative('/root', path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0])).replace(/\\/g, "/"); + let filePath = path.relative('/root', path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0])).replace(/\\/g, "/"); this.pushStep(runCommand, "Open " + fileName, "step" + runCommand.stepIndex + ".md"); diff --git a/runners/wikiConsole/index.ts b/runners/wikiConsole/index.ts index 21f6f615..e501e21a 100644 --- a/runners/wikiConsole/index.ts +++ b/runners/wikiConsole/index.ts @@ -3,6 +3,7 @@ import { RunCommand } from "../../engine/run_command"; import { RunResult } from "../../engine/run_result"; import { WikiRunner } from "../../engine/wikiRunner"; import * as path from "path"; +import { Console } from "console"; export class WikiConsole extends WikiRunner { @@ -122,7 +123,7 @@ export class WikiConsole extends WikiRunner { } runInstallCobiGen(runCommand: RunCommand): RunResult{ - let devonPath = this.getWorkingDirectory(); + 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; } diff --git a/runners/wikiEclipse/templates/installCobigen.asciidoc b/runners/wikiEclipse/templates/installCobigen.asciidoc index a53da028..42cb72f7 100644 --- a/runners/wikiEclipse/templates/installCobigen.asciidoc +++ b/runners/wikiEclipse/templates/installCobigen.asciidoc @@ -7,6 +7,6 @@ Installing devonfw code generator (i.e. CobiGen). === 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. +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]. \ No newline at end of file diff --git a/runners/wikiVsCode/index.ts b/runners/wikiVsCode/index.ts index eb83f4d6..a647a331 100644 --- a/runners/wikiVsCode/index.ts +++ b/runners/wikiVsCode/index.ts @@ -43,7 +43,7 @@ export class WikiVsCode extends WikiRunner { } runInstallCobiGen(runCommand: RunCommand): RunResult{ - let dir = this.getWorkingDirectory(); + 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; } diff --git a/runners/wikiVsCode/templates/installCobiGen.asciidoc b/runners/wikiVsCode/templates/installCobiGen.asciidoc index 9d86efc3..43eb77cb 100644 --- a/runners/wikiVsCode/templates/installCobiGen.asciidoc +++ b/runners/wikiVsCode/templates/installCobiGen.asciidoc @@ -12,9 +12,9 @@ First, download the VS Code extension file. You can download it from https://git . 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 <%= dir;%>` +`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. +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]. From 0582c6ed1d404a97d11bf43bccdd9667e4738137 Mon Sep 17 00:00:00 2001 From: EduardKrieger Date: Wed, 26 May 2021 15:04:34 +0200 Subject: [PATCH 11/23] rebase --- engine/wikiRunner.ts | 2 ++ runners/wikiConsole/index.ts | 7 +++++++ .../wikiConsole/templates/installCobiGen.asciidoc | 14 ++++++++++++++ .../templates/installDevonfwIde.asciidoc | 5 ++++- runners/wikiEclipse/index.ts | 12 ++++++++++++ .../wikiEclipse/templates/installCobigen.asciidoc | 12 ++++++++++++ runners/wikiVsCode/index.ts | 13 +++++++++++++ .../wikiVsCode/templates/installCobiGen.asciidoc | 13 +++++++++++++ 8 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 runners/wikiConsole/templates/installCobiGen.asciidoc create mode 100644 runners/wikiEclipse/templates/installCobigen.asciidoc create mode 100644 runners/wikiVsCode/templates/installCobiGen.asciidoc diff --git a/engine/wikiRunner.ts b/engine/wikiRunner.ts index cc132c1b..23b5ccbf 100644 --- a/engine/wikiRunner.ts +++ b/engine/wikiRunner.ts @@ -7,11 +7,13 @@ import * as ejs from "ejs"; export abstract class WikiRunner extends Runner { public outputPathTutorial: string; + protected readonly installedTools: 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.installedTools, ""); } async destroy(playbook: Playbook): Promise { diff --git a/runners/wikiConsole/index.ts b/runners/wikiConsole/index.ts index 53a3dd9c..de87f0fe 100644 --- a/runners/wikiConsole/index.ts +++ b/runners/wikiConsole/index.ts @@ -27,6 +27,7 @@ export class WikiConsole extends WikiRunner { } 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.installedTools, tools); return null; } @@ -76,6 +77,7 @@ export class WikiConsole extends WikiRunner { }; this.renderWiki(path.join(this.getRunnerDirectory(), "templates", "npmInstall.asciidoc"), { projectPath: projectPath, npmCommand: npmCommand }); + // add NPM tools return null; } @@ -125,5 +127,10 @@ export class WikiConsole extends WikiRunner { this.renderWiki(path.join(this.getRunnerDirectory(), "templates", "createDevon4jProject.asciidoc"), { name: runCommand.command.parameters[0] }); return null; } + runInstallCobiGen(runCommand: RunCommand): RunResult{ + let devonPath = this.getWorkingDirectory(); + this.renderWiki(path.join(this.getRunnerDirectory(), "templates", "installCobiGen.asciidoc"), {devonPath: devonPath}); + return null; + } } diff --git a/runners/wikiConsole/templates/installCobiGen.asciidoc b/runners/wikiConsole/templates/installCobiGen.asciidoc new file mode 100644 index 00000000..a93948f6 --- /dev/null +++ b/runners/wikiConsole/templates/installCobiGen.asciidoc @@ -0,0 +1,14 @@ +== Install GobiGen +Installing devonfw CodeGenerator(i.e. CobiGen). + +=== Prerequisites +CobiGen CLI is installed inside your devonfw distribution. In order to execute it, you have to install the devonfw IDE first. + +=== 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 conigen` 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]. diff --git a/runners/wikiConsole/templates/installDevonfwIde.asciidoc b/runners/wikiConsole/templates/installDevonfwIde.asciidoc index 90e38c17..4c4d8df3 100644 --- a/runners/wikiConsole/templates/installDevonfwIde.asciidoc +++ b/runners/wikiConsole/templates/installDevonfwIde.asciidoc @@ -45,6 +45,9 @@ Start the setup process by executing `.\setup 'path/to/settings'` (Windows) or ` You can also just execute `.\setup` (Windows) or `bash setup` (Linux) and press Enter when the setup assistent asks for the URL to the settings repository. This will also download the default settings and install the default tools within the devonfw IDE. +<<<<<<< HEAD <% 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'. -<% } %> \ No newline at end of file +<% } %> +======= +>>>>>>> 2215026 (added supports for eclipse and vscode wiki runner) diff --git a/runners/wikiEclipse/index.ts b/runners/wikiEclipse/index.ts index ee0390e6..90eac1ed 100644 --- a/runners/wikiEclipse/index.ts +++ b/runners/wikiEclipse/index.ts @@ -45,4 +45,16 @@ export class WikiEclipse extends WikiRunner { this.renderWiki(path.join(this.getRunnerDirectory(), "templates", "createDevon4jProject.asciidoc"), { name: runCommand.command.parameters[0]}); 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.installedTools).includes("eclipse") + ? super.supports(name, parameters) + : false; + } } \ No newline at end of file diff --git a/runners/wikiEclipse/templates/installCobigen.asciidoc b/runners/wikiEclipse/templates/installCobigen.asciidoc new file mode 100644 index 00000000..bc37ac4e --- /dev/null +++ b/runners/wikiEclipse/templates/installCobigen.asciidoc @@ -0,0 +1,12 @@ +== Install GobiGen +Installing devonfw CodeGenerator(i.e. CobiGen). + +=== Prerequisites +CobiGen Eclipse plugin is installed inside your devonfw distribution. In order to execute it, you have to install the devonfw IDE first. + +=== 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]. \ No newline at end of file diff --git a/runners/wikiVsCode/index.ts b/runners/wikiVsCode/index.ts index 6544093d..28a04a84 100644 --- a/runners/wikiVsCode/index.ts +++ b/runners/wikiVsCode/index.ts @@ -6,6 +6,7 @@ import * as path from "path"; export class WikiVsCode extends WikiRunner { + init(playbook: Playbook): void { super.init(playbook); } @@ -40,4 +41,16 @@ export class WikiVsCode 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.installedTools).includes("vscode") + ? super.supports(name, parameters) + : false; + } + } \ No newline at end of file diff --git a/runners/wikiVsCode/templates/installCobiGen.asciidoc b/runners/wikiVsCode/templates/installCobiGen.asciidoc new file mode 100644 index 00000000..8df05b8b --- /dev/null +++ b/runners/wikiVsCode/templates/installCobiGen.asciidoc @@ -0,0 +1,13 @@ +== Install GobiGen +Installing devonfw CodeGenerator(i.e. CobiGen). + +=== Prerequisites +CobiGen VSCode extension is installed inside your devonfw distribution. In order to execute it, you have to install the devonfw IDE first. + +=== Install CobiGen for VSCode Editor + +CobiGen is already installed for your VSCode Editor if you have installed it with the devonfw setup. +You can open the *Extensions* menu with ctrl+shift+X and you will see CobiGen under the installed extensions. +You can use CobiGen by right-click on a file and selecting CobiGen in the opened menu. This will execute CobiGen generate 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]. From 11eb4f0bd0fec069337eadee77d39e7667b8154b Mon Sep 17 00:00:00 2001 From: EduardKrieger Date: Sun, 9 May 2021 16:17:01 +0200 Subject: [PATCH 12/23] removed unnecessary comments --- runners/wikiConsole/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/runners/wikiConsole/index.ts b/runners/wikiConsole/index.ts index de87f0fe..1a8cb5fb 100644 --- a/runners/wikiConsole/index.ts +++ b/runners/wikiConsole/index.ts @@ -77,7 +77,6 @@ export class WikiConsole extends WikiRunner { }; this.renderWiki(path.join(this.getRunnerDirectory(), "templates", "npmInstall.asciidoc"), { projectPath: projectPath, npmCommand: npmCommand }); - // add NPM tools return null; } From b0bb16ec68a65c73161dff696da279bb6409ff3a Mon Sep 17 00:00:00 2001 From: EduardKrieger Date: Sun, 9 May 2021 18:19:45 +0200 Subject: [PATCH 13/23] asciidoc template changes --- runners/wikiConsole/templates/installCobiGen.asciidoc | 2 +- runners/wikiEclipse/templates/installCobigen.asciidoc | 2 +- runners/wikiVsCode/templates/installCobiGen.asciidoc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/runners/wikiConsole/templates/installCobiGen.asciidoc b/runners/wikiConsole/templates/installCobiGen.asciidoc index a93948f6..ac16fbee 100644 --- a/runners/wikiConsole/templates/installCobiGen.asciidoc +++ b/runners/wikiConsole/templates/installCobiGen.asciidoc @@ -2,7 +2,7 @@ Installing devonfw CodeGenerator(i.e. CobiGen). === Prerequisites -CobiGen CLI is installed inside your devonfw distribution. In order to execute it, you have to install the devonfw IDE first. +CobiGen CLI is installed inside 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 with a command prompt diff --git a/runners/wikiEclipse/templates/installCobigen.asciidoc b/runners/wikiEclipse/templates/installCobigen.asciidoc index bc37ac4e..e8b829f3 100644 --- a/runners/wikiEclipse/templates/installCobigen.asciidoc +++ b/runners/wikiEclipse/templates/installCobigen.asciidoc @@ -2,7 +2,7 @@ Installing devonfw CodeGenerator(i.e. CobiGen). === Prerequisites -CobiGen Eclipse plugin is installed inside your devonfw distribution. In order to execute it, you have to install the devonfw IDE first. +CobiGen Eclipse plugin is installed inside 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 diff --git a/runners/wikiVsCode/templates/installCobiGen.asciidoc b/runners/wikiVsCode/templates/installCobiGen.asciidoc index 8df05b8b..352887c7 100644 --- a/runners/wikiVsCode/templates/installCobiGen.asciidoc +++ b/runners/wikiVsCode/templates/installCobiGen.asciidoc @@ -2,7 +2,7 @@ Installing devonfw CodeGenerator(i.e. CobiGen). === Prerequisites -CobiGen VSCode extension is installed inside your devonfw distribution. In order to execute it, you have to install the devonfw IDE first. +CobiGen VSCode extension is installed inside 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 VSCode Editor From a37cf275faa9bbaaa63cbc057ed54012ef4d3c29 Mon Sep 17 00:00:00 2001 From: EduardKrieger Date: Wed, 12 May 2021 16:37:37 +0200 Subject: [PATCH 14/23] fixed spelling --- .../templates/installCobiGen.asciidoc | 10 +++++----- .../templates/installCobigen.asciidoc | 2 +- runners/wikiVsCode/index.ts | 3 ++- .../templates/installCobiGen.asciidoc | 19 +++++++++++++------ 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/runners/wikiConsole/templates/installCobiGen.asciidoc b/runners/wikiConsole/templates/installCobiGen.asciidoc index ac16fbee..8b98949d 100644 --- a/runners/wikiConsole/templates/installCobiGen.asciidoc +++ b/runners/wikiConsole/templates/installCobiGen.asciidoc @@ -1,14 +1,14 @@ == Install GobiGen -Installing devonfw CodeGenerator(i.e. CobiGen). +Installing devonfw code generator (i.e. CobiGen). === Prerequisites CobiGen CLI is installed inside 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 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 conigen` and CobiGen will be installed. -To update the environment you have to execute `devon` and you have successfully installed CobiGen. +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]. diff --git a/runners/wikiEclipse/templates/installCobigen.asciidoc b/runners/wikiEclipse/templates/installCobigen.asciidoc index e8b829f3..931ae81b 100644 --- a/runners/wikiEclipse/templates/installCobigen.asciidoc +++ b/runners/wikiEclipse/templates/installCobigen.asciidoc @@ -1,5 +1,5 @@ == Install GobiGen -Installing devonfw CodeGenerator(i.e. CobiGen). +Installing devonfw code generator (i.e. CobiGen). === Prerequisites CobiGen Eclipse plugin is installed inside 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. diff --git a/runners/wikiVsCode/index.ts b/runners/wikiVsCode/index.ts index 28a04a84..0b5f35de 100644 --- a/runners/wikiVsCode/index.ts +++ b/runners/wikiVsCode/index.ts @@ -43,7 +43,8 @@ export class WikiVsCode extends WikiRunner { } runInstallCobiGen(runCommand: RunCommand): RunResult{ - this.renderWiki(path.join(this.getRunnerDirectory(), "templates", "installCobiGen.asciidoc"), {}); + let dir = this.getWorkingDirectory(); + this.renderWiki(path.join(this.getRunnerDirectory(), "templates", "installCobiGen.asciidoc"), {dir: dir}); return null; } diff --git a/runners/wikiVsCode/templates/installCobiGen.asciidoc b/runners/wikiVsCode/templates/installCobiGen.asciidoc index 352887c7..ec6c4102 100644 --- a/runners/wikiVsCode/templates/installCobiGen.asciidoc +++ b/runners/wikiVsCode/templates/installCobiGen.asciidoc @@ -1,13 +1,20 @@ == Install GobiGen -Installing devonfw CodeGenerator(i.e. CobiGen). +Installing devonfw code generator (i.e. CobiGen). === Prerequisites -CobiGen VSCode extension is installed inside 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. +To install CobiGen VS Code extension 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-ide] documentation to install the missing ones. -=== Install CobiGen for VSCode Editor +=== Install CobiGen for VS Code Editor +First, download the VS Code extension file. You can download it https://github.com/devonfw-forge/cobigen-vscode-plugin/releases/download/0.0.1/cobigen-plugin-0.0.1.vsix[here] or execute this command in PowerShell or Terminal. -CobiGen is already installed for your VSCode Editor if you have installed it with the devonfw setup. -You can open the *Extensions* menu with ctrl+shift+X and you will see CobiGen under the installed extensions. -You can use CobiGen by right-click on a file and selecting CobiGen in the opened menu. This will execute CobiGen generate for the selected file. + +.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 <%= 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. +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]. From ee0915018cf257719addcea68dfa0d8518eac545 Mon Sep 17 00:00:00 2001 From: EduardKrieger Date: Wed, 12 May 2021 16:44:41 +0200 Subject: [PATCH 15/23] fixed spelling --- runners/wikiVsCode/templates/installCobiGen.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runners/wikiVsCode/templates/installCobiGen.asciidoc b/runners/wikiVsCode/templates/installCobiGen.asciidoc index ec6c4102..3a81be72 100644 --- a/runners/wikiVsCode/templates/installCobiGen.asciidoc +++ b/runners/wikiVsCode/templates/installCobiGen.asciidoc @@ -2,7 +2,7 @@ Installing devonfw code generator (i.e. CobiGen). === Prerequisites -To install CobiGen VS Code extension 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-ide] documentation to install the missing ones. +To install CobiGen VS Code extension 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 IDE] documentation to install the missing ones. === Install CobiGen for VS Code Editor First, download the VS Code extension file. You can download it https://github.com/devonfw-forge/cobigen-vscode-plugin/releases/download/0.0.1/cobigen-plugin-0.0.1.vsix[here] or execute this command in PowerShell or Terminal. From 17298e9f1e78ac5ac93f09c1b882dab85a264fc0 Mon Sep 17 00:00:00 2001 From: EduardKrieger Date: Wed, 12 May 2021 17:54:45 +0200 Subject: [PATCH 16/23] changed Prerequisites --- runners/wikiConsole/templates/installCobiGen.asciidoc | 2 +- runners/wikiEclipse/templates/installCobigen.asciidoc | 2 +- runners/wikiVsCode/templates/installCobiGen.asciidoc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/runners/wikiConsole/templates/installCobiGen.asciidoc b/runners/wikiConsole/templates/installCobiGen.asciidoc index 8b98949d..677e8934 100644 --- a/runners/wikiConsole/templates/installCobiGen.asciidoc +++ b/runners/wikiConsole/templates/installCobiGen.asciidoc @@ -2,7 +2,7 @@ Installing devonfw code generator (i.e. CobiGen). === Prerequisites -CobiGen CLI is installed inside 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. +* 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 diff --git a/runners/wikiEclipse/templates/installCobigen.asciidoc b/runners/wikiEclipse/templates/installCobigen.asciidoc index 931ae81b..a53da028 100644 --- a/runners/wikiEclipse/templates/installCobigen.asciidoc +++ b/runners/wikiEclipse/templates/installCobigen.asciidoc @@ -2,7 +2,7 @@ Installing devonfw code generator (i.e. CobiGen). === Prerequisites -CobiGen Eclipse plugin is installed inside 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. +* 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 diff --git a/runners/wikiVsCode/templates/installCobiGen.asciidoc b/runners/wikiVsCode/templates/installCobiGen.asciidoc index 3a81be72..2024b50c 100644 --- a/runners/wikiVsCode/templates/installCobiGen.asciidoc +++ b/runners/wikiVsCode/templates/installCobiGen.asciidoc @@ -2,7 +2,7 @@ Installing devonfw code generator (i.e. CobiGen). === Prerequisites -To install CobiGen VS Code extension 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 IDE] documentation to install the missing ones. +* 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 https://github.com/devonfw-forge/cobigen-vscode-plugin/releases/download/0.0.1/cobigen-plugin-0.0.1.vsix[here] or execute this command in PowerShell or Terminal. From 2698d4084b9b4323f4c8df9a5050b07dbec4978e Mon Sep 17 00:00:00 2001 From: EduardKrieger Date: Wed, 26 May 2021 15:08:52 +0200 Subject: [PATCH 17/23] rebase --- engine/runner.ts | 6 +-- engine/wikiRunner.ts | 6 +-- runners/console/index.ts | 90 ++++++++++++++++++------------------ runners/katacoda/index.ts | 58 +++++++++++------------ runners/vscode/index.ts | 2 +- runners/wikiConsole/index.ts | 21 +++++---- runners/wikiEclipse/index.ts | 4 +- runners/wikiEditor/index.ts | 2 +- runners/wikiVsCode/index.ts | 4 +- 9 files changed, 97 insertions(+), 96 deletions(-) diff --git a/engine/runner.ts b/engine/runner.ts index 2e49f325..9c7d98c6 100644 --- a/engine/runner.ts +++ b/engine/runner.ts @@ -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) { @@ -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 { diff --git a/engine/wikiRunner.ts b/engine/wikiRunner.ts index 23b5ccbf..e7cd1b21 100644 --- a/engine/wikiRunner.ts +++ b/engine/wikiRunner.ts @@ -7,13 +7,13 @@ import * as ejs from "ejs"; export abstract class WikiRunner extends Runner { public outputPathTutorial: string; - protected readonly installedTools: string = "installedTools"; + 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.installedTools, ""); + this.setVariable(this.WORKSPACE_DIRECTORY, path.join(this.getWorkingDirectory())); + this.setVariable(this.INSTALLED_TOOLS, ""); } async destroy(playbook: Playbook): Promise { diff --git a/runners/console/index.ts b/runners/console/index.ts index aa6ec3b4..10cbcd93 100644 --- a/runners/console/index.ts +++ b/runners/console/index.ts @@ -32,7 +32,7 @@ export class Console extends Runner { ConsoleUtils.createBackupDevonDirectory(); this.createFolder(path.normalize(this.getWorkingDirectory()), true); - this.setVariable(this.workspaceDirectory, path.join(this.getWorkingDirectory())); + this.setVariable(this.WORKSPACE_DIRECTORY, path.join(this.getWorkingDirectory())); this.env = process.env; } @@ -87,8 +87,8 @@ export class Console extends Runner { ConsoleUtils.executeCommandSync("bash setup --batch " + path.join(settingsDir, "settings.git").replace(/\\/g, "/"), installDir, result, this.env); } - this.setVariable(this.workspaceDirectory, path.join(this.getWorkingDirectory(), "devonfw", "workspaces", "main")); - this.setVariable(this.useDevonCommand, true); + this.setVariable(this.WORKSPACE_DIRECTORY, path.join(this.getWorkingDirectory(), "devonfw", "workspaces", "main")); + this.setVariable(this.USE_DEVON_COMMAND, true); return result; } @@ -106,7 +106,7 @@ export class Console extends Runner { ? runCommand.command.parameters[0].workspace : this.playbookName.replace("/", "").replace(" ","-")); - let workspacesDir = this.getVariable(this.useDevonCommand) + let workspacesDir = this.getVariable(this.USE_DEVON_COMMAND) ? path.join(this.getWorkingDirectory(), "devonfw", "workspaces") : path.join(this.getWorkingDirectory(), 'workspaces'); @@ -142,8 +142,8 @@ export class Console extends Runner { ConsoleUtils.executeCommandSync("git clone https://github.com/devonfw-tutorials/" + workspacesName + ".git .", workspacesDir, result, this.env); } - if(!this.getVariable(this.useDevonCommand)){ - this.setVariable(this.workspaceDirectory, path.join(this.getWorkingDirectory(), 'workspaces')); + if(!this.getVariable(this.USE_DEVON_COMMAND)){ + this.setVariable(this.WORKSPACE_DIRECTORY, path.join(this.getWorkingDirectory(), 'workspaces')); } return result; @@ -154,7 +154,7 @@ export class Console extends Runner { let result = new RunResult(); result.returnCode = 0; - if(!this.getVariable(this.useDevonCommand)){ + if(!this.getVariable(this.USE_DEVON_COMMAND)){ console.warn("Devonfw IDE is not installed"); } @@ -166,7 +166,7 @@ export class Console extends Runner { let result = new RunResult(); result.returnCode = 0; - if(!this.getVariable(this.useDevonCommand)){ + if(!this.getVariable(this.USE_DEVON_COMMAND)){ console.warn("Devonfw IDE is not installed"); } @@ -180,7 +180,7 @@ export class Console 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]); if(!fs.existsSync(filepath.substr(0, filepath.lastIndexOf(path.sep)))) { fs.mkdirSync(filepath.substr(0, filepath.lastIndexOf(path.sep)), { recursive: true }); } @@ -199,12 +199,12 @@ export class Console extends Runner { let result = new RunResult(); result.returnCode = 0; - let projectDir = path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0]); + let projectDir = path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0]); let buildCommand = (runCommand.command.parameters.length == 2 && runCommand.command.parameters[1] == true) ? "mvn clean install" : "mvn clean install -Dmaven.test.skip=true"; - this.getVariable(this.useDevonCommand) + this.getVariable(this.USE_DEVON_COMMAND) ? ConsoleUtils.executeDevonCommandSync(buildCommand, projectDir, path.join(this.getWorkingDirectory(), "devonfw"), result, this.env) : ConsoleUtils.executeCommandSync(buildCommand, projectDir, result, this.env); @@ -215,7 +215,7 @@ export class Console extends Runner { let result = new RunResult(); result.returnCode = 0; - if(!this.getVariable(this.useDevonCommand)){ + if(!this.getVariable(this.USE_DEVON_COMMAND)){ console.warn("Devonfw IDE is not installed"); } @@ -228,7 +228,7 @@ export class Console 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 content = fs.readFileSync(filepath, { encoding: "utf-8" }); if(runCommand.command.parameters[1].placeholder) { @@ -276,7 +276,7 @@ export class Console 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]); if(runCommand.command.parameters.length == 2 && runCommand.command.parameters[1].port){ let process = ConsoleUtils.executeCommandAsync("docker-compose up", filepath, result, this.env); process.on('close', (code) => { @@ -299,9 +299,9 @@ export class Console extends Runner { let result = new RunResult(); result.returnCode = 0; - let serverDir = path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0]); + let serverDir = path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0]); if(runCommand.command.parameters.length == 2 && runCommand.command.parameters[1].port){ - let process = (this.getVariable(this.useDevonCommand)) + let process = (this.getVariable(this.USE_DEVON_COMMAND)) ? ConsoleUtils.executeDevonCommandAsync("mvn spring-boot:run", serverDir, path.join(this.getWorkingDirectory(), "devonfw"), result, this.env) : ConsoleUtils.executeCommandAsync("mvn spring-boot:run", serverDir, result, this.env); @@ -320,7 +320,7 @@ export class Console extends Runner { let result = new RunResult(); result.returnCode = 0; - 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]); if(runCommand.command.parameters[0] != "") { this.createFolder(directorypath, true); } @@ -333,14 +333,14 @@ export class Console extends Runner { let result = new RunResult(); result.returnCode = 0; - 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 = "npm install"; if(runCommand.command.parameters.length > 1){ if (runCommand.command.parameters[1].global) npmCommand += " -g"; if (runCommand.command.parameters[1].args) npmCommand += " " + runCommand.command.parameters[1].args.join(" "); if (runCommand.command.parameters[1].name) npmCommand += " " + runCommand.command.parameters[1].name; } - this.getVariable(this.useDevonCommand) + this.getVariable(this.USE_DEVON_COMMAND) ? ConsoleUtils.executeDevonCommandSync(npmCommand, projectPath, path.join(this.getWorkingDirectory(), "devonfw"), result, this.env) : ConsoleUtils.executeCommandSync(npmCommand, projectPath, result, this.env); @@ -351,7 +351,7 @@ export class Console extends Runner { let result = new RunResult(); result.returnCode = 0; - let downloadlDir = this.getVariable(this.workspaceDirectory); + let downloadlDir = this.getVariable(this.WORKSPACE_DIRECTORY); if (runCommand.command.parameters.length == 3) { downloadlDir = path.join(downloadlDir, runCommand.command.parameters[2]); this.createFolder(downloadlDir, false); @@ -368,9 +368,9 @@ export class Console extends Runner { let result = new RunResult(); result.returnCode = 0; - let projectDir = path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0]); + let projectDir = path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0]); if(runCommand.command.parameters.length == 2 && runCommand.command.parameters[1].port){ - let process = this.getVariable(this.useDevonCommand) + let process = this.getVariable(this.USE_DEVON_COMMAND) ? ConsoleUtils.executeDevonCommandAsync("ng serve", projectDir, path.join(this.getWorkingDirectory(), "devonfw"), result, this.env) : ConsoleUtils.executeCommandAsync("ng serve", projectDir, result, this.env); if(process.pid) { @@ -387,12 +387,12 @@ export class Console extends Runner { let result = new RunResult(); result.returnCode = 0; - let projectDir = path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0]); + let projectDir = path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0]); let command1 = "ng build"; if(runCommand.command.parameters.length == 2) { command1 = command1 + " --output-path " + runCommand.command.parameters[1]; } - this.getVariable(this.useDevonCommand) + this.getVariable(this.USE_DEVON_COMMAND) ? ConsoleUtils.executeDevonCommandSync(command1, projectDir, path.join(this.getWorkingDirectory(), "devonfw"), result, this.env) : ConsoleUtils.executeCommandSync(command1, projectDir, result, this.env); @@ -403,7 +403,7 @@ export class Console extends Runner { let result = new RunResult(); result.returnCode = 0; - 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]); if(folderPath && !fs.existsSync(folderPath)) { this.createFolder(folderPath, true); } @@ -420,7 +420,7 @@ export class Console extends Runner { let result = new RunResult(); result.returnCode = 0; - if(!this.getVariable(this.useDevonCommand)){ + if(!this.getVariable(this.USE_DEVON_COMMAND)){ console.warn("Devonfw IDE is not installed"); } ConsoleUtils.executeDevonCommandSync("cobigen adapt-templates",path.join(this.getWorkingDirectory(), "devonfw"), path.join(this.getWorkingDirectory(), "devonfw"), result, this.env); @@ -431,9 +431,9 @@ export class Console extends Runner { let result = new RunResult(); result.returnCode = 0; - let projectDir = path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[1]); + let projectDir = path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[1]); let params = runCommand.command.parameters.length > 2 && (runCommand.command.parameters[2] instanceof Array) ? (" " + runCommand.command.parameters[2].join(" ")) : ""; - this.getVariable(this.useDevonCommand) + this.getVariable(this.USE_DEVON_COMMAND) ? ConsoleUtils.executeDevonCommandSync("ng create " + runCommand.command.parameters[0] + params, projectDir, path.join(this.getWorkingDirectory(), "devonfw"), result, this.env) : ConsoleUtils.executeCommandSync("ng new " + runCommand.command.parameters[0] + params, projectDir, result, this.env); @@ -447,7 +447,7 @@ export class Console extends Runner { let workspacesDir = path.join(this.getWorkingDirectory(), runCommand.command.parameters[0]); if(!fs.existsSync(workspacesDir)) fs.mkdirSync(workspacesDir); - this.setVariable(this.workspaceDirectory, workspacesDir); + this.setVariable(this.WORKSPACE_DIRECTORY, workspacesDir); return result; } @@ -460,7 +460,7 @@ export class Console extends Runner { ? "powershell.exe " + path.join(this.playbookPath, runCommand.command.parameters[1]) : "bash " + path.join(this.playbookPath, runCommand.command.parameters[0]); - ConsoleUtils.executeCommandSync(scriptCommand, this.getVariable(this.workspaceDirectory), result, this.env); + ConsoleUtils.executeCommandSync(scriptCommand, this.getVariable(this.WORKSPACE_DIRECTORY), result, this.env); return result; } @@ -497,9 +497,9 @@ export class Console extends Runner { } async assertRestoreWorkspace(runCommand: RunCommand, result: RunResult) { - let workspacesDir = this.getVariable(this.useDevonCommand) + let workspacesDir = this.getVariable(this.USE_DEVON_COMMAND) ? path.join(this.getWorkingDirectory(), "devonfw", "workspaces") - : this.getVariable(this.workspaceDirectory); + : this.getVariable(this.WORKSPACE_DIRECTORY); try{ new Assertions() @@ -532,9 +532,9 @@ export class Console extends Runner { new Assertions() .noErrorCode(result) .noException(result) - .directoryExits(path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0], "api", "target")) - .directoryExits(path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0], "core", "target")) - .directoryExits(path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0], "server", "target")); + .directoryExits(path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0], "api", "target")) + .directoryExits(path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0], "core", "target")) + .directoryExits(path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0], "server", "target")); } catch(error) { await this.cleanUp(); throw error; @@ -579,7 +579,7 @@ export class Console extends Runner { new Assertions() .noErrorCode(result) .noException(result) - .fileExits(path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0])); + .fileExits(path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0])); } catch(error) { await this.cleanUp(); throw error; @@ -595,7 +595,7 @@ export class Console extends Runner { content = fs.readFileSync(path.join(this.playbookPath, runCommand.command.parameters[1].file), { encoding: "utf-8" }); } - 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]); new Assertions() .noErrorCode(result) .noException(result) @@ -653,13 +653,13 @@ export class Console extends Runner { try { let repository = runCommand.command.parameters[1]; let repoName = repository.slice(repository.lastIndexOf("/"), -4); - let directorypath = path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0], repoName); + let directorypath = path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0], repoName); new Assertions() .noErrorCode(result) .noException(result) - .directoryExits(path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0], repoName)) - .directoryNotEmpty(path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0], repoName)) + .directoryExits(path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0], repoName)) + .directoryNotEmpty(path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0], repoName)) .repositoryIsClean(directorypath); } catch(error) { await this.cleanUp(); @@ -669,7 +669,7 @@ export class Console extends Runner { async assertNpmInstall(runCommand: RunCommand, result: RunResult) { try { - let projectDir = path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0]); + let projectDir = path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0]); new Assertions() .noErrorCode(result) .noException(result) @@ -687,7 +687,7 @@ export class Console extends Runner { async assertDownloadFile(runCommand: RunCommand, result: RunResult){ try { - let directory = this.getVariable(this.workspaceDirectory); + let directory = this.getVariable(this.WORKSPACE_DIRECTORY); if(runCommand.command.parameters.length == 3) { directory = path.join(directory, runCommand.command.parameters[2]); } @@ -726,7 +726,7 @@ export class Console extends Runner { async assertBuildNg(runCommand: RunCommand, result: RunResult) { try { - 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]); var outputpath; if(runCommand.command.parameters.length == 2) { outputpath = runCommand.command.parameters[1].trim(); @@ -751,7 +751,7 @@ export class Console extends Runner { async assertCreateFolder(runCommand: RunCommand, result: RunResult){ try { - 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]); new Assertions() .noErrorCode(result) .noException(result) @@ -779,7 +779,7 @@ export class Console extends Runner { async assertCreateDevon4ngProject(runCommand: RunCommand, result: RunResult) { try { - let projectDir = path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[1], runCommand.command.parameters[0]); + let projectDir = path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[1], runCommand.command.parameters[0]); new Assertions() .noErrorCode(result) .noException(result) diff --git a/runners/katacoda/index.ts b/runners/katacoda/index.ts index 26e5cd2e..b8418b1b 100644 --- a/runners/katacoda/index.ts +++ b/runners/katacoda/index.ts @@ -46,7 +46,7 @@ export class Katacoda extends Runner { this.createFolder(this.setupDir, false); //set working direktory - this.setVariable(this.workspaceDirectory, path.join("/root")); + this.setVariable(this.WORKSPACE_DIRECTORY, path.join("/root")); this.assetManager = new KatacodaAssetManager(path.join(this.outputPathTutorial, "assets")); @@ -100,8 +100,8 @@ export class Katacoda extends Runner { //update current and working directory this.currentDir = path.join(this.currentDir, "devonfw"); - this.setVariable(this.workspaceDirectory, path.join("/root", "devonfw", "workspaces", "main")); - this.setVariable(this.useDevonCommand, true); + this.setVariable(this.WORKSPACE_DIRECTORY, path.join("/root", "devonfw", "workspaces", "main")); + this.setVariable(this.USE_DEVON_COMMAND, true); fs.appendFileSync(path.join(this.getRunnerDirectory(),"templates","scripts", "intro_foreground.sh"), "\nexport NG_CLI_ANALYTICS=CI"); fs.appendFileSync(path.join(this.getRunnerDirectory(),"templates","scripts", "intro_background.sh"), "\necho \'export NG_CLI_ANALYTICS=CI\' >> /root/.profile\n"); @@ -126,8 +126,8 @@ export class Katacoda extends Runner { "script": "restoreDevonfwIde.sh" }); //update working directory - this.setVariable(this.workspaceDirectory, path.join("/root", "devonfw", "workspaces", "main")); - this.setVariable(this.useDevonCommand, true); + this.setVariable(this.WORKSPACE_DIRECTORY, path.join("/root", "devonfw", "workspaces", "main")); + this.setVariable(this.USE_DEVON_COMMAND, true); fs.appendFileSync(path.join(this.getRunnerDirectory(),"templates","scripts", "intro_foreground.sh"), "\n. ~/.bashrc\nexport NG_CLI_ANALYTICS=CI"); fs.appendFileSync(path.join(this.getRunnerDirectory(),"templates","scripts", "intro_background.sh"), "\necho \'export NG_CLI_ANALYTICS=CI\' >> /root/.profile\n"); @@ -141,20 +141,20 @@ export class Katacoda extends Runner { ? runCommand.command.parameters[0].workspace : this.playbookName.replace("/", "").replace(" ","-")); - let workspacesDir = this.getVariable(this.useDevonCommand) + let workspacesDir = this.getVariable(this.USE_DEVON_COMMAND) ? path.join('/root', "devonfw", "workspaces").replace(/\\/g, "/") : path.join('/root', "workspaces").replace(/\\/g, "/"); let user = this.getVariable('user') ? this.getVariable('user') : 'devonfw-tutorials'; - this.renderTemplate(path.join("scripts", "restoreWorkspace.sh"), path.join(this.setupDir, "restoreWorkspace.sh"), {user: user, branch: this.getVariable("branch"), workspace: workspacesName, workspaceDir: workspacesDir, useDevonCommand: !!this.getVariable(this.useDevonCommand)}); + this.renderTemplate(path.join("scripts", "restoreWorkspace.sh"), path.join(this.setupDir, "restoreWorkspace.sh"), {user: user, branch: this.getVariable("branch"), workspace: workspacesName, workspaceDir: workspacesDir, USE_DEVON_COMMAND: !!this.getVariable(this.USE_DEVON_COMMAND)}); this.setupScripts.push({ "name": "Restore Workspace", "script": "restoreWorkspace.sh" }); - if(!this.getVariable(this.useDevonCommand)) - this.setVariable(this.workspaceDirectory, path.join('/root', "workspaces")); + if(!this.getVariable(this.USE_DEVON_COMMAND)) + this.setVariable(this.WORKSPACE_DIRECTORY, path.join('/root', "workspaces")); this.pushStep(runCommand); return null; @@ -197,8 +197,8 @@ export class Katacoda extends Runner { } runCreateFile(runCommand: RunCommand): RunResult{ - let workspaceDir = path.join(this.getVariable(this.workspaceDirectory).concat(path.sep).replace(path.sep + "root" + path.sep, "")); - let filePath = path.join(this.getVariable(this.workspaceDirectory), path.dirname(runCommand.command.parameters[0])).replace(/\\/g, "/"); + let workspaceDir = path.join(this.getVariable(this.WORKSPACE_DIRECTORY).concat(path.sep).replace(path.sep + "root" + path.sep, "")); + let filePath = path.join(this.getVariable(this.WORKSPACE_DIRECTORY), path.dirname(runCommand.command.parameters[0])).replace(/\\/g, "/"); let fileDir = path.join(workspaceDir, runCommand.command.parameters[0]).replace(/\\/g, "/"); let fileName = path.basename(path.join(runCommand.command.parameters[0])); let content = ""; @@ -213,7 +213,7 @@ export class Katacoda extends Runner { runChangeFile(runCommand: RunCommand): RunResult{ let fileName = path.basename(path.join(runCommand.command.parameters[0])); - let fileDir = path.relative('/root', path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0])).replace(/\\/g, "/"); + let fileDir = path.relative('/root', path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0])).replace(/\\/g, "/"); let placeholder = runCommand.command.parameters[1].placeholder ? runCommand.command.parameters[1].placeholder : ""; let dataTarget = runCommand.command.parameters[1].placeholder ? "insert" : "replace"; let content = ""; @@ -248,30 +248,30 @@ export class Katacoda extends Runner { runBuildJava(runCommand: RunCommand): RunResult{ - let cdCommand = this.changeCurrentDir(path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0])); + let cdCommand = this.changeCurrentDir(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.pushStep(runCommand, "Build the Java project", "step" + runCommand.stepIndex + ".md"); - this.renderTemplate("buildJava.md", this.outputPathTutorial + "step" + runCommand.stepIndex + ".md", { text: runCommand.text, textAfter: runCommand.textAfter, cdCommand: cdCommand, skipTest: skipTest, useDevonCommand: this.getVariable(this.useDevonCommand)}); + this.renderTemplate("buildJava.md", this.outputPathTutorial + "step" + runCommand.stepIndex + ".md", { text: runCommand.text, textAfter: runCommand.textAfter, cdCommand: cdCommand, skipTest: skipTest, USE_DEVON_COMMAND: this.getVariable(this.USE_DEVON_COMMAND)}); return null; } runBuildNg(runCommand: RunCommand): RunResult { - let cdCommand = this.changeCurrentDir(path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0])); + let cdCommand = this.changeCurrentDir(path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0])); this.pushStep(runCommand, "Build the Angular project", "step" + runCommand.stepIndex + ".md"); - this.renderTemplate("buildNg.md", this.outputPathTutorial + "step" + runCommand.stepIndex + ".md", { text: runCommand.text, textAfter: runCommand.textAfter, cdCommand: cdCommand, outputDir: runCommand.command.parameters[1], useDevonCommand: this.getVariable(this.useDevonCommand) }); + this.renderTemplate("buildNg.md", this.outputPathTutorial + "step" + runCommand.stepIndex + ".md", { text: runCommand.text, textAfter: runCommand.textAfter, cdCommand: cdCommand, outputDir: runCommand.command.parameters[1], USE_DEVON_COMMAND: this.getVariable(this.USE_DEVON_COMMAND) }); return null; } runCloneRepository(runCommand: RunCommand): RunResult { - let cdCommand = this.changeCurrentDir(path.join(this.getVariable(this.workspaceDirectory))); + let cdCommand = this.changeCurrentDir(path.join(this.getVariable(this.WORKSPACE_DIRECTORY))); let directoryPath = ""; if(runCommand.command.parameters[0].trim()) { directoryPath = path.join(runCommand.command.parameters[0]).replace(/\\/g, "/"); @@ -285,17 +285,17 @@ export class Katacoda extends Runner { } runRunServerJava(runCommand: RunCommand): RunResult{ - let serverDir = path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0]); + let serverDir = path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0]); let terminal = this.getTerminal('runServerJava'); let cdCommand = this.changeCurrentDir(serverDir, terminal.terminalId, terminal.isRunning); this.pushStep(runCommand, "Start the Java server", "step" + runCommand.stepIndex + ".md"); - this.renderTemplate("runServerJava.md", this.outputPathTutorial + "step" + runCommand.stepIndex + ".md", { text: runCommand.text, textAfter: runCommand.textAfter, cdCommand: cdCommand, terminalId: terminal.terminalId, interrupt: terminal.isRunning, useDevonCommand: this.getVariable(this.useDevonCommand)}); + this.renderTemplate("runServerJava.md", this.outputPathTutorial + "step" + runCommand.stepIndex + ".md", { text: runCommand.text, textAfter: runCommand.textAfter, cdCommand: cdCommand, terminalId: terminal.terminalId, interrupt: terminal.isRunning, USE_DEVON_COMMAND: this.getVariable(this.USE_DEVON_COMMAND)}); return null; } runNpmInstall(runCommand: RunCommand): RunResult { - let cdCommand = this.changeCurrentDir(path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0])); + let cdCommand = this.changeCurrentDir(path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0])); let packageTitle = (runCommand.command.parameters.length > 1 && runCommand.command.parameters[1].name) ? runCommand.command.parameters[1].name : "the dependencies"; let npmCommand = { "name": (runCommand.command.parameters.length > 1 && runCommand.command.parameters[1].name) ? runCommand.command.parameters[1].name : undefined, @@ -305,12 +305,12 @@ export class Katacoda extends Runner { this.pushStep(runCommand, "Install " + packageTitle, "step" + runCommand.stepIndex + ".md") - this.renderTemplate("npmInstall.md", this.outputPathTutorial + "step" + runCommand.stepIndex + ".md", { text: runCommand.text, textAfter: runCommand.textAfter, cdCommand: cdCommand, useDevonCommand: this.getVariable(this.useDevonCommand), npmCommand: npmCommand}); + this.renderTemplate("npmInstall.md", this.outputPathTutorial + "step" + runCommand.stepIndex + ".md", { text: runCommand.text, textAfter: runCommand.textAfter, cdCommand: cdCommand, USE_DEVON_COMMAND: this.getVariable(this.USE_DEVON_COMMAND), npmCommand: npmCommand}); return null; } runRunClientNg(runCommand: RunCommand): RunResult { - let serverDir = path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0]); + let serverDir = path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0]); let terminal = this.getTerminal('runClientNg'); let cdCommand = this.changeCurrentDir(serverDir, terminal.terminalId, terminal.isRunning); @@ -318,12 +318,12 @@ export class Katacoda extends Runner { fs.appendFileSync(path.join(this.getRunnerDirectory(),"templates","scripts", "intro_background.sh"), "\necho \'export NODE_OPTIONS=\"--max-old-space-size=16384\"\' >> /root/.profile\n"); - this.renderTemplate("runClientNg.md", this.outputPathTutorial + "step" + runCommand.stepIndex + ".md", { text: runCommand.text, textAfter: runCommand.textAfter, cdCommand: cdCommand, terminalId: terminal.terminalId, interrupt: terminal.isRunning, port: runCommand.command.parameters[1].port, useDevonCommand: this.getVariable(this.useDevonCommand)}); + this.renderTemplate("runClientNg.md", this.outputPathTutorial + "step" + runCommand.stepIndex + ".md", { text: runCommand.text, textAfter: runCommand.textAfter, cdCommand: cdCommand, terminalId: terminal.terminalId, interrupt: terminal.isRunning, port: runCommand.command.parameters[1].port, USE_DEVON_COMMAND: this.getVariable(this.USE_DEVON_COMMAND)}); return null; } runCreateFolder(runCommand: RunCommand): RunResult { - let folderPath = new DirUtils().getCdParam(this.currentDir, path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0])); + let folderPath = new DirUtils().getCdParam(this.currentDir, path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0])); this.pushStep(runCommand, "Create a new folder", "step" + runCommand.stepIndex + ".md"); @@ -334,7 +334,7 @@ export class Katacoda extends Runner { runDownloadFile(runCommand: RunCommand): RunResult { this.pushStep(runCommand, "Download a file", "step" + runCommand.stepIndex + ".md"); - let downloadDir = this.getVariable(this.workspaceDirectory).replace(/\\/g, "/") + let downloadDir = this.getVariable(this.WORKSPACE_DIRECTORY).replace(/\\/g, "/") if (runCommand.command.parameters.length == 3) { downloadDir = downloadDir.concat("/", runCommand.command.parameters[2]) } @@ -365,7 +365,7 @@ export class Katacoda extends Runner { this.renderTemplate("nextKatacodaStep.md", this.outputPathTutorial + "step" + runCommand.stepIndex + ".md", { text: runCommand.text, textAfter: runCommand.textAfter, content: content }); if(runCommand.command.parameters[2]) { - this.currentDir = path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[2]); + this.currentDir = path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[2]); } return null; @@ -381,7 +381,7 @@ export class Katacoda extends Runner { runDockerCompose(runCommand: RunCommand) : RunResult { let terminal = this.getTerminal('runDockerCompose'); - let cdCommand = this.changeCurrentDir(path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0]), terminal.terminalId, terminal.isRunning); + let cdCommand = this.changeCurrentDir(path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0]), terminal.terminalId, terminal.isRunning); this.pushStep(runCommand, "Execute Docker Compose", "step" + runCommand.stepIndex + ".md"); @@ -391,12 +391,12 @@ export class Katacoda extends Runner { } runCreateDevon4ngProject(runCommand: RunCommand): RunResult { - let cdCommand = this.changeCurrentDir(path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[1])); + let cdCommand = this.changeCurrentDir(path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[1])); let params = runCommand.command.parameters.length > 2 && (runCommand.command.parameters[2] instanceof Array) ? runCommand.command.parameters[2].join(" ") : ""; this.pushStep(runCommand, "Create Angular project", "step" + runCommand.stepIndex + ".md"); - this.renderTemplate("createDevon4ngProject.md", this.outputPathTutorial + "step" + runCommand.stepIndex + ".md", { text: runCommand.text, textAfter: runCommand.textAfter, cdCommand: cdCommand, projectName: runCommand.command.parameters[0], params: params, useDevonCommand: this.getVariable(this.useDevonCommand) }); + this.renderTemplate("createDevon4ngProject.md", this.outputPathTutorial + "step" + runCommand.stepIndex + ".md", { text: runCommand.text, textAfter: runCommand.textAfter, cdCommand: cdCommand, projectName: runCommand.command.parameters[0], params: params, USE_DEVON_COMMAND: this.getVariable(this.USE_DEVON_COMMAND) }); return null; } diff --git a/runners/vscode/index.ts b/runners/vscode/index.ts index 8306c129..d1866973 100644 --- a/runners/vscode/index.ts +++ b/runners/vscode/index.ts @@ -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"); diff --git a/runners/wikiConsole/index.ts b/runners/wikiConsole/index.ts index 1a8cb5fb..29be823c 100644 --- a/runners/wikiConsole/index.ts +++ b/runners/wikiConsole/index.ts @@ -9,7 +9,8 @@ export class WikiConsole extends WikiRunner { init(playbook: Playbook): void { super.init(playbook); 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())); + this.setVariable(this.WORKSPACE_DIRECTORY, path.join(this.getWorkingDirectory())); + } async destroy(playbook: Playbook): Promise { @@ -26,8 +27,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.installedTools, tools); + this.setVariable(this.WORKSPACE_DIRECTORY, path.join(this.getWorkingDirectory(), "devonfw", "workspaces", "main")); + this.setVariable(this.INSTALLED_TOOLS, tools); return null; } @@ -36,7 +37,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; @@ -63,13 +64,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, @@ -81,7 +82,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; } @@ -96,7 +97,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}); @@ -110,13 +111,13 @@ 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; diff --git a/runners/wikiEclipse/index.ts b/runners/wikiEclipse/index.ts index 90eac1ed..45b94e4f 100644 --- a/runners/wikiEclipse/index.ts +++ b/runners/wikiEclipse/index.ts @@ -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; @@ -53,7 +53,7 @@ export class WikiEclipse extends WikiRunner { } supports(name: string, parameters: any[]): boolean { - return this.getVariable(this.installedTools).includes("eclipse") + return this.getVariable(this.INSTALLED_TOOLS).includes("eclipse") ? super.supports(name, parameters) : false; } diff --git a/runners/wikiEditor/index.ts b/runners/wikiEditor/index.ts index 73a3fb11..01d2b8f3 100644 --- a/runners/wikiEditor/index.ts +++ b/runners/wikiEditor/index.ts @@ -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; diff --git a/runners/wikiVsCode/index.ts b/runners/wikiVsCode/index.ts index 0b5f35de..eb83f4d6 100644 --- a/runners/wikiVsCode/index.ts +++ b/runners/wikiVsCode/index.ts @@ -16,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; @@ -49,7 +49,7 @@ export class WikiVsCode extends WikiRunner { } supports(name: string, parameters: any[]): boolean { - return this.getVariable(this.installedTools).includes("vscode") + return this.getVariable(this.INSTALLED_TOOLS).includes("vscode") ? super.supports(name, parameters) : false; } From d776ffa3326b99bdd9482ffd35a02ebceedf4c63 Mon Sep 17 00:00:00 2001 From: EduardKrieger Date: Fri, 14 May 2021 13:23:13 +0200 Subject: [PATCH 18/23] const var changed to uppercase --- runners/katacoda/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runners/katacoda/index.ts b/runners/katacoda/index.ts index b8418b1b..ca920aa9 100644 --- a/runners/katacoda/index.ts +++ b/runners/katacoda/index.ts @@ -402,7 +402,7 @@ export class Katacoda extends Runner { runChangeWorkspace(runCommand: RunCommand): RunResult { let workspacesDir = path.join('/root', runCommand.command.parameters[0]); - this.setVariable(this.workspaceDirectory, workspacesDir); + this.setVariable(this.WORKSPACE_DIRECTORY, workspacesDir); this.pushStep(runCommand); return null; } From e7d6166c4c18318aa74be440b9be7ed2660c3eee Mon Sep 17 00:00:00 2001 From: EduardKrieger Date: Wed, 19 May 2021 10:57:52 +0200 Subject: [PATCH 19/23] chenaged asciidoc --- runners/wikiConsole/templates/installCobiGen.asciidoc | 2 +- runners/wikiVsCode/templates/installCobiGen.asciidoc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/runners/wikiConsole/templates/installCobiGen.asciidoc b/runners/wikiConsole/templates/installCobiGen.asciidoc index 677e8934..360a148e 100644 --- a/runners/wikiConsole/templates/installCobiGen.asciidoc +++ b/runners/wikiConsole/templates/installCobiGen.asciidoc @@ -2,7 +2,7 @@ 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. +* 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 diff --git a/runners/wikiVsCode/templates/installCobiGen.asciidoc b/runners/wikiVsCode/templates/installCobiGen.asciidoc index 2024b50c..9d86efc3 100644 --- a/runners/wikiVsCode/templates/installCobiGen.asciidoc +++ b/runners/wikiVsCode/templates/installCobiGen.asciidoc @@ -5,7 +5,7 @@ Installing devonfw code generator (i.e. CobiGen). * 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 https://github.com/devonfw-forge/cobigen-vscode-plugin/releases/download/0.0.1/cobigen-plugin-0.0.1.vsix[here] or execute this command in PowerShell or Terminal. +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 From 5e3a0e4dc9fbb021773637385efb610b4663549d Mon Sep 17 00:00:00 2001 From: EduardKrieger Date: Fri, 21 May 2021 16:08:01 +0200 Subject: [PATCH 20/23] changed Path usage --- runners/console/index.ts | 2 +- runners/katacoda/index.ts | 2 +- runners/wikiConsole/index.ts | 3 ++- runners/wikiEclipse/templates/installCobigen.asciidoc | 2 +- runners/wikiVsCode/index.ts | 2 +- runners/wikiVsCode/templates/installCobiGen.asciidoc | 4 ++-- 6 files changed, 8 insertions(+), 7 deletions(-) diff --git a/runners/console/index.ts b/runners/console/index.ts index 10cbcd93..e6044c36 100644 --- a/runners/console/index.ts +++ b/runners/console/index.ts @@ -822,7 +822,7 @@ export class Console extends Runner { new Assertions() .noErrorCode(result) .noException(result) - .fileExits(path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0])); + .fileExits(path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0])); } catch(error) { await this.cleanUp(); diff --git a/runners/katacoda/index.ts b/runners/katacoda/index.ts index ca920aa9..b07576d1 100644 --- a/runners/katacoda/index.ts +++ b/runners/katacoda/index.ts @@ -423,7 +423,7 @@ export class Katacoda extends Runner { runOpenFile(runCommand: RunCommand): RunResult { let fileName = path.basename(runCommand.command.parameters[0]); - let filePath = path.relative('/root', path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0])).replace(/\\/g, "/"); + let filePath = path.relative('/root', path.join(this.getVariable(this.WORKSPACE_DIRECTORY), runCommand.command.parameters[0])).replace(/\\/g, "/"); this.pushStep(runCommand, "Open " + fileName, "step" + runCommand.stepIndex + ".md"); diff --git a/runners/wikiConsole/index.ts b/runners/wikiConsole/index.ts index 29be823c..044dd425 100644 --- a/runners/wikiConsole/index.ts +++ b/runners/wikiConsole/index.ts @@ -3,6 +3,7 @@ import { RunCommand } from "../../engine/run_command"; import { RunResult } from "../../engine/run_result"; import { WikiRunner } from "../../engine/wikiRunner"; import * as path from "path"; +import { Console } from "console"; export class WikiConsole extends WikiRunner { @@ -128,7 +129,7 @@ export class WikiConsole extends WikiRunner { return null; } runInstallCobiGen(runCommand: RunCommand): RunResult{ - let devonPath = this.getWorkingDirectory(); + 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; } diff --git a/runners/wikiEclipse/templates/installCobigen.asciidoc b/runners/wikiEclipse/templates/installCobigen.asciidoc index a53da028..42cb72f7 100644 --- a/runners/wikiEclipse/templates/installCobigen.asciidoc +++ b/runners/wikiEclipse/templates/installCobigen.asciidoc @@ -7,6 +7,6 @@ Installing devonfw code generator (i.e. CobiGen). === 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. +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]. \ No newline at end of file diff --git a/runners/wikiVsCode/index.ts b/runners/wikiVsCode/index.ts index eb83f4d6..a647a331 100644 --- a/runners/wikiVsCode/index.ts +++ b/runners/wikiVsCode/index.ts @@ -43,7 +43,7 @@ export class WikiVsCode extends WikiRunner { } runInstallCobiGen(runCommand: RunCommand): RunResult{ - let dir = this.getWorkingDirectory(); + 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; } diff --git a/runners/wikiVsCode/templates/installCobiGen.asciidoc b/runners/wikiVsCode/templates/installCobiGen.asciidoc index 9d86efc3..43eb77cb 100644 --- a/runners/wikiVsCode/templates/installCobiGen.asciidoc +++ b/runners/wikiVsCode/templates/installCobiGen.asciidoc @@ -12,9 +12,9 @@ First, download the VS Code extension file. You can download it from https://git . 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 <%= dir;%>` +`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. +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]. From 833a572e82c4ee583ce18fc08525bf745db6310a Mon Sep 17 00:00:00 2001 From: EduardKrieger Date: Wed, 26 May 2021 15:26:08 +0200 Subject: [PATCH 21/23] cleanup --- .../wikiConsole/templates/installDevonfwIde.asciidoc | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/runners/wikiConsole/templates/installDevonfwIde.asciidoc b/runners/wikiConsole/templates/installDevonfwIde.asciidoc index 0414cc29..2cce5448 100644 --- a/runners/wikiConsole/templates/installDevonfwIde.asciidoc +++ b/runners/wikiConsole/templates/installDevonfwIde.asciidoc @@ -45,18 +45,7 @@ Start the setup process by executing `.\setup 'path/to/settings'` (Windows) or ` You can also just execute `.\setup` (Windows) or `bash setup` (Linux) and press Enter when the setup assistent asks for the URL to the settings repository. This will also download the default settings and install the default tools within the devonfw IDE. -<<<<<<< HEAD -<<<<<<< HEAD <% 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'. <% } %> -======= ->>>>>>> 2215026 (added supports for eclipse and vscode wiki runner) -======= -<% 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'. -<% } %> - - ->>>>>>> 30ea77338bb072dc21a2dd54edb68635587c2439 From 46a13d5b702f757a198e00ca13977879c821259d Mon Sep 17 00:00:00 2001 From: EduardKrieger Date: Wed, 26 May 2021 15:39:05 +0200 Subject: [PATCH 22/23] fixed spelling --- runners/wikiEclipse/templates/installCobigen.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runners/wikiEclipse/templates/installCobigen.asciidoc b/runners/wikiEclipse/templates/installCobigen.asciidoc index 42cb72f7..82ec3c4b 100644 --- a/runners/wikiEclipse/templates/installCobigen.asciidoc +++ b/runners/wikiEclipse/templates/installCobigen.asciidoc @@ -7,6 +7,6 @@ Installing devonfw code generator (i.e. CobiGen). === 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. +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]. \ No newline at end of file From 2a1c771f7009362f57ca8008b924fd98c6191d40 Mon Sep 17 00:00:00 2001 From: EduardKrieger Date: Fri, 28 May 2021 17:29:46 +0200 Subject: [PATCH 23/23] removed useless import --- runners/wikiConsole/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/runners/wikiConsole/index.ts b/runners/wikiConsole/index.ts index 4a18e403..e645ed07 100644 --- a/runners/wikiConsole/index.ts +++ b/runners/wikiConsole/index.ts @@ -3,7 +3,6 @@ import { RunCommand } from "../../engine/run_command"; import { RunResult } from "../../engine/run_result"; import { WikiRunner } from "../../engine/wikiRunner"; import * as path from "path"; -import { Console } from "console"; export class WikiConsole extends WikiRunner {