update.ps1 942 B

123456789101112131415161718192021222324
  1. Import-Module au
  2. $latest_release = 'https://bluebrick.lswproject.com/download.html'
  3. function global:au_GetLatest {
  4. $download_page = Invoke-WebRequest -Uri $latest_release
  5. $regex = '^.+/BlueBrick(\d+\.\d+\.\d+)\.zip$'
  6. $url = $download_page.Links | ? href -Match $regex | select -First 1 -ExpandProperty href
  7. $url = [System.Uri]::new([System.Uri]$latest_release, $url).AbsoluteUri
  8. $version = $url -replace $regex, '$1'
  9. return @{ Version = $version; URL32 = $url }
  10. }
  11. function global:au_SearchReplace {
  12. @{
  13. 'tools\chocolateyInstall.ps1' = @{
  14. "(\s+url\s+=\s+)('.*')(\s+#\sBlueBrick)" = "`$1'$($Latest.URL32)'`$3"
  15. "(\s+checksum\s+=\s+)('.*')(\s+#\sBlueBrick)" = "`$1'$($Latest.Checksum32)'`$3"
  16. "(\s+checksumType\s+=\s+)('.*')(\s+#\sBlueBrick)" = "`$1'$($Latest.ChecksumType32)'`$3"
  17. }
  18. }
  19. }
  20. update -ChecksumFor 32