Skip to content

Commit c24dfaf

Browse files
author
Florian Wagner
authored
Improved documentation (#20)
* Improve Auto Generated Doc Signed-off-by: Florian Wagner <florian.wagner@microsoft.com> * Add images Signed-off-by: Florian Wagner <florian.wagner@microsoft.com>
1 parent 0aa5ce4 commit c24dfaf

42 files changed

Lines changed: 178 additions & 46 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Deploy/OneClickDeploy.ps1

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ After the script is successfully executed the bot should be in a usable state
3030
None. You cannot pipe objects.
3131
3232
.OUTPUTS
33-
None
33+
System.Boolean. Returns $True if executed successfully
3434
3535
#>
3636
param(
@@ -80,7 +80,7 @@ param(
8080
$success = $True
8181
# Import Helper functions
8282
. "$($MyInvocation.MyCommand.Path -replace($MyInvocation.MyCommand.Name))\HelperFunctions.ps1"
83-
# Tell who you are (See HelperFunction.ps1)
83+
# Tell who you are (See HelperFunctions.ps1)
8484
Write-WhoIAm
8585

8686
# Validate Input parameter combination
@@ -128,4 +128,6 @@ if ($success -eq $False -or $validationresult -eq $False)
128128
Write-Host -ForegroundColor Red "`n`n# ERROR Occured while execution. Please check your output for errors and rerun the script or scriptlets.`n# Include the '-RERUN `$True' flag in case the execution of script 'DeployInfrastructure.ps1' was already successful."
129129
} else {
130130
Write-ExecutionStatus -success $success
131-
}
131+
}
132+
133+
exit $success

Doc/CreateMarkdown-FromPS1.ps1

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function Get-ParameterMarkdownTable {
4040
[object] $help
4141
)
4242

43-
$result = "| Name | Type | Required | Default | Description |`n| - | - | - | - | - |"
43+
$result = "`n`n## Parameters`n`n| Name | Type | Required | Default | Description |`n| - | - | - | - | - |"
4444

4545
#Write-Host $help
4646

@@ -62,7 +62,13 @@ function Get-ParameterMarkdownTable {
6262
$result += "`n| $($_.name) | $($_.type.name) | $($_.required) | $($default) | $($description) |"
6363
})
6464

65-
return $result
65+
if ($help.parameters -ne "")
66+
{
67+
return $result
68+
} else {
69+
return ""
70+
}
71+
6672
}
6773

6874
function Get-Examples {
@@ -93,6 +99,8 @@ function Get-FlowChart {
9399
$flowchartfile = "flowchart/$($fileparts[0]).flowchart"
94100
if (Test-Path -Path $flowchartfile)
95101
{
102+
# Force LF style
103+
(Get-Content $flowchartfile -Raw).Replace("`r`n","`n") | Set-Content $flowchartfile -Force
96104
# render flowchart
97105
diagrams flowchart $flowchartfile > $null
98106

@@ -101,7 +109,38 @@ function Get-FlowChart {
101109
} else {
102110
return ""
103111
}
112+
}
113+
114+
function Get-RelatedScripts {
115+
param (
116+
# PS1 file
117+
[Parameter(Mandatory=$True,HelpMessage="PS1 file")]
118+
[object] $file
119+
)
120+
121+
$script = Get-Content -Path $file.FullName
122+
123+
$results = $script | Select-String "([\w]+)\.ps1" -AllMatches
104124

125+
# Display only Unique values
126+
$matches = $results.Matches.Value | Select-Object -uniq
127+
# Remove self references
128+
$matches = $matches -ne $file.name
129+
# Remove Helper Function references
130+
$matches = $matches -ne "HelperFunctions.ps1"
131+
$matches = $matches -ne "HelperFunction.ps1"
132+
$matches.foreach({
133+
$fileparts = $_.Split('.')
134+
$related += "`n- [$_]($($fileparts[0]).md)`n"
135+
})
136+
137+
#Write-Host $results.Matches
138+
139+
if ($null -ne $related) {
140+
return "`n`n## Related Scripts$related"
141+
} else {
142+
return ""
143+
}
105144
}
106145

107146
function ConvertHelpToMarkdown {
@@ -129,13 +168,15 @@ function ConvertHelpToMarkdown {
129168
$markdown += "`n`n## Description`n`n$($help.description.text)"
130169

131170
# Parameters
132-
$parameters = Get-ParameterMarkdownTable -help $help
133-
$markdown += "`n`n## Parameters`n`n$($parameters)"
171+
$markdown += Get-ParameterMarkdownTable -help $help
134172

135173
# Examples
136174
$examples = Get-Examples -help $help
137175
$markdown += "`n`n## Examples`n`n$($examples)"
138176

177+
# Get Related Script
178+
$markdown += Get-RelatedScripts -file $file
179+
139180
# flowchart
140181
$markdown += Get-FlowChart -file $file.name
141182

Doc/Deploy/CreateOrImportSSL.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,22 @@ After the script is successfully executed the Bot should be in a usable from wit
4747
```
4848

4949

50+
## Related Scripts
51+
- [OneClickDeploy.ps1](OneClickDeploy.md)
52+
53+
- [ValidateParameter.ps1](ValidateParameter.md)
54+
55+
- [CheckExistingSSL.ps1](CheckExistingSSL.md)
56+
57+
- [DeactivateSSL.ps1](DeactivateSSL.md)
58+
59+
- [ImportSSL.ps1](ImportSSL.md)
60+
61+
- [CreateSSL.ps1](CreateSSL.md)
62+
63+
- [ActivateSSL.ps1](ActivateSSL.md)
64+
65+
5066
## Flowchart
5167

5268
<div align='center'>

Doc/Deploy/CreateSSL.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ After the script is successfully executed the certificate should be stored in Ke
3535
```
3636

3737

38+
## Related Scripts
39+
- [ActivateSSL.ps1](ActivateSSL.md)
40+
41+
3842
## Flowchart
3943

4044
<div align='center'>

Doc/Deploy/DeactivateSSL.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ This script will do following steps:
1111
1. Read relevant data of TrafficManager from Terraform Infrastructure execution
1212
2. Delete all TrafficManager endpoints, this will also remove the custom domain name entry from WebApps automatically
1313

14-
## Parameters
15-
16-
| Name | Type | Required | Default | Description |
17-
| - | - | - | - | - |
18-
1914
## Examples
2015

2116
```powershell

Doc/Deploy/OneClickDeploy.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,20 @@ After the script is successfully executed the bot should be in a usable state
4444
```
4545

4646

47+
## Related Scripts
48+
- [ValidateParameter.ps1](ValidateParameter.md)
49+
50+
- [DeployInfrastructure.ps1](DeployInfrastructure.md)
51+
52+
- [DeployLUIS.ps1](DeployLUIS.md)
53+
54+
- [DeployBot.ps1](DeployBot.md)
55+
56+
- [CreateOrImportSSL.ps1](CreateOrImportSSL.md)
57+
58+
- [RetrieveWebChatLink.ps1](RetrieveWebChatLink.md)
59+
60+
4761
## Flowchart
4862

4963
<div align='center'>

Doc/Deploy/OneClickDestroy.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ After the script is successfully executed there should be nothing left
3434
```
3535

3636

37+
## Related Scripts
38+
- [ExportSSL.ps1](ExportSSL.md)
39+
40+
3741
## Flowchart
3842

3943
<div align='center'>

Doc/Deploy/RetrieveWebChatLink.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ This script will do following steps:
1313

1414
After the script is successfully executed you should have a link to check you bot
1515

16-
## Parameters
17-
18-
| Name | Type | Required | Default | Description |
19-
| - | - | - | - | - |
20-
2116
## Examples
2217

2318
```powershell

Doc/Deploy/ValidateParameter.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ After the script is successfully executed it should be ensured that the deployme
4242
```
4343

4444

45+
## Related Scripts
46+
- [OneClickDeploy.ps1](OneClickDeploy.md)
47+
48+
4549
## Flowchart
4650

4751
<div align='center'>

Doc/flowchart/CreateOrImportSSL.flowchart.svg

Lines changed: 1 addition & 1 deletion
Loading

0 commit comments

Comments
 (0)