Skip to content

Commit 685f03d

Browse files
committed
moved wiki docs to documentations folder
1 parent 4628865 commit 685f03d

File tree

4 files changed

+81
-0
lines changed

4 files changed

+81
-0
lines changed

documentation/Development.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Development
2+
3+
In this section we will describe how you can implement your own tutorials.
4+
5+
### How to create a playbook
6+
The playbooks for the tutorial-compiler are contained in the tutorials repository. There you will find a description of how to create your own playbook.
7+
https://github.com/devonfw-forge/tutorials/wiki/Development
8+
9+
### How to create your own command
10+
To create a new command you can use in your playbooks, you have to implement a new function for this command in all runner class you want to support this command. If you want to use the command only in katacoda tutorials for example, you have to implement the function only in the katacoda runner class.
11+
12+
The new method must match the following syntax: 'run' + name of the command. The first letter after 'run' has to be in upper case letters.
13+
```
14+
runYourCommand(step: Step, command: Command): RunResult {
15+
...your code...
16+
let result = new RunResult();
17+
result.returnCode = 1;
18+
return result;
19+
}
20+
```
21+
With the RunResult object you can return a value after the function has executed. You can check this result in an assertion function and verify if the method has executed properly.
22+
23+
The assert method has to match the same naming conventions as the run method (except the 'assert' at the beginning) and is located in the same runner class. The RunResult object of the run method is passed to this method as a parameter.
24+
```
25+
async assertYourCommand(step: Step, command: Command, result: RunResult) {
26+
new Assertions()
27+
.yourFirstAssertion(result)
28+
.yourSecondAssertion(result);
29+
}
30+
```
31+
You can use multiple assertions to check the result. How you create such a assertion is described in the section below.
32+
33+
### How to create an assertion
34+
35+
Assertions are implemented in the 'assertions' folder of the tutorial-compiler directory. To implement a new assertion create a new typescript file with the name of your assertion in this directory.
36+
37+
Inside the new typescript file create a new class. The class has to to implement a static 'run' method as shown below. In this method you can check whatever you want.
38+
```
39+
export class YourAssertionCode {
40+
public static run(): void {
41+
...your code goes here...
42+
if(somethingIsWrong){
43+
throw new Error("Your error message");
44+
}
45+
}
46+
}
47+
```
48+
49+
After this you have to add the newly created assertion to the Assertion class of the index.ts file. This file is located in the same directory.
50+
```
51+
public yourAssertionCode(): Assertions {
52+
YourAssertion.run();
53+
return this;
54+
}
55+
```
56+
If you want to pass arguments to this method, you have to do this in the header of the 'run' method and in the call of the method.
57+

documentation/Functions.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
You can use the following function:
2+
* installDevonIde
3+
* installCobiGen

documentation/Home.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
**Welcome to the tutorial-compiler wiki!**
2+
3+
To download and setup the tutorial-compiler use the description in the setup section.<br/>
4+
[Setup](https://github.com/devonfw-forge/tutorial-compiler/wiki/Setup)
5+
6+
If you want to implement your own tutorials the Development section may help you.<br/>
7+
[Development](https://github.com/devonfw-forge/tutorial-compiler/wiki/Development)
8+
9+
You find a list of functions which are already implemented in the Functions section.<br/>
10+
[Functions](https://github.com/devonfw-forge/tutorial-compiler/wiki/Functions)
11+

documentation/Setup.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
## Download and setup
2+
3+
Carry out the following steps to use the tutorial compiler:
4+
5+
1. Clone this repository
6+
2. Install typescript if not already installed (`npm install -g typescript`)
7+
3. Clone the tutorials repository in a folder next to the tutorial-compiler repository (`git clone https://github.com/devonfw-forge/tutorials.git`)
8+
4. Open a terminal and navigate into the cloned tutorial-compiler repository
9+
5. Install the dependencies (`npm install`)
10+
6. Execute the build script (localBuildRun.ps1 or localBuildRun.sh)

0 commit comments

Comments
 (0)