Skip to content

Commit bc917c0

Browse files
author
begoldsm
committed
Merge branch 'preview' of https://github.com/Azure/azure-powershell into preview
2 parents d7454cb + 4705f27 commit bc917c0

File tree

1,568 files changed

+27479
-437085
lines changed

Some content is hidden

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

1,568 files changed

+27479
-437085
lines changed

appveyor.yml

Lines changed: 15 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -2,61 +2,29 @@ branches:
22
only:
33
- master
44
environment:
5+
nodejs_version: "6"
56
github_access_token:
67
secure: VMFbecLLHzDq/09YDPbcM0VDDSwwgY57vr5GXK6cZZ4Ti/Xs5RZoylzV8MMr1350
78

8-
build_script:
9-
- ps: |
10-
$ErrorActionPreference = "Stop"
11-
$response = Invoke-WebRequest ("https://api.github.com/repos/" + $env:APPVEYOR_REPO_NAME + "/releases/latest") -Timeout 10
12-
if($response -ne $null -and $response.StatusCode -ne 200)
13-
{
14-
$host.SetShouldExit(1)
15-
}
16-
17-
$unzip_path = "C:\projects\release"
18-
$unzip_file = $unzip_path + "zip"
19-
Invoke-WebRequest ($response.Content | ConvertFrom-Json).zipball_url -OutFile $unzip_file
20-
7z x $unzip_file -o"$unzip_path"
21-
$src = Join-Path (ls $unzip_path -dir | select -First 1 | % { $_.FullName }) "src"
22-
$global:output = Join-Path $unzip_path "output"
23-
ni $global:output -type dir
24-
$pattern = "\d(.\d)*"
25-
26-
foreach($folder in (ls $src -dir))
27-
{
28-
foreach($module in (ls $folder.FullName -dir | % { $_.FullName }))
29-
{
30-
# find out docs in help folder and version in .psd1 file
31-
$help = ls $module -dir -Recurse | ? { $_.Name -eq "help" } | select -First 1 | % { $_.FullName }
32-
if($help -eq $null)
33-
{
34-
continue
35-
}
36-
$psd1= ls $module | ? { $_.extension -eq ".psd1" } | select -First 1 | % { $_.FullName }
37-
if($psd1 -eq $null)
38-
{
39-
continue
40-
}
41-
if((gc $psd1 | Out-String) -notmatch "ModuleVersion\s*=\s*'$pattern'")
42-
{
43-
continue
44-
}
45-
if($matches[0] -match $pattern)
46-
{
47-
robocopy $help "*.md" (Join-Path $global:output $folder | Join-Path -ChildPath (gi $psd1).BaseName | Join-Path -ChildPath ("v" + $matches[0]))
48-
}
49-
}
50-
}
51-
test: off
52-
shallow_clone: true
53-
on_success:
9+
before_build:
10+
- ps: Install-Product node $env:nodejs_version
5411
- git config --global credential.helper store
5512
- ps: ac "$env:USERPROFILE\.git-credentials" "https://$($env:github_access_token):[email protected]`n"
5613
- git config --global user.email %email%
5714
- git config --global user.name %name%
15+
- git clone -q https://github.com/MicrosoftDocs/azure-psdocs-ciscripts azpsci
16+
- cd azpsci
17+
- npm install
18+
- npm install typescript
19+
- node ./node_modules/typescript/bin/tsc
20+
- cd ..
21+
build_script:
22+
- node azpsci/out/ci0.js src c:\projects\_output
23+
24+
test: off
25+
on_success:
5826
- git clone -q --branch=%target_branch% %content_repo% %TEMP%\Azure
5927
- cd %TEMP%\Azure
60-
- ps: ls $global:output -dir | % { copy $_.FullName (ls -dir | select -First 1) -Recurse -Force }
28+
- ps: ls c:\projects\_output -dir | % { copy $_.FullName (ls -dir | select -First 1) -Recurse -Force }
6129
- git add -A
6230
- git diff --quiet --exit-code --cached || git commit -m "Sync docs from source code repo to content repo." && git push origin %target_branch% && appveyor AddMessage "Content Updated"

build.proj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,16 +184,17 @@
184184
Targets="Build"
185185
Properties="Configuration=$(Configuration);Platform=Any CPU"
186186
BuildInParallel="$(BuildInParallel)"
187-
ContinueOnError="false" />
188-
187+
ContinueOnError="false" />
188+
189+
<Exec Command="$(PowerShellCommand) -NonInteractive -NoLogo -NoProfile -Command &quot;. $(LibraryToolsFolder)\GenerateHelp.ps1 -ValidateMarkdownHelp -GenerateMamlHelp -BuildConfig $(Configuration) &quot;" ContinueOnError="false"/>
189190
<CallTarget Targets="BuildSetupTest"/>
190191
<CallTarget Targets="CodeSignBinaries" Condition=" '$(CodeSign)' == 'true' " />
191192
<CallTarget Targets="BuildSetup"/>
192193
<CallTarget Targets="CodeSignInstaller"
193194
Condition=" '$(CodeSign)' == 'true' and '$(Scope)' == 'all'" />
194-
195195
<Message Importance="high" Text="Running Static Analyser" />
196196
<CallTarget targets="DependencyAnalysis" />
197+
<Exec Command="$(PowerShellCommand) -NonInteractive -NoLogo -NoProfile -Command &quot;. $(LibraryToolsFolder)\CleanupBuild.ps1 -BuildConfig $(Configuration) &quot;"/>
197198
</Target>
198199

199200
<!-- Do everything possible -->

documentation/help-generation.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Azure PowerShell Help Generation
2+
3+
## Description
4+
5+
All MAML files containing the help content for cmdlets have been removed from the Azure PowerShell repository and replaced with markdown files, which are generated and maintained using the [`platyPS`](https://github.com/PowerShell/platyPS) module. Each module has a `help` folder (_e.g.,_ `src/ResourceManager/Profile/Commands.Profile/help`) which contains a markdown file for each of the cmdlets found in that given module. When the help content for a cmdlet (or multiple cmdlets) needs to be updated, users will now only have to update the contents of the markdown file, _and not the MAML file as well_.
6+
7+
## Installing `platyPS`
8+
9+
In order to use the cmdlets necessary to update the markdown help files (or generate MAML help locally from these markdown files), you must first install the `platyPS` module mentioned previously.
10+
11+
To do so, you can can follow the below steps (which are outlined in the [**Quick start**](https://github.com/PowerShell/platyPS#quick-start) section of the `platyPS` README):
12+
13+
```powershell
14+
Install-Module -Name platyPS -Scope CurrentUser
15+
Import-Module platyPS
16+
```
17+
18+
**Note:** this module will need to be installed from the [PowerShell Gallery](http://www.powershellgallery.com/). If, for some reason, this isn't a registered repository when running the `Get-PSRepository` cmdlet, then you will need to register it by running the following command:
19+
20+
```powershell
21+
Register-PSRepository -Name PSGallery -SourceLocation https://www.powershellgallery.com/api/v2/
22+
```
23+
24+
## Using `platyPS`
25+
26+
### Importing your module
27+
28+
Before you run the `platyPS` cmdlets to update your markdown help files, you will need to first import the module containing the changes that you have made to your cmdlets into your current PowerShell session. Once you have built your project (either through Visual Studio or with `msbuild`), you can locate the module manifest that you will need to import in the `src/Package/Debug` folder of your local repository.
29+
30+
For example, if you have made changes to the `Profile` module, you will find the corresponding module manifest in `src/Package/Debug/ResourceManager/AzureResourceManager/AzureRM.Profile/AzureRM.Profile.psd1`.
31+
32+
Once you have located the module manifest, you can import it in your current PowerShell session by running the following command:
33+
34+
```powershell
35+
$PathToModuleManifest = "../../<module>.psd1"
36+
Import-Module -Name $PathToModuleManifest
37+
```
38+
39+
**Note**: if you do not see all of the changes you made to the cmdlets in your markdown files (_e.g.,_ a cmdlet you deleted is still appearing), you may need to delete any existing Azure PowerShell modules that you have on your machine (installed either through the PowerShell Gallery or by Web Platform Installer) before you import your module.
40+
41+
### Updating help after making cmdlet changes
42+
43+
Whenever the public interface for a cmdlet has changed, the corresponding markdown file for that cmdlet will need to be updated to reflect the changes. Public interface changes include the following:
44+
45+
- Add/change/remove parameter set
46+
- Add/remove parameter
47+
- Change attribute of a parameter
48+
- Type
49+
- Parameter set(s)
50+
- Aliases
51+
- Mandatory
52+
- Position
53+
- Accept pipeline input
54+
- Add/change output type
55+
56+
#### Updating all markdown files in a module
57+
58+
To update all of the markdown files for a single module, use the [`Update-MarkdownHelpModule`](https://github.com/PowerShell/platyPS/blob/master/docs/Update-MarkdownHelpModule.md) cmdlet:
59+
60+
```powershell
61+
$PathToModuleManifest = "../../<module.psd1" # Full path to the module manifest that you have updated
62+
Import-Module -Name $PathToModuleManifest
63+
64+
$PathToHelpFolder = "../../help" # Full path to help folder containing markdown files to be updated
65+
Update-MarkdownHelpModule -Path $PathToHelpFolder -RefreshModulePage -AlphabeticParamsOrder
66+
```
67+
68+
This will update all of the markdown files with public interface changes made to corresponding cmdlets, add markdown files for any new cmdlets, remove markdown files for any deleted cmdlets, and update the module page (_e.g.,_ `AzureRM.Profile.md`) with any added or removed cmdlets.
69+
70+
#### Updating a single markdown file
71+
72+
To update a single markdown file with the changes made to the corresponding cmdlet, use the [`Update-MarkdownHelp`](https://github.com/PowerShell/platyPS/blob/master/docs/Update-MarkdownHelp.md) cmdlet:
73+
74+
```powershell
75+
$PathToModuleManifest = "../../<module>.psd1" # Full path to the module manifest that you have updated
76+
Import-Module -Name $PathToModuleManifest
77+
78+
$PathToMarkdownFile = "../../<cmdlet>.md" # Full path to the markdown file to be updated
79+
Update-MarkdownHelp -Path $PathToMarkdownFile -AlphabeticParamsOrder
80+
```
81+
82+
#### Generating and viewing the MAML help
83+
84+
During the build, the MAML help will be generated from the markdown files in the repository. If you would like to generate the MAML help and preview what the help content will look like for each of your cmdlets, you can do so with two more commands.
85+
86+
To generate the MAML help based on the contents of your markdown files, use the [`New-ExternalHelp`](https://github.com/PowerShell/platyPS/blob/master/docs/New-ExternalHelp.md) cmdlet:
87+
88+
```powershell
89+
$PathToHelpFolder = "../../help" # Full path to help folder containing markdown files to be updated
90+
$PathToOutputFolder = "../../.." # Full path to folder where you want the MAML file to be generated
91+
New-ExternalHelp -Path $PathToHelpFolder -OutputPath $PathToOutputFolder
92+
```
93+
94+
To preview the help that you just generated, use the [`Get-HelpPreview`](https://github.com/PowerShell/platyPS/blob/master/docs/Get-HelpPreview.md) cmdlet:
95+
96+
```powershell
97+
$PathToMAML = "../../<maml>.dll-Help.xml" # Full path to the MAML file that was generated
98+
99+
# Save the help locally
100+
$help = Get-HelpPreview -Path $PathToMAML
101+
102+
# Get the help for a specific cmdlet
103+
$help | where { $_.Name -eq "<cmdlet>" }
104+
```

0 commit comments

Comments
 (0)