summaryrefslogtreecommitdiff
path: root/update-docs.ps1
diff options
context:
space:
mode:
authorE.Z. Hart <hartez@users.noreply.github.com>2016-04-19 00:58:16 -0600
committerJason Smith <jason.smith@xamarin.com>2016-04-18 23:58:16 -0700
commite2d3adcdafa3b1dab50b4556e061b809c4c53cd5 (patch)
tree37c1229aedb4e1cb53ba30737b7685ab533eb776 /update-docs.ps1
parentd51b17aece6bb5db839090616bc61fc6aac76b40 (diff)
downloadxamarin-forms-e2d3adcdafa3b1dab50b4556e061b809c4c53cd5.tar.gz
xamarin-forms-e2d3adcdafa3b1dab50b4556e061b809c4c53cd5.tar.bz2
xamarin-forms-e2d3adcdafa3b1dab50b4556e061b809c4c53cd5.zip
Create more helpful version of docs update script (#107)
Diffstat (limited to 'update-docs.ps1')
-rw-r--r--update-docs.ps179
1 files changed, 79 insertions, 0 deletions
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