Skip to content

Commit

Permalink
(wave-engine) Changed to parse content
Browse files Browse the repository at this point in the history
  • Loading branch information
AdmiringWorm committed May 9, 2018
1 parent 2a775ca commit c4a49b6
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions automatic/wave-engine/update.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,26 @@ function global:au_AfterUpdate {
}

function global:au_SearchReplace {
@{
"tools\chocolateyInstall.ps1" = @{
"(?i)(^\s*url\s*=\s*)('.*')" = "`$1'$($Latest.URL)'"
"(?i)(^\s*checksum\s*=\s*)('.*')" = "`$1'$($Latest.Checksum32)'"
"(?i)(^\s*checksumType\s*=\s*)('.*')" = "`$1'$($Latest.ChecksumType32)'"
}
@{
"tools\chocolateyInstall.ps1" = @{
"(?i)(^\s*url\s*=\s*)('.*')" = "`$1'$($Latest.URL)'"
"(?i)(^\s*checksum\s*=\s*)('.*')" = "`$1'$($Latest.Checksum32)'"
"(?i)(^\s*checksumType\s*=\s*)('.*')" = "`$1'$($Latest.ChecksumType32)'"
}
}
}

function global:au_GetLatest {
$download_page = Invoke-WebRequest -Uri $releases
$download_page = Invoke-WebRequest -Uri $releases -UseBasicParsing

$re = "WaveEngineSetup_[0-9_]+\.exe";
$url = $download_page.AllElements | ? { $_.id -match 'installer' -and $_.innerText -match $re } | select -First 1 -expand innerText
$re = '\>(https[^\<]+\.exe)\<'
if ($download_page.Content -match $re) {
$url = $Matches[1]
}

$url -match '_([\d_]+)\.' | Out-Null
$version = $Matches[1] -replace '_','.'
if ($url -match '_([\d_]+)\.') {
$version = $Matches[1] -replace '_', '.'
}

$Latest = @{ URL = $url; Version = $version }
return $Latest;
Expand Down

0 comments on commit c4a49b6

Please sign in to comment.