drohm

Simple Talk PS Module Doc Generation Script

Apr 13th, 2016
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $docTitle = 'Module Repository Documentation'
  2. $namespaces = 'RELENG'
  3. $revDate = Get-Date -UFormat '%Y-%m-%d'
  4. $copyRightDate = Get-Date -UFormat '%Y'
  5. $docWebPath = 'D:\WebSites\ModuleRepository.Documentation'
  6. $profilePath = Split-Path $profile
  7.  
  8. $moduleRepoVersionToDocument = 'Prod'
  9. $docSourceBasePath = 'D:\Dev\RelEng\ModuleRepository'
  10. $docSourceModulesPath = '{0}\{1}' -f $docSourceBasePath, $moduleRepoVersionToDocument
  11. $docSourceGeneratorPath = '{0}\Documentation' -f $docSourceBasePath
  12.  
  13. $docGenerationInputPath = '{0}\Modules\RELENG' -f $profilePath
  14. $docTreeGeneratorModulePath = '{0}\Modules\DocTreeGenerator' -f $profilePath
  15.  
  16. function Update-DocTreeModuleAndWebFiles
  17. {
  18.     Copy-Item -Path ('{0}\DocTreeGenerator.psm1' -f $docSourceGeneratorPath) -Destination $docTreeGeneratorModulePath -Force
  19.     Copy-Item -Path ('{0}\DocTreeGenerator.psd1' -f $docSourceGeneratorPath) -Destination $docTreeGeneratorModulePath -Force
  20.     Copy-Item -Path ('{0}\psdoc_template.html' -f $docSourceGeneratorPath) -Destination $docTreeGeneratorModulePath -Force
  21.     Copy-Item -Path ('{0}\module_overview.html' -f $docSourceGeneratorPath) -Destination $docTreeGeneratorModulePath -Force
  22.  
  23.     Import-Module DocTreeGenerator
  24.  
  25.     Copy-Item -Path ('{0}\cleancode.css' -f $docSourceGeneratorPath) -Destination $docWebPath -Force
  26.     Copy-Item -Path ('{0}\images' -f $docSourceGeneratorPath) -Destination ('{0}\images' -f $docWebPath) -Recurse -Force
  27. }
  28.  
  29. New-Item -ItemType Directory -Path $docGenerationInputPath | Out-Null
  30.  
  31. Push-Location -Path 'D:\Dev\RelEng'
  32. git.exe pull
  33. Pop-Location
  34.  
  35. Update-DocTreeModuleAndWebFiles
  36.  
  37. Copy-Item -Path ('{0}\*' -f $docSourceModulesPath) -Destination $docGenerationInputPath -Recurse -Force
  38.  
  39. Convert-HelpToHtmlTree -Namespaces $namespaces -TargetDir $docWebPath -DocTitle $docTitle -RevisionDate $revDate -Copyright $copyRightDate
  40.  
  41. Remove-Item -Recurse -Force $docGenerationInputPath | Out-Null
Advertisement
Add Comment
Please, Sign In to add comment