Skip to content

Commit 8707f5c

Browse files
Merge pull request #272 from GuentherJulian/bugfix/katacodaRunner
bugfix katacoda runner: fixed spelling for template variables
2 parents 643c598 + ccbe87a commit 8707f5c

2 files changed

Lines changed: 15 additions & 8 deletions

File tree

assertions/noException.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { RunResult } from "../engine/run_result";
33
export class NoException {
44
public static run(result: RunResult): void {
55
if(result.exceptions.length > 0) {
6-
throw new Error("Unexpected exception.");
6+
throw new Error("Unexpected exception: " + result.exceptions.join());
77
}
88
}
99
}

runners/katacoda/index.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { DirUtils } from "./dirUtils";
99
import * as path from 'path';
1010
import * as ejs from 'ejs';
1111
import * as fs from 'fs';
12+
import { Assertions } from "../../assertions";
1213

1314
export class Katacoda extends Runner {
1415

@@ -146,7 +147,7 @@ export class Katacoda extends Runner {
146147
: path.join('/root', "workspaces").replace(/\\/g, "/");
147148

148149
let user = this.getVariable('user') ? this.getVariable('user') : 'devonfw-tutorials';
149-
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)});
150+
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.USE_DEVON_COMMAND)});
150151

151152
this.setupScripts.push({
152153
"name": "Restore Workspace",
@@ -254,7 +255,7 @@ export class Katacoda extends Runner {
254255

255256
this.pushStep(runCommand, "Build the Java project", "step" + runCommand.stepIndex + ".md");
256257

257-
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)});
258+
this.renderTemplate("buildJava.md", this.outputPathTutorial + "step" + runCommand.stepIndex + ".md", { text: runCommand.text, textAfter: runCommand.textAfter, cdCommand: cdCommand, skipTest: skipTest, useDevonCommand: this.getVariable(this.USE_DEVON_COMMAND)});
258259
return null;
259260

260261
}
@@ -265,7 +266,7 @@ export class Katacoda extends Runner {
265266

266267
this.pushStep(runCommand, "Build the Angular project", "step" + runCommand.stepIndex + ".md");
267268

268-
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) });
269+
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.USE_DEVON_COMMAND) });
269270

270271
return null;
271272
}
@@ -291,7 +292,7 @@ export class Katacoda extends Runner {
291292
let cdCommand = this.changeCurrentDir(serverDir, terminal.terminalId, terminal.isRunning);
292293
this.pushStep(runCommand, "Start the Java server", "step" + runCommand.stepIndex + ".md");
293294

294-
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)});
295+
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.USE_DEVON_COMMAND)});
295296
return null;
296297
}
297298

@@ -306,7 +307,7 @@ export class Katacoda extends Runner {
306307

307308
this.pushStep(runCommand, "Install " + packageTitle, "step" + runCommand.stepIndex + ".md")
308309

309-
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});
310+
this.renderTemplate("npmInstall.md", this.outputPathTutorial + "step" + runCommand.stepIndex + ".md", { text: runCommand.text, textAfter: runCommand.textAfter, cdCommand: cdCommand, useDevonCommand: this.getVariable(this.USE_DEVON_COMMAND), npmCommand: npmCommand});
310311
return null;
311312
}
312313

@@ -319,7 +320,7 @@ export class Katacoda extends Runner {
319320

320321
fs.appendFileSync(path.join(this.getRunnerDirectory(),"templates","scripts", "intro_background.sh"), "\necho \'export NODE_OPTIONS=\"--max-old-space-size=16384\"\' >> /root/.profile\n");
321322

322-
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)});
323+
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.USE_DEVON_COMMAND)});
323324
return null;
324325
}
325326

@@ -397,7 +398,7 @@ export class Katacoda extends Runner {
397398

398399
this.pushStep(runCommand, "Create Angular project", "step" + runCommand.stepIndex + ".md");
399400

400-
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) });
401+
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.USE_DEVON_COMMAND) });
401402
return null;
402403
}
403404

@@ -535,5 +536,11 @@ export class Katacoda extends Runner {
535536
}
536537
}
537538

539+
async assert(runCommand: RunCommand, runResult: RunResult): Promise<void> {
540+
if(runResult != null) {
541+
new Assertions().noException(runResult);
542+
}
543+
}
544+
538545
}
539546

0 commit comments

Comments
 (0)