Skip to content

Commit a9d3b3b

Browse files
Merge branch 'devonfw-tutorials:main' into feature/wikiRunnerExecuteCommand
2 parents 597463d + 87ef43f commit a9d3b3b

File tree

26 files changed

+788
-260
lines changed

26 files changed

+788
-260
lines changed

.github/workflows/linuxMain.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ jobs:
1818

1919
- uses: actions/setup-node@v2-beta
2020

21+
- name: install Pandoc
22+
run: sudo apt install pandoc
23+
24+
- name: install AsciiDoctor
25+
run: sudo apt install asciidoctor
26+
2127
- name: install TS
2228
run: npm install typescript
2329

.github/workflows/linuxPullRequest.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ jobs:
1111

1212
- uses: actions/setup-node@v2-beta
1313

14+
- name: install Pandoc
15+
run: sudo apt install pandoc
16+
17+
- name: install AsciiDoctor
18+
run: sudo apt install asciidoctor
19+
1420
- name: install TS
1521
run: npm install typescript
1622

.github/workflows/windowsMain.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,19 @@ jobs:
1818

1919
- uses: actions/setup-node@v2-beta
2020

21+
- name: install Pandoc
22+
uses: crazy-max/ghaction-chocolatey@v1
23+
with:
24+
args: install pandoc
25+
26+
- name: install Ruby
27+
uses: crazy-max/ghaction-chocolatey@v1
28+
with:
29+
args: install ruby
30+
31+
- name: install AsciiDoctor
32+
run: gem install asciidoctor
33+
2134
- name: install TS
2235
run: npm install typescript
2336

.github/workflows/windowsPullRequest.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,19 @@ jobs:
1111

1212
- uses: actions/setup-node@v2-beta
1313

14+
- name: install Pandoc
15+
uses: crazy-max/ghaction-chocolatey@v1
16+
with:
17+
args: install pandoc
18+
19+
- name: install Ruby
20+
uses: crazy-max/ghaction-chocolatey@v1
21+
with:
22+
args: install ruby
23+
24+
- name: install AsciiDoctor
25+
run: gem install asciidoctor
26+
1427
- name: install TS
1528
run: npm install typescript
1629

documentation/Functions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ buildJava("cobigenexample", true)
195195

196196
### createFile <a name="createFile"></a>
197197
#### parameter
198-
1. Path of the file to be created (relative path to the workspace directory)
198+
1. Path of the file to be created (relative path to the workspace directory).
199199
2. (Optional) Path of the file to get the content from. Relative to the playbook directory
200200
#### example
201201
createFile("cobigenexample/core/src/main/java/com/example/application/cobigenexample/customermanagement/dataaccess/api/CustomerEntity.java", "files/CustomerEntity.java")

engine/command.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ export class Command{
33
public parameterString: string;
44

55
get parameters(): any[] {
6-
return JSON.parse("[" + this.parameterString + "]");
6+
try {
7+
return JSON.parse("[" + this.parameterString + "]");
8+
} catch(e) {
9+
console.error("Error parsing arguments: '" + this.parameterString + "'");
10+
throw e;
11+
}
712
}
8-
}
13+
}

engine/engine.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export class Engine {
1919

2020
console.log("Environment: " + this.environmentName);
2121
if (! await this.isEnvironmentComplete()) {
22-
if (this.environment.failOnIncomplete) {
22+
if (this.environment.failOnIncomplete && !this.syntaxErrorLogger.activated) {
2323
throw "Environment incomplete: " + this.environmentName;
2424
} else if(!this.environment.skipMissingFunctions) {
2525
console.log("Environment incomplete: " + this.environmentName);

engine/parser.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ export class Parser {
4444
getLines(parseResult, index):Command[]{
4545
let linebreak = process.platform=="win32" ? "\r\n" : "\n";
4646
try {
47-
return (parseResult[3][index][7].steplines || parseResult[3][index][2][7].steplines).split(linebreak).filter(e => e != '').map(e => this.createCommand(e));
47+
return (parseResult[3][index][7].steplines || parseResult[3][index][2][7].steplines).split(linebreak).filter(e => e.trim() != '').map(e => this.createCommand(e));
4848
} catch (error) {
49-
return parseResult[3][index][2][7].steplines.split(linebreak).filter(e => e != '').map(e => this.createCommand(e));
49+
return parseResult[3][index][2][7].steplines.split(linebreak).filter(e => e.trim() != '').map(e => this.createCommand(e));
5050
}
5151
}
5252

@@ -62,11 +62,16 @@ export class Parser {
6262

6363
createCommand(line: string): Command{
6464
let re =/([^(]+)\(([^)]*)\)/;
65-
let result = re.exec(line);
66-
let retVal = new Command();
67-
retVal.name = result[1].trim();
68-
retVal.parameterString = result[2];
69-
return retVal;
65+
try {
66+
let result = re.exec(line);
67+
let retVal = new Command();
68+
retVal.name = result[1].trim();
69+
retVal.parameterString = result[2];
70+
return retVal;
71+
} catch(e) {
72+
console.error("Error in method createCommand while parsing line: '" + line + "'");
73+
throw e;
74+
}
7075
}
7176

7277
getTextAfter(parseResult, index){

engine/runner.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { RunResult } from "./run_result";
22
import { Playbook } from "./playbook";
3-
import * as fs from 'fs';
4-
import * as rimraf from 'rimraf';
3+
import * as fs from 'fs-extra';
54
import { RunCommand } from "./run_command";
65

76
export abstract class Runner {
@@ -104,9 +103,9 @@ export abstract class Runner {
104103
if(fs.existsSync(path)) {
105104
if(deleteFolderIfExist) {
106105
try {
107-
rimraf.sync(path);
106+
fs.removeSync(path);
108107
} catch(e) {
109-
console.log("Error deleting foler " + path, e);
108+
console.log("Error deleting folder " + path, e);
110109
}
111110
} else return path;
112111
}

engine/wikiRunner.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@ import * as ejs from "ejs";
77
export abstract class WikiRunner extends Runner {
88

99
public outputPathTutorial: string;
10+
protected fileTypeMap = new Map([ [".java", "java"],[".ts", "typescript"],
11+
[".js", "javascript"], [".html", "html"],
12+
[".scss", "css"], [".asciidoc", "asciidoc"], ]);
1013
protected readonly INSTALLED_TOOLS: string = "installedTools";
1114

15+
1216
init(playbook: Playbook): void {
1317
let outputDirectory = this.createFolder(path.join(this.getOutputDirectory(), "wiki", this.environmentName), false)
1418
this.outputPathTutorial = this.createFolder(path.join(outputDirectory, playbook.name), true);

0 commit comments

Comments
 (0)