Skip to content

Commit 15b65bf

Browse files
Merge remote-tracking branch 'upstream/main' into feature/wikiRunner
2 parents 16a2752 + f34adfd commit 15b65bf

File tree

22 files changed

+2637
-114
lines changed

22 files changed

+2637
-114
lines changed

.github/workflows/linuxMain.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,6 @@ jobs:
2323
run: bash checkout.sh
2424

2525
- name: run buildRun.sh
26-
run: sh buildRun.sh
26+
uses: GabrielBB/[email protected]
27+
with:
28+
run: sh buildRun.sh

documentation/Functions.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ The following functions are already implemented:
1717
* downloadFile
1818
* nextKatacodaStep
1919
* adaptTemplatesCobiGen
20+
* createDevon4ngProject
2021

2122
***
2223

@@ -240,11 +241,27 @@ image: Path to an image to be displayed in the katacoda step.
240241

241242
***
242243

243-
244244
### adaptTemplatesCobiGen
245245
#### parameter
246246
* No parameters
247247
#### example
248248
adaptTemplatesCobiGen()
249249

250250
***
251+
252+
### createDevon4ngProject
253+
#### parameter
254+
1. Name of the Project.
255+
2. Path to where the Project should be created (relative to workspace). Folder should exist.
256+
3. (Optional) String array of parameters, according to https://angular.io/cli/new.
257+
#### example
258+
createDevon4ngProject("exampleAngularProject", "")
259+
Will create the angular project to the current workspace with the name exampleAngularProject.
260+
261+
createDevon4ngProject("exampleAngularProject", "projects", ["--verbose"])
262+
Will create the angular project to the directory projects within the current workspace and adds more details to output logging.
263+
264+
#### Details
265+
This command also works if the devonfw IDE is not installed, but then you have to make sure that the Angular cli is installed.
266+
267+
***

engine/engine.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ export class Engine {
1313
constructor(private environmentName: string, private environment: Environment, private playbook: Playbook) { }
1414

1515
async run() {
16+
for (let runnerIndex in this.environment.runners) {
17+
(await this.getRunner(this.environment.runners[runnerIndex])).init(this.playbook);
18+
}
19+
1620
console.log("Environment: " + this.environmentName);
1721
if (! await this.isEnvironmentComplete()) {
1822
if (this.environment.failOnIncomplete) {
@@ -21,17 +25,14 @@ export class Engine {
2125
console.log("Environment incomplete: " + this.environmentName);
2226
return;
2327
}
24-
for (let runnerIndex in this.environment.runners) {
25-
(await this.getRunner(this.environment.runners[runnerIndex])).init(this.playbook);
26-
}
2728

2829
mainloop: for (let stepIndex = 0; stepIndex < this.playbook.steps.length; stepIndex++) {
2930
for (let lineIndex = 0; lineIndex < this.playbook.steps[stepIndex].lines.length; lineIndex++) {
3031
let runCommand = this.initRunCommand(stepIndex, lineIndex);
3132
let foundRunnerToExecuteCommand = false;
3233
for (let runnerIndex in this.environment.runners) {
3334
let runner = await this.getRunner(this.environment.runners[runnerIndex]);
34-
if (runner.supports(this.playbook.steps[stepIndex].lines[lineIndex].name)) {
35+
if (runner.supports(this.playbook.steps[stepIndex].lines[lineIndex].name, this.playbook.steps[stepIndex].lines[lineIndex].parameters)) {
3536
var result = new RunResult();
3637
if(runner.commandIsSkippable(runCommand.command.name)) {
3738
console.log("Command " + runCommand.command.name + " will be skipped.");
@@ -70,7 +71,7 @@ export class Engine {
7071
for (let lineIndex in this.playbook.steps[stepIndex].lines) {
7172
let isSupported = false;
7273
for (let runnerIndex in this.environment.runners) {
73-
if ((await this.getRunner(this.environment.runners[runnerIndex])).supports(this.playbook.steps[stepIndex].lines[lineIndex].name)) {
74+
if ((await this.getRunner(this.environment.runners[runnerIndex])).supports(this.playbook.steps[stepIndex].lines[lineIndex].name, this.playbook.steps[stepIndex].lines[lineIndex].parameters)) {
7475
isSupported = true;
7576
break;
7677
}

engine/runner.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export abstract class Runner {
7474
return dir;
7575
}
7676

77-
supports(name: string): boolean {
77+
supports(name: string, parameters: any[]): boolean {
7878
return !!this[this.getMethodName("run", name)];
7979
}
8080

@@ -105,7 +105,7 @@ export abstract class Runner {
105105
if(deleteFolerIfExist) {
106106
rimraf.sync(path);
107107
fs.mkdirSync(path, { recursive: true });
108-
} else return
108+
} else return path;
109109
}
110110
fs.mkdirSync(path, { recursive: true });
111111
return path;
File renamed without changes.

environments/test_vscode.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"failOnIncomplete": true,
3+
"runners": [
4+
"vscode",
5+
"console"
6+
]
7+
}

0 commit comments

Comments
 (0)