update.ps1 911 B

12345678910111213141516171819202122232425
  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 -UseBasicParsing
  5. $regex = '^/rightscale/rsc/tree/(v\d+\.\d+\.\d+)$'
  6. $tree = $download_page.Links | ? href -Match $regex | select -First 1 -ExpandProperty href
  7. $branch = $tree -replace $regex, '$1'
  8. $version = $branch.Substring(1)
  9. $url64 = "https://binaries.rightscale.com/rsbin/rsc/$branch/rsc-windows-amd64.zip"
  10. return @{ Version = $version; URL64 = $url64 }
  11. }
  12. function global:au_SearchReplace {
  13. @{
  14. 'tools\chocolateyInstall.ps1' = @{
  15. "(^\s+url64bit\s+=\s+)('.*')" = "`$1'$($Latest.URL64)'"
  16. "(^\s+checksum64\s+=\s+)('.*')" = "`$1'$($Latest.Checksum64)'"
  17. "(^\s+checksumType64\s+=\s+)('.*')" = "`$1'$($Latest.ChecksumType64)'"
  18. }
  19. }
  20. }
  21. update -ChecksumFor 64