@@ -15,11 +15,6 @@ function New-ServiceMarkdownHelp
15
15
[ValidateSet (" Debug" , " Release" )]
16
16
[String ]$BuildTarget ,
17
17
18
- [Parameter (ParameterSetName = " ResourceManager" , Mandatory = $True )]
19
- [Parameter (ParameterSetName = " ServiceManagement" , Mandatory = $True )]
20
- [Parameter (ParameterSetName = " Storage" , Mandatory = $True )]
21
- [String ]$PathToRepo ,
22
-
23
18
[Parameter (ParameterSetName = " ResourceManager" , Mandatory = $True )]
24
19
[Switch ]$ResourceManager ,
25
20
@@ -33,37 +28,40 @@ function New-ServiceMarkdownHelp
33
28
[String ]$PathToModule ,
34
29
35
30
[Parameter (ParameterSetName = " FullPath" , Mandatory = $True )]
36
- [String ]$PathToCommandsFolder ,
37
-
38
- [Parameter (ParameterSetName = " FullPath" , Mandatory = $True )]
39
- [String ]$ModuleName
31
+ [String ]$PathToCommandsFolder
40
32
)
41
33
42
34
PROCESS
43
35
{
36
+ # Get the path to the platyPSHelp module root
37
+ $PSModule = $ExecutionContext.SessionState.Module
38
+ $PSModuleRoot = $PSModule.ModuleBase
39
+
40
+ # Use the platyPSHelp module root to get the path to the repository
41
+ $PathToRepo = (Get-Item $PSModuleRoot ).Parent.Parent.FullName
42
+
44
43
# Set the necessary variables for an ARM service
45
44
if ($ResourceManager.IsPresent )
46
45
{
47
46
$PathToModule = " $PathToRepo \src\Package\$BuildTarget \ResourceManager\AzureResourceManager\AzureRM.$Service \AzureRM.$Service .psd1"
48
47
$PathToCommandsFolder = " $PathToRepo \src\ResourceManager\$Service \Commands.$Service "
49
- $ModuleName = " AzureRM.$Service "
50
48
}
51
49
# Set the necessary variables for an RDFE service
52
50
elseif ($ServiceManagement.IsPresent )
53
51
{
54
52
throw " Currently platyPSHelp is unavailable for RDFE services. Please refer to the platyps-help.md documentation for more information."
55
53
$PathToModule = Get-ServiceManagementDll - Service $Service - PathToAzure " $PathToRepo \src\Package\$BuildTarget \ServiceManagement\Azure"
56
54
$PathToCommandsFolder = " $PathToRepo \src\ServiceManagement\$Service \Commands.$Service "
57
- $ModuleName = Get-ServiceManagementModuleName - PathToModule $PathToModule
58
55
}
59
56
# Set the necessary variables for Storage
60
57
elseif ($Storage.IsPresent )
61
58
{
62
59
$PathToModule = " $PathToRepo \src\Package\$BuildTarget \Storage\Azure.Storage\Azure.Storage.psd1"
63
60
$PathToCommandsFolder = " $PathToRepo \src\Storage\Commands.Storage"
64
- $ModuleName = " Azure.Storage"
65
61
}
66
62
63
+ $ModuleName = (Get-Item $PathToModule ).BaseName
64
+
67
65
# If the "FullPath" parameter set is not used, make sure the paths created above are accessible
68
66
if (! ($PSCmdlet.ParameterSetName -eq " FullPath" ))
69
67
{
@@ -154,11 +152,6 @@ function Update-ServiceMarkdownHelp
154
152
[ValidateSet (" Debug" , " Release" )]
155
153
[String ]$BuildTarget ,
156
154
157
- [Parameter (ParameterSetName = " ResourceManager" , Mandatory = $True )]
158
- [Parameter (ParameterSetName = " ServiceManagement" , Mandatory = $True )]
159
- [Parameter (ParameterSetName = " Storage" , Mandatory = $True )]
160
- [String ]$PathToRepo ,
161
-
162
155
[Parameter (ParameterSetName = " ResourceManager" , Mandatory = $True )]
163
156
[Switch ]$ResourceManager ,
164
157
@@ -172,37 +165,40 @@ function Update-ServiceMarkdownHelp
172
165
[String ]$PathToModule ,
173
166
174
167
[Parameter (ParameterSetName = " FullPath" , Mandatory = $True )]
175
- [String ]$PathToCommandsFolder ,
176
-
177
- [Parameter (ParameterSetName = " FullPath" , Mandatory = $True )]
178
- [String ]$ModuleName
168
+ [String ]$PathToCommandsFolder
179
169
)
180
170
181
- PROCESS
171
+ PROCESS
182
172
{
173
+ # Get the path to the platyPSHelp module root
174
+ $PSModule = $ExecutionContext.SessionState.Module
175
+ $PSModuleRoot = $PSModule.ModuleBase
176
+
177
+ # Use the platyPSHelp module root to get the path to the repository
178
+ $PathToRepo = (Get-Item $PSModuleRoot ).Parent.Parent.FullName
179
+
183
180
# Set the necessary variables for an ARM service
184
181
if ($ResourceManager.IsPresent )
185
182
{
186
183
$PathToModule = " $PathToRepo \src\Package\$BuildTarget \ResourceManager\AzureResourceManager\AzureRM.$Service \AzureRM.$Service .psd1"
187
184
$PathToCommandsFolder = " $PathToRepo \src\ResourceManager\$Service \Commands.$Service "
188
- $ModuleName = " AzureRM.$Service "
189
185
}
190
186
# Set the necessary variables for an RDFE service
191
187
elseif ($ServiceManagement.IsPresent )
192
188
{
193
189
throw " Currently platyPSHelp is unavailable for RDFE services. Please refer to the platyps-help.md documentation for more information."
194
190
$PathToModule = " $PathToRepo \src\Package\$BuildTarget \ServiceManagement\Azure\Azure.psd1"
195
191
$PathToCommandsFolder = " $PathToRepo \src\ServiceManagement\$Service \Commands.$Service "
196
- $ModuleName = " Azure"
197
192
}
198
193
# Set the necessary variables for Storage
199
194
elseif ($Storage.IsPresent )
200
195
{
201
196
$PathToModule = " $PathToRepo \src\Package\$BuildTarget \Storage\Azure.Storage\Azure.Storage.psd1"
202
197
$PathToCommandsFolder = " $PathToRepo \src\Storage\Commands.Storage"
203
- $ModuleName = " Azure.Storage"
204
198
}
205
199
200
+ $ModuleName = (Get-Item $PathToModule ).BaseName
201
+
206
202
# If the "FullPath" parameter set is not used, make sure the paths created above are accessible
207
203
if (! ($PSCmdlet.ParameterSetName -eq " FullPath" ))
208
204
{
@@ -223,7 +219,7 @@ function Update-ServiceMarkdownHelp
223
219
Import-Module $PathToModule - Scope Global
224
220
225
221
# Update the markdown files with the changes made in the cmdlets
226
- Update-MarkdownHelpModule $PathToHelp - AlphabeticParamsOrder
222
+ Update-MarkdownHelpModule $PathToHelp - AlphabeticParamsOrder - RefreshModulePage
227
223
228
224
# Generate the MAML help file from the markdown files
229
225
New-ServiceExternalHelp - PathToCommandsFolder $PathToCommandsFolder
@@ -327,29 +323,6 @@ function Get-ServiceManagementDll
327
323
throw " Unable to find dll for the given service."
328
324
}
329
325
330
- function Get-ServiceManagementModuleName
331
- {
332
- [CmdletBinding ()]
333
- Param (
334
- [Parameter (Mandatory = $True )]
335
- [String ]$PathToModule
336
- )
337
-
338
- for (;;)
339
- {
340
- if ($PathToModule.IndexOf (" \" ) -lt 0 )
341
- {
342
- break
343
- }
344
-
345
- $idx = $PathToModule.IndexOf (" \" )
346
- $PathToModule = $PathToModule.Substring ($idx + 1 )
347
- }
348
-
349
- $idx = $PathToModule.IndexOf (" .dll" )
350
- return $PathToModule.Substring (0 , $idx )
351
- }
352
-
353
326
<#
354
327
. ExternalHelp help\platyPSHelp-help.xml
355
328
#>
@@ -361,11 +334,6 @@ function Validate-ServiceMarkdownHelp
361
334
[Parameter (ParameterSetName = " ServiceManagement" , Mandatory = $True )]
362
335
[String ]$Service ,
363
336
364
- [Parameter (ParameterSetName = " ResourceManager" , Mandatory = $True )]
365
- [Parameter (ParameterSetName = " ServiceManagement" , Mandatory = $True )]
366
- [Parameter (ParameterSetName = " Storage" , Mandatory = $True )]
367
- [String ]$PathToRepo ,
368
-
369
337
[Parameter (ParameterSetName = " ResourceManager" , Mandatory = $True )]
370
338
[Switch ]$ResourceManager ,
371
339
@@ -384,6 +352,13 @@ function Validate-ServiceMarkdownHelp
384
352
385
353
PROCESS
386
354
{
355
+ # Get the path to the platyPSHelp module root
356
+ $PSModule = $ExecutionContext.SessionState.Module
357
+ $PSModuleRoot = $PSModule.ModuleBase
358
+
359
+ # Use the platyPSHelp module root to get the path to the repository
360
+ $PathToRepo = (Get-Item $PSModuleRoot ).Parent.Parent.FullName
361
+
387
362
# Set the necessary variables for an ARM service
388
363
if ($ResourceManager.IsPresent )
389
364
{
0 commit comments