update.ps1 953 B

12345678910111213141516171819202122232425262728293031
  1. import-module au
  2. $releases = 'https://github.com/htacg/tidy-html5/releases'
  3. function global:au_SearchReplace {
  4. @{
  5. 'tools\chocolateyInstall.ps1' = @{
  6. "(^[$]url64\s*=\s*)('.*')" = "`$1'$($Latest.URL64)'"
  7. "(^[$]url32\s*=\s*)('.*')" = "`$1'$($Latest.URL32)'"
  8. "(^[$]checksum32\s*=\s*)('.*')" = "`$1'$($Latest.Checksum32)'"
  9. "(^[$]checksum64\s*=\s*)('.*')" = "`$1'$($Latest.Checksum64)'"
  10. }
  11. }
  12. }
  13. function global:au_GetLatest {
  14. $download_page = Invoke-WebRequest -Uri $releases
  15. #tidy-5.1.25-win64.zip
  16. $re = "tidy-.+-win(32|64).zip"
  17. $url = $download_page.links | ? href -match $re | select -First 2 -expand href
  18. $version = $url[0] -split '-' | select -Last 1 -Skip 1
  19. $url32 = 'https://github.com' + $url[0]
  20. $url64 = 'https://github.com' + $url[1]
  21. $Latest = @{ URL32 = $url32; URL64 = $url64; Version = $version }
  22. return $Latest
  23. }
  24. update