Skip to content

Commit 8903b0f

Browse files
author
Qingqing Sun
committed
update repo
1 parent a64ae2d commit 8903b0f

File tree

447 files changed

+140
-1194
lines changed

Some content is hidden

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

447 files changed

+140
-1194
lines changed

README.md

Lines changed: 3 additions & 0 deletions

appveyor.yml

Lines changed: 109 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,77 +4,153 @@ environment:
44

55
build_script:
66
- ps: |
7-
$RootFolderPath = (Get-Item -Path ".\" -Verbose).FullName
8-
$docPath = Join-Path $RootFolderPath $env:DocFolder
9-
7+
Write-Host "Begin processing files"
8+
9+
$docPath = Join-Path (Get-Item -Path ".\" -Verbose).FullName $env:DocFolder
1010
$files = Get-ChildItem -Path $docPath -Recurse | where {$_.extension -eq $env:Extension} | % { $_.FullName }
11-
11+
$source_repo = "source_repo: " + $env:SourceRepo
12+
$source_branch = "source_branch: " + $env:SourceBranch
13+
1214
Write-Host "Found " $files.count "Files"
1315
1416
foreach($file in $files)
1517
{
16-
$found = (Get-Content $file | Out-String) -match '^(?s)\s*[-]{3}(.*?)[-]{3}\r?\n'
18+
if(!((Get-Content $file | Out-String) -match '^(?s)\s*[-]{3}(.*?)[-]{3}\r?\n'))
19+
{
20+
continue
21+
}
22+
23+
$header = $matches[1]
24+
$new_header = $matches[1]
25+
26+
#metadata: updated_at
27+
$date = [datetime](Get-ItemProperty -Path $file -Name LastWriteTime).lastwritetime
28+
29+
if($header -match '$env:updateat[\s\S].*')
30+
{
31+
$new_header = $new_header.replace($matches[0], 'updated_at: ' + (Get-Date $date -format g))
32+
}
33+
else
34+
{
35+
$new_header = $new_header + 'updated_at: ' + (Get-Date $date -format g) + "`r`n"
36+
}
37+
#metadata: ms.date
38+
if($header -match 'ms.date:[\s\S].*')
39+
{
40+
$new_header = $new_header.replace($matches[0], 'ms.date: ' + (Get-Date $date -format d))
41+
}
42+
else
43+
{
44+
$new_header = $new_header + 'ms.date: ' + (Get-Date $date -format d) + "`r`n"
45+
}
46+
47+
#metadata: ms.topic
48+
$topicType = 'reference'
49+
if($header -match 'Module Name')
50+
{
51+
$topicType = 'conceptual'
52+
}
53+
54+
if($header -match 'ms.topic:[\s|\S].*')
55+
{
56+
$new_header = $new_header.replace($matches[0], 'ms.topic: ' + $topicType)
57+
}
58+
else
59+
{
60+
$new_header = $new_header + 'ms.topic: ' + $topicType + "`r`n"
61+
}
1762
18-
if($found -and ($matches[1].contains('{{')) -or $matches[1].contains('}}'))
63+
#metadata: source_repo
64+
if($header -match 'source_repo[\s|\S].*')
1965
{
20-
Write-Host 'Found a bad file $file'
21-
$result = $matches[1].replace('{{', '').replace('}}', '')
22-
$content = (Get-Content $file | Out-String).Replace($matches[1], $result)
23-
Set-Content $file $content
66+
$new_header = $new_header.replace($matches[0], $source_repo)
2467
}
68+
else
69+
{
70+
$new_header = $new_header + $source_repo +"`r`n"
71+
}
72+
73+
#metadata: source_branch
74+
if($header -match 'source_branch[\s|\S].*')
75+
{
76+
$new_header = $new_header.replace($matches[0], $source_branch)
77+
}
78+
else
79+
{
80+
$new_header = $new_header + $source_branch + "`r`n"
81+
}
82+
83+
#metadata: git_commit
84+
$commitId = (git rev-list -1 HEAD $file)
85+
if($header -match 'git_commit:[\s|\S].*')
86+
{
87+
$new_header = $new_header.replace($matches[0], 'git_commit: ' + $commitId)
88+
}
89+
else
90+
{
91+
$new_header = $new_header + 'git_commit: ' + $commitId + "`r`n"
92+
}
93+
94+
#filter invalid characters
95+
if($header -match '{{' -or $header -match '}}')
96+
{
97+
$new_header = $new_header.replace('{{', '').replace('}}', '')
98+
}
99+
100+
#update file
101+
Set-Content $file (Get-Content $file | Out-String).replace($header, $new_header) -NoNewline
25102
}
26-
Write-Host 'Finished validate files.'
103+
Write-Host 'Finish processing files.'
27104
- ps: |
28-
function DoGetToc
105+
function GetToc
29106
{
30-
$RootFolderPath = (Get-Item -Path ".\" -Verbose).FullName
31-
$docPath = Join-Path $RootFolderPath $env:DocFolder
32-
$folders = Get-ChildItem $docPath | select-object name
33-
$tocPath = Join-Path $RootFolderPath "toc.yml"
34-
107+
$docPath = Join-Path (Get-Item -Path ".\" -Verbose).FullName $env:DocFolder
108+
$tocPath = Join-Path $docPath "toc.yml"
109+
35110
if(Test-Path $tocPath)
36111
{
37112
Remove-Item $tocPath
38113
}
39-
New-Item -path $RootFolderPath -name toc.yml
40-
GetToc $docPath $tocPath $env:Extension 0
114+
New-Item $tocPath
115+
DoGetToc $docPath $tocPath $env:Extension 0
41116
}
42-
43-
function global:GetToc($folderPath, $tocPath, $extension, $level)
117+
118+
function global:DoGetToc($folderPath, $tocPath, $extension, $level)
44119
{
45120
Write-Host "constructing toc in $folderPath"
46121
$pre = ""
122+
47123
for($i=0;$i -lt $level;$i++)
48124
{
49-
$pre = -Join($pre, " ")
125+
$pre = $pre + " "
50126
}
127+
51128
Add-Content -Path $tocPath -Value ($pre + "- name: " + (Split-Path -Path $folderPath -Leaf))
52129
$subFolders = Get-ChildItem $folderPath -Directory | Select-Object FullName
53130
54131
if($subFolders -eq $null)
55132
{
56133
$files = (Get-ChildItem $folderPath) | Where-Object { $_.Extension -eq $Extension } | select -ExpandProperty FullName
57-
# finding landing page inside folders
58134
$landingPage = ""
135+
59136
foreach($file in $files)
60137
{
61138
$found = (Get-Content $file | Out-String) -match '^(?s)\s*[-]{3}(.*?)[-]{3}\r?\n'
62-
if($found -and $matches[1].contains("Module Name"))
139+
if($found -and $matches[1] -match 'Module Name')
63140
{
64-
Add-Content -Path $tocPath -Value ($pre + " href: " + (Get-Item $file | Resolve-Path -Relative))
65-
Write-Host "found landing page $file in $folderPath"
141+
Add-Content -Path $tocPath -Value ($pre + " href: " + (Get-Item $file | Resolve-Path -Relative).replace($env:DocFolder + '\', ''))
66142
$landingPage = $file
67143
break
68144
}
69145
}
70146
Add-Content -Path $tocPath -Value ($pre + " items:")
71-
$pre = -Join($pre, " ")
147+
$pre = $pre + " "
72148
foreach($file in $files)
73149
{
74150
if($file -ne $landingPage)
75151
{
76152
Add-Content -Path $tocPath -Value ($pre + "- name: " + (Split-Path -Path $file -Leaf -Resolve).split('\.')[-2])
77-
Add-Content -Path $tocPath -Value ($pre + " href: " + (Get-Item $file | Resolve-Path -Relative))
153+
Add-Content -Path $tocPath -Value ($pre + " href: " + (Get-Item $file | Resolve-Path -Relative).replace($env:DocFolder + '\', ''))
78154
}
79155
}
80156
}
@@ -83,16 +159,16 @@ build_script:
83159
Add-Content -Path $tocPath -Value ($pre + " items:")
84160
foreach($subFolder in $subFolders)
85161
{
86-
GetToc $subFolder.FullName $tocPath $extension ($level+1)
162+
DoGetToc $subFolder.FullName $tocPath $extension ($level+1)
87163
}
88164
}
89165
}
90-
DoGetToc
166+
GetToc
91167
on_success:
92168
- git clone -q --branch=%TargetBranch% %ContentRepo% %TEMP%\AzurePowerShell
93-
- copy %APPVEYOR_BUILD_FOLDER%\toc.yml %TEMP%\AzurePowerShell
94-
- if exist %TEMP%\AzurePowerShell\%DocFolder% rmdir /s /q %TEMP%\AzurePowerShell\%DocFolder%
95-
- robocopy %APPVEYOR_BUILD_FOLDER%\%DocFolder% %TEMP%\AzurePowerShell\%DocFolder% /e & IF %ERRORLEVEL% LEQ 1 exit 0
169+
- ps: Get-ChildItem $env:TEMP\AzurePowerShell\$env:DocFolder -dir | Remove-Item -Recurse -Force
170+
- robocopy %APPVEYOR_BUILD_FOLDER%\%DocFolder% %TEMP%\AzurePowerShell\%DocFolder% /e & IF %ERRORLEVEL% LEQ 1 exit 0
171+
- copy %APPVEYOR_BUILD_FOLDER%\%DocFolder%\toc.yml %TEMP%\AzurePowerShell\%DocFolder%
96172
- cd %TEMP%\AzurePowerShell
97173
- git config --global credential.helper store
98174
- ps: Add-Content "$env:USERPROFILE\.git-credentials" "https://$($env:github_access_token):[email protected]`n"

appveyor_self.yml

Lines changed: 0 additions & 103 deletions
This file was deleted.

azureps-cmdlets-docs/Resource Manager/v1.0/API Management Cmdlets/Add-AzureRmApiManagementRegion.md renamed to azureps-cmdlets-docs/Active Directory/v1.0/Add-AzureRmApiManagementRegion.md

Lines changed: 6 additions & 0 deletions

azureps-cmdlets-docs/Resource Manager/v1.0/API Management Cmdlets/AzureRM.API Management.md renamed to azureps-cmdlets-docs/Active Directory/v1.0/AzureRM.API Management.md

Lines changed: 2 additions & 3 deletions

azureps-cmdlets-docs/Active Directory/v1.0/Active Directory Cmdlets/Add-AzureRmApiManagementRegion.md renamed to azureps-cmdlets-docs/Active Directory/v2.0/Add-AzureRmApiManagementRegion.md

azureps-cmdlets-docs/Active Directory/v1.0/Active Directory Cmdlets/AzureRM.API Management.md renamed to azureps-cmdlets-docs/Active Directory/v2.0/AzureRM.API Management.md

Lines changed: 2 additions & 3 deletions

azureps-cmdlets-docs/Active Directory/v2.0/Active Directory Cmdlets/Add-AzureRmApiManagementRegion.md renamed to azureps-cmdlets-docs/Resource Manager/API Management Cmdlets/v0.9.8/Add-AzureRmApiManagementRegion.md

azureps-cmdlets-docs/Active Directory/v2.0/Active Directory Cmdlets/AzureRM.API Management.md renamed to azureps-cmdlets-docs/Resource Manager/API Management Cmdlets/v0.9.8/AzureRM.API Management.md

Lines changed: 2 additions & 3 deletions

azureps-cmdlets-docs/Resource Manager/v0.9.8/API Management Cmdlets/Backup-AzureRmApiManagement.md renamed to azureps-cmdlets-docs/Resource Manager/API Management Cmdlets/v0.9.8/Backup-AzureRmApiManagement.md

0 commit comments

Comments
 (0)