From e2d3adcdafa3b1dab50b4556e061b809c4c53cd5 Mon Sep 17 00:00:00 2001 From: "E.Z. Hart" Date: Tue, 19 Apr 2016 00:58:16 -0600 Subject: Create more helpful version of docs update script (#107) --- update-docs.ps1 | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 update-docs.ps1 (limited to 'update-docs.ps1') diff --git a/update-docs.ps1 b/update-docs.ps1 new file mode 100644 index 00000000..86b3eb84 --- /dev/null +++ b/update-docs.ps1 @@ -0,0 +1,79 @@ +param( + [Parameter(Position = 0)] + [String]$MdocPath = ".\tools\mdoc\mdoc.exe", + [Parameter(Position = 1)] + [String]$ProfilePath = "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.5\Profile\Profile259" +) + +function Update +{ + param + ( + [string]$dllPath, + [string]$docsPath + ) + + Write-Host "Updating docs for $dllPath ..." + & $MdocPath update --delete $dllPath -L $ProfilePath --out $docsPath +} + +function ParseChanges +{ + param + ( + [string]$dllPath, + [string]$docsPath, + [string[]]$changes + ) + + $suggestedCommands = @() + + $changes | % {$n=0} { + if($changes[$n+1] -match "Member Added:" -or $changes[$n+1] -match "Member Removed:"){ + + if($changes[$n] -match "^Updating: (.*)"){ + $modified = "$($docsPath.Replace("\", "/"))/$(ClassToXMLPath($matches[1]))" + Write-Host "$modified was modified" + $suggestedCommands += "git add $modified" + } + + } + $n = $n + 1 + } + + if($suggestedCommands.Length -gt 0) { + Write-Host "Suggested git commands:" + $suggestedCommands | % { Write-Host $_ } + } else { + Write-Host "No actual docs changes were made." + } +} + +function ClassToXMLPath +{ + param( [string]$class ) + $lastDot = $class.LastIndexOf(".") + return $class.Substring(0, $lastDot) + "/" + $class.Substring($lastDot + 1, $class.Length - $lastDot - 1) + ".xml" +} + +# Core +$dllPath = "Xamarin.Forms.Core\bin\Debug\Xamarin.Forms.Core.dll" +$docsPath = "docs\Xamarin.Forms.Core" +$changes = Update $dllPath $docsPath +ParseChanges $dllPath $docsPath $changes + +Write-Host + +# Xaml +$dllPath = "Xamarin.Forms.Xaml\bin\Debug\Xamarin.Forms.Xaml.dll" +$docsPath = "docs\Xamarin.Forms.Xaml" +$changes = Update $dllPath $docsPath +ParseChanges $dllPath $docsPath $changes + +Write-Host + +# Maps +$dllPath = "Xamarin.Forms.Maps\bin\Debug\Xamarin.Forms.Maps.dll" +$docsPath = "docs\Xamarin.Forms.Maps" +$changes = Update $dllPath $docsPath +ParseChanges $dllPath $docsPath $changes \ No newline at end of file -- cgit v1.2.3