update.ps1 868 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 | Where-Object href -Match $regex | Select-Object -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+)('.*')" = "`$1'$($Latest.URL32)'"
  15. "(\s+checksum\s+=\s+)('.*')" = "`$1'$($Latest.Checksum32)'"
  16. "(\s+checksumType\s+=\s+)('.*')" = "`$1'$($Latest.ChecksumType32)'"
  17. }
  18. }
  19. }
  20. update -ChecksumFor 32