update.ps1 809 B

1234567891011121314151617181920212223
  1. Import-Module au
  2. $latest_release = 'https://github.com/rightscale/right_st/releases/latest'
  3. function global:au_GetLatest {
  4. $download_page = Invoke-WebRequest -Uri $latest_release -UseBasicParsing
  5. $regex = '^.+/v(\d+\.\d+\.\d+)/right_st-windows-amd64\.zip$'
  6. $url64 = $download_page.Links | ? href -Match $regex | select -First 1 -ExpandProperty href
  7. $version = $url64 -replace $regex, '$1'
  8. return @{ Version = $version; URL64 = $url64 }
  9. }
  10. function global:au_SearchReplace {
  11. @{
  12. 'tools\chocolateyInstall.ps1' = @{
  13. "(^\s+url64bit\s+=\s+)('.*')" = "`$1'$($Latest.URL64)'"
  14. "(^\s+checksum64\s+=\s+)('.*')" = "`$1'$($Latest.Checksum64)'"
  15. "(^\s+checksumType64\s+=\s+)('.*')" = "`$1'$($Latest.ChecksumType64)'"
  16. }
  17. }
  18. }
  19. update -ChecksumFor 64