Skip to content

Commit 20451f7

Browse files
Merge branch 'main' into update-doc-installCobiGen
2 parents 32efb0d + 0cf117c commit 20451f7

1 file changed

Lines changed: 91 additions & 29 deletions

File tree

documentation/Functions.md

Lines changed: 91 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,32 @@ installDevonfwIde(["java","mvn"], "2020.08.001")
5151
***
5252

5353
### restoreDevonfwIde <a name="restoreDevonfwIde"></a>
54+
It is similar to [installDevonfwIde](#installDevonfwIde) function but the difference between the two functions is that restoreDevonfwIde installs the ide through a script in the background and the Katacoda user will already have an installed version of devonfw-ide at the start of the tutorial.
5455
#### parameter
55-
1. The tools you want to install within the devonfw ide: string array
56-
2. Optional: The version of the ide to install
56+
This function consist of two parameters.
57+
58+
1. First parameter:
59+
- **Required**
60+
- **Type**- Array of String.
61+
- **Description**- The tools you want to install within the devonfw-ide. You can pass every tool that can be installed with the devonfw-ide. In this parameter, based on requirement the tools you can pass are: java, mvn, node, npm, gradle, ionic jasypt, jenkins, ng, sonar and yarn.
62+
63+
2. Second parameter:
64+
- **Optional**
65+
- **Type**- String
66+
- **Description**- Devonfw-ide version that will be installed. If this parameter is omitted, it will install the newest devonfw-ide release.
67+
5768
#### example
5869
restoreDevonfwIde(["java","mvn"], "2020.08.001")
59-
#### details
60-
In the Katacoda environment the installation of the devonfw IDE is executed in a startup script.
70+
71+
Note:
72+
1. In the Katacoda environment the installation of the devonfw-ide is executed in a startup script. Katacoda user don't have to manually execute it.
73+
74+
2. It should be used when you don't have to show the Katacoda user how to install the devonfw-ide because some other tutorials are predecessors for this tutorial and the user already knows the process.
6175

6276
***
6377

6478
### restoreWorkspace <a name="restoreWorkspace"></a>
79+
This function is used to clone an existing GitHub repository to the working directory of the tutorial. It can be used to continue the tutorial with the state of a previous tutorial located in the repository to be cloned.
6580
#### parameter
6681
1. (Optional) Name of the workspace repository {"workspace": string} (Default is the playbook-name)
6782

@@ -143,14 +158,36 @@ Note: No background scripts are running and Katacoda user don't have to manually
143158
***
144159

145160
### executeCommand <a name="executeCommand"></a>
161+
This function is used when you want to use a bash (or powershell/cmd on windows) command.
162+
146163
#### parameter
147-
1. The command that will be executed on Windows
148-
2. The command that will be executed on Linux
149-
3. Json-object with optional fields
150-
* (Optional) Directory where the command will be executed, if not in current directory (relative to workspace){"dir": string}
151-
* (Optional) Synchronous or asynchronous process. Use asynchronous when starting a server. Default is synchronous. {"asynchronous": boolean}
152-
* (Optional) Array of arguments {"args": string[]}
153-
4. Assert information needed if you start a server to check server availability. Only required when you start a asynchronous server.
164+
This function consists of four parameters.
165+
166+
1. First parameter:
167+
- **Required**
168+
- **Type**- String
169+
- **Description**-It contains the input which is a command. The command that will be executed on Windows.
170+
171+
2. Second parameter:
172+
- **Required**
173+
- **Type**- String
174+
- **Description**-It contains the input which is a command. The command that will be executed on Linux.
175+
176+
3. Third parameter:
177+
- **Required**
178+
- **Type**- JSON object
179+
- **Description**- JSON object with optional fields
180+
* **First attribute**: (Optional) Directory where the command will be executed, if not in current directory (relative to workspace)
181+
Example: {"dir": string}
182+
* **Second attribute**: (Optional) Synchronous or asynchronous process. Use asynchronous when starting a server. Default is synchronous.
183+
Example: {"asynchronous": boolean}
184+
* **Third attribute**: (Optional) Array of arguments
185+
Example: {"args": string[]}
186+
187+
4. Fourth parameter:
188+
- **Required**
189+
- **Type**- JSON object
190+
- **Description**-Assertion information needed if you start a server to check server availability. Only required when you start a asynchronous server. This parameter is only needed when the command is an asynchronous command.
154191

155192
#### Commands
156193
It is needed to pass a command for Windows and also for Linux-based systems because both systems will always be tested.
@@ -167,13 +204,13 @@ interval: The availability of the server is checked in the given interval
167204

168205
#### example
169206

170-
executeCommand("node", "node" ,{"args": ["-v"]})
207+
* executeCommand("node", "node" ,{"args": ["-v"]})
171208
Will create a command for executing node -v .
172209

173-
executeCommand("somePollingScript.ps1","bash somePollingScript.sh", {"dir": "data/setup","asynchronous": true, "args": ["--params 5"]})
174-
Will create a command to execute the script in the directory with the parameter --params 5 and in a new terminal.
210+
* executeCommand("somePollingScript.ps1","bash somePollingScript.sh", {"dir": "data/setup", "args": ["--params 5"]})
211+
Will create a command to execute the script in the directory with the parameter --params 5 and in the current command prompt. The command prompt will be blocked until you stop the script.
175212

176-
executeCommand("someServerScript.ps1","bash someServerScript.sh", {"asynchronous": true, "args":["-port 8080"] },{"port":8080 , "startupTime": 20, "path": "some/path/", "interval": 2})
213+
* executeCommand("someServerScript.ps1","bash someServerScript.sh", {"asynchronous": true, "args":["-port 8080"] },{"port":8080 , "startupTime": 20, "path": "some/path/", "interval": 2})
177214
Starting a server in a new terminal. You have to specify the port for testing, the other parameters are optional. The startupTime can specify how long the runner will wait for a response from the server process and with interval you can set the frequenzy for the server testing. The path is the subpath from your server that should be reached.
178215

179216
***
@@ -190,6 +227,7 @@ Note:
190227
1. The command for execution will be generated by Katacoda runner, so user will have to execute this command manually.
191228

192229
2. To execute this function, devonfw-ide must be installed.
230+
193231
***
194232

195233
### cobiGenJava <a name="cobiGenJava"></a>
@@ -394,9 +432,17 @@ Note:
394432

395433

396434
### runServerJava <a name="runServerJava"></a>
435+
This function will run your Java application on server.Parameter and assertion information you need to use properly, which is mentioned below.In Katacoda the command will be executed in a new terminal.
397436
#### parameter
398-
1. Path to the server directory within the java project.
399-
2. Assertion information. Only needed for the console runner to check if the server was started properly.
437+
This functions consists of two parameters.
438+
1. 1st Parameter:
439+
- **Required**
440+
- **Type**- String
441+
- **Description**- Path to the server directory within the Java project.
442+
2. 2nd Parameter:
443+
- **Required**
444+
- **Type**- JSON object
445+
- **Description**- Assertion information. Only needed for the console runner to check if the server was started properly.
400446
#### example
401447
runServerJava("devonfw/workspaces/main/jump-the-queue/java/jtqj/server", { "startupTime": 40, "port": 8081, "path": "jumpthequeue" })
402448

@@ -406,6 +452,9 @@ port: Port on which the server is running
406452
path: The URL path on which is checked if the server is running
407453

408454
If the tutorial should be tested on the console environment, you have to specify a port.
455+
456+
Note: For this command the devonfw-ide is not necessarily needed. Maven has to be installed. So if someone installs Maven before (e.g. with a setup script), then the command should also work.The command uses the Spring Boot Maven Plugin to run the Java application. So at the moment only Spring applications are supported.
457+
409458
***
410459

411460
### npmInstall <a name="npmInstall"></a>
@@ -436,11 +485,12 @@ In second parameter, you can add 3 attributes.
436485
- **Third attribute**: It is optional and it is the array of npm arguments.
437486

438487
Example: {"args": string[]}
488+
439489
#### example
440-
* npmInstall("jump-the-queue/angular", {"name": "@angular/cli", "global": true, "args": ["--save-dev"]})
490+
npmInstall("jump-the-queue/angular", {"name": "@angular/cli", "global": true, "args": ["--save-dev"]})
441491
will run 'npm install -g --save-dev @angular/cli' in the directory 'jump-the-queue/angular'.
442492

443-
* npmInstall("my-thai-star/angular")
493+
npmInstall("my-thai-star/angular")
444494
will run 'npm install' in the directory 'my-thai-star/angular'
445495

446496
Note:
@@ -556,20 +606,28 @@ If the tutorial should be tested on the console environment, you have to specify
556606
***
557607

558608
### displayContent <a name="displayContent"></a>
609+
This function is only used when you want to display content such as text, image or any file content in your tutorial.
610+
559611
#### parameter
560-
1. The title of the step.
561-
2. An array of json objects with files, content, or images to be rendered within the Katacoda step. The use for this function is to display an image and some descriptive text. No Katacoda syntax is allowed in the files or the content!
562-
3. (Optional) Path to the current directory where the user is located (relative to the workspace directory). Only needed if the directory is changed within this step.
563-
#### example
564-
display("Step title", [{ "file": "files/description.asciidoc" }, { "content": "This is just plain content." }, { "image": "files/image.png" }])
612+
This function consists of two parameters.
565613

566-
#### Details
567-
Available attributes in the json objects:
614+
1. First parameter:
615+
- **Required**
616+
- **Type**- String
617+
- **Description**- The title of the step.
568618

569-
1. file: Path to a file whose content is to be displayed in the Katacoda step (e.g. .asciidoc or .txt file). The file should be following the formating of asciidoc files.
570-
2. content: Plain text to be displayed in the Katacoda step. This Text should be following the formating of asciidoc files.
571-
3. image: Path to an image to be displayed in the Katacoda step.
619+
Note: The title should never be empty and it is of type string.
572620

621+
2. Second parameter:
622+
- **Required**
623+
- **Type**- Array of JSON objects with files, content, or images to be rendered within the Katacoda step.
624+
- **Description**-This function consists of three attributes. The use for this function is to display an image and some descriptive text. No Katacoda syntax is allowed in the files or the content!
625+
* 1st attribute i.e. "file": Path to a file whose content is to be displayed in the Katacoda step (e.g. .asciidoc or .txt file). The file should be following the formating of asciidoc files.
626+
* 2nd attribute i.e. "content": Plain text to be displayed in the Katacoda step. This Text should be following the formating of asciidoc files.
627+
* 3rd attribute i.e. "image": Path to an image to be displayed in the Katacoda step. It should be placed under subfolder of the playbook directory.
628+
629+
#### example
630+
displayContent("Step title", [{ "file": "files/description.asciidoc" }, { "content": "This is just plain content." }, { "image": "files/image.png" }])
573631

574632
#### Formatting rules for content and .asciidoc or .txt files.
575633
* You can add headers to structure your text. The generated headers are shown in the examples below. The headers should fit into the overall structure of the generated wiki so level 1 header are not allowed, but the other header can be used at your judgement.
@@ -597,6 +655,10 @@ Link:
597655
The tutorials repository can be found https://github.com/devonfw-tutorials/tutorials/issues[here].
598656
```
599657

658+
Note:
659+
660+
1. You should avoid using any command inside any text file for which you want to display content. This will cause problems with the console runner and the tests.
661+
600662
***
601663

602664
### adaptTemplatesCobiGen <a name="adaptTemplatesCobiGen"></a>

0 commit comments

Comments
 (0)