update.ps1 834 B

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