Skip to content

Commit 96875d5

Browse files
committed
added AddSetupScript for WikiRunner
1 parent eada3bf commit 96875d5

3 files changed

Lines changed: 48 additions & 2 deletions

File tree

runners/wikiConsole/index.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { RunCommand } from "../../engine/run_command";
33
import { RunResult } from "../../engine/run_result";
44
import { WikiRunner } from "../../engine/wikiRunner";
55
import * as path from "path";
6+
import * as fs from "fs";
67

78
export class WikiConsole extends WikiRunner {
89

@@ -128,7 +129,12 @@ export class WikiConsole extends WikiRunner {
128129
}
129130

130131
runAddSetupScript(runCommand: RunCommand): RunResult{
131-
//this.render
132+
let scriptNameLinux = path.basename(runCommand.command.parameters[0]);
133+
let scriptNameWindows = path.basename(runCommand.command.parameters[1]);
134+
let windowsContent = fs.readFileSync(path.join(this.playbookPath, runCommand.command.parameters[1]), { encoding: "utf-8" });
135+
let linuxContent = fs.readFileSync(path.join(this.playbookPath, runCommand.command.parameters[0]), { encoding: "utf-8" });
136+
this.renderWiki(path.join(this.getRunnerDirectory(), "templates", "addSetupScript.asciidoc"), {scriptNameWindows: scriptNameWindows, windowsContent: windowsContent,
137+
scriptNameLinux: scriptNameLinux, linuxContent: linuxContent});
132138
return null;
133139
}
134140
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
== Run a Setupscript
2+
Run a Script to setup the enviroment for the Tutorial.
3+
4+
5+
=== Prerequisites
6+
* Any Editor that can edit files.
7+
8+
=== Create the Setupscript
9+
Open a editor and create a new file by going to the file context menu in the top left corner of the editor and select *New* or *New File* or mostly also the keyboard shortcut ctrl+n will also work.
10+
11+
.Operating system
12+
. Windows +
13+
The editor opens a new editor window for an untitled file where you should insert the following text.
14+
+
15+
[source, powershell]
16+
----
17+
<%- windowsContent; %>
18+
----
19+
Save the file by selecting *Save* or *Save as* in the file context menu or by using the keyboard shortcut ctrl+s.
20+
A file explorer window opens where you should set the filename to *<%= scriptNameWindows; %>* and save it to your current directory.
21+
22+
. Linux and macOS +
23+
The editor opens a new editor window for an untitled file where you can insert the following text.
24+
+
25+
[source, bash]
26+
----
27+
<%- linuxContent; %>
28+
----
29+
Save the file by selecting *Save* or *Save as* in the file context menu or by using the keyboard shortcut ctrl+s.
30+
A file explorer window opens where you should set the filename to *<%= scriptNameLinux; %>* and save it to your current directory.
31+
32+
=== Run the Setupscript
33+
34+
.Operating system
35+
. Windows +
36+
Open the PowerShell in your current workspace and execute the command `./<%= scriptNameWindows; %>` to run the script.
37+
. Linux and macOS +
38+
Open the Terminal in your current workspace and execute the command `bash <%= scriptNameWindows; %>` to run the script.
39+

runners/wikiConsole/templates/intro.asciidoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@
66
The definition of each step of this tutorial can be found at https://github.com/devonfw-tutorials/tutorials/tree/main/<%= name; %>. <% } %>
77

88
Feel free to report any errors to us or fix them yourself. Errors can be reported by creating an issue in the https://github.com/devonfw-tutorials/tutorials/issues[tutorials repository]. To fix the error fork the repository and create a pull request. Errors in the wiki can be reported and fixed in the https://github.com/devonfw-tutorials/tutorial-compiler[Tutorial-compiler repository].
9-
You can find a description of what to look for when creating a pull request at the devonfw contribution guide: https://devonfw.com/website/pages/community/community.html#community.asciidoc_contributing-to-devonfw. If you want to create a tutorial you can start with the https://katacoda.com/devonfw/scenarios/create-your-own-tutorial[katacoda tutorial] and read the description for creating your own tutorials: https://github.com/devonfw-tutorials/tutorials/wiki/Development.
9+
You can find a description of what to look for when creating a pull request at the devonfw contribution guide: https://devonfw.com/website/pages/community/community.html#community.asciidoc_contributing-to-devonfw. If you want to create a tutorial you can start with the https://katacoda.com/devonfw/scenarios/create-your-own-tutorial[katacoda tutorial] and read the description for creating your own tutorials: https://github.com/devonfw-tutorials/tutorials/wiki/Development.
10+

0 commit comments

Comments
 (0)