From 82ccdabb1a4e2c1917d3efb1b6ace1f0dd1ae98d Mon Sep 17 00:00:00 2001
From: dixyushi <72491437+dixyushi@users.noreply.github.com>
Date: Wed, 4 Aug 2021 17:59:44 +0530
Subject: [PATCH 1/5] modified function content
---
documentation/Functions.md | 34 ++++++++++++++++++++++++----------
1 file changed, 24 insertions(+), 10 deletions(-)
diff --git a/documentation/Functions.md b/documentation/Functions.md
index d2c00d1e..b81f836e 100644
--- a/documentation/Functions.md
+++ b/documentation/Functions.md
@@ -203,23 +203,31 @@ createFile("cobigenexample/core/src/main/java/com/example/application/cobigenexa
***
### changeFile
+This function is used to insert, append and replace some text in a file.
#### parameter
-1. Path of the file to be changed (relative path to the workspace directory)
-2.
- * Path of the file to get the content from or a string, that should be inserted.(relative path to the playbook directory)
- * (Optional) Name of a placeholder
- * (Optional) Line number where u want to insert your code. (Possible lines are: 1...n+1 for N = number of existing lines. File cant be empty)
+This function consist of 2 parameters
+1. First parameter:
+ - **Required**
+ - **type**- String
+ - **Description**- Path of the file to be changed (relative path to the workspace directory)
+2. Second parameter:
+ - **Required**
+ - **type**- JSON Object
+ - **Description**-This parameter consist of 3 attributes:
+ * First attribute:- The content that you want to insert into the file or the filepath of a file from where you want to insert the content.
+ * Second attribute:- (Optional) Name of a placeholder
+ * Third attribute:- (Optional) Line number where you want to insert your code. (Possible lines are: 1...n+1 for N = number of existing lines. File cant be empty)
#### example
changeFile("cobigenexample/core/src/main/java/com/example/application/cobigenexample/customermanagement/dataaccess/api/CustomerEntity.java", { "file": "files/Placeholder.java", "placeholder": "private static final long serialVersionUID = 1L;" })
#### details
##### Path of the file to get the content from or a string, that should be inserted.
-If you want to add content from a file:
+* If you want to add content from a file then use:
{"file": "[path]"}
-If you want to add a string to a file:
+* If you want to add a string to a file then use:
{"content": "[string]"}
-If you want to add different contents for the katacoda and console runner, then use the properties "fileConsole" and "fileKatacoda" or "contentConsole" and "contentKatacoda":
+* If you want to add different contents for the katacoda and console runner, then use the properties "fileConsole" and "fileKatacoda" or "contentConsole" and "contentKatacoda":
{"fileConsole": "[pathToConsoleFile]", "fileKatacoda": "[pathToKatacodaFile]"}
-If you want to insert some content at a specific line, then use "lineNumber" and dont use a placeholder:
+* If you want to insert some content at a specific line, then use "lineNumber" and dont use a placeholder:
{"lineNumber": "[Line]"}
example:{...,"placeholder": "private int age;"}
@@ -241,6 +249,12 @@ Please try not to use custom placeholders. Keep in mind that you might want to b
The option to insert at a linenumber uses a placeholder inserted by a script and just adds it at the step you also insert the content.
+Note:
+1. The command for execution will be generated by katacoda runner, so user will have to execute this command manually.
+
+2. You should not use linenumber and placeholder in the same function.
+
+
***
### createFolder
@@ -433,4 +447,4 @@ addSetupScript("assets/createProjectScript.sh", "assets/createProjectScript.ps1"
1. Path of the file to be opened (relative path to the workspace directory)
#### example
-openFile("cobigenexample/core/src/main/java/com/example/application/cobigenexample/customermanagement/dataaccess/api/CustomerEntity.java")
\ No newline at end of file
+openFile("cobigenexample/core/src/main/java/com/example/application/cobigenexample/customermanagement/dataaccess/api/CustomerEntity.java")
From c629bcf151acd1c22b49131a0d2fb216cca76673 Mon Sep 17 00:00:00 2001
From: dixyushi <72491437+dixyushi@users.noreply.github.com>
Date: Wed, 4 Aug 2021 18:03:40 +0530
Subject: [PATCH 2/5] modified content
---
documentation/Functions.md | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/documentation/Functions.md b/documentation/Functions.md
index b81f836e..185e66af 100644
--- a/documentation/Functions.md
+++ b/documentation/Functions.md
@@ -222,13 +222,17 @@ changeFile("cobigenexample/core/src/main/java/com/example/application/cobigenexa
#### details
##### Path of the file to get the content from or a string, that should be inserted.
* If you want to add content from a file then use:
-{"file": "[path]"}
-* If you want to add a string to a file then use:
-{"content": "[string]"}
+
+example: {"file": "[path]"}
+* If you want to add a string to a file then use:
+
+example: {"content": "[string]"}
* If you want to add different contents for the katacoda and console runner, then use the properties "fileConsole" and "fileKatacoda" or "contentConsole" and "contentKatacoda":
-{"fileConsole": "[pathToConsoleFile]", "fileKatacoda": "[pathToKatacodaFile]"}
+
+example: {"fileConsole": "[pathToConsoleFile]", "fileKatacoda": "[pathToKatacodaFile]"}
* If you want to insert some content at a specific line, then use "lineNumber" and dont use a placeholder:
-{"lineNumber": "[Line]"}
+
+example: {"lineNumber": "[Line]"}
example:{...,"placeholder": "private int age;"}
| Before | Content or File | After |
From f4589da5120372a35f92d8517e9b594cb038daa7 Mon Sep 17 00:00:00 2001
From: dixyushi <72491437+dixyushi@users.noreply.github.com>
Date: Wed, 4 Aug 2021 18:06:24 +0530
Subject: [PATCH 3/5] Modified content of function
---
documentation/Functions.md | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/documentation/Functions.md b/documentation/Functions.md
index 185e66af..3cef0588 100644
--- a/documentation/Functions.md
+++ b/documentation/Functions.md
@@ -223,16 +223,16 @@ changeFile("cobigenexample/core/src/main/java/com/example/application/cobigenexa
##### Path of the file to get the content from or a string, that should be inserted.
* If you want to add content from a file then use:
-example: {"file": "[path]"}
+ example: {"file": "[path]"}
* If you want to add a string to a file then use:
-example: {"content": "[string]"}
+ example: {"content": "[string]"}
* If you want to add different contents for the katacoda and console runner, then use the properties "fileConsole" and "fileKatacoda" or "contentConsole" and "contentKatacoda":
-example: {"fileConsole": "[pathToConsoleFile]", "fileKatacoda": "[pathToKatacodaFile]"}
+ example: {"fileConsole": "[pathToConsoleFile]", "fileKatacoda": "[pathToKatacodaFile]"}
* If you want to insert some content at a specific line, then use "lineNumber" and dont use a placeholder:
-example: {"lineNumber": "[Line]"}
+ example: {"lineNumber": "[Line]"}
example:{...,"placeholder": "private int age;"}
| Before | Content or File | After |
From ac28d83b2a42fb37efaa60bd9a334f57d38bedc9 Mon Sep 17 00:00:00 2001
From: dixyushi <72491437+dixyushi@users.noreply.github.com>
Date: Thu, 5 Aug 2021 15:20:27 +0530
Subject: [PATCH 4/5] Modified Content
---
documentation/Functions.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/documentation/Functions.md b/documentation/Functions.md
index 3cef0588..1ea66fbf 100644
--- a/documentation/Functions.md
+++ b/documentation/Functions.md
@@ -208,11 +208,11 @@ This function is used to insert, append and replace some text in a file.
This function consist of 2 parameters
1. First parameter:
- **Required**
- - **type**- String
+ - **Type**- String
- **Description**- Path of the file to be changed (relative path to the workspace directory)
2. Second parameter:
- **Required**
- - **type**- JSON Object
+ - **Type**- JSON Object
- **Description**-This parameter consist of 3 attributes:
* First attribute:- The content that you want to insert into the file or the filepath of a file from where you want to insert the content.
* Second attribute:- (Optional) Name of a placeholder
From fb7b010457c38704c4937bb0636b6bd0db82f559 Mon Sep 17 00:00:00 2001
From: dixyushi <72491437+dixyushi@users.noreply.github.com>
Date: Thu, 12 Aug 2021 17:41:34 +0530
Subject: [PATCH 5/5] Implemented review comment
---
documentation/Functions.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/documentation/Functions.md b/documentation/Functions.md
index 1ea66fbf..27fc5d8a 100644
--- a/documentation/Functions.md
+++ b/documentation/Functions.md
@@ -254,7 +254,7 @@ Please try not to use custom placeholders. Keep in mind that you might want to b
The option to insert at a linenumber uses a placeholder inserted by a script and just adds it at the step you also insert the content.
Note:
-1. The command for execution will be generated by katacoda runner, so user will have to execute this command manually.
+1. The command for execution will be generated by Katacoda runner, so user will have to execute this command manually.
2. You should not use linenumber and placeholder in the same function.