Created
March 27, 2017 19:16
-
-
Save The-Running-Dev/d526b0647d0a8e368758f394b4c5abb7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Import-Module AU | |
$global:productName = 'webstorm' | |
$global:updatesUri = 'https://www.jetbrains.com/updates/updates.xml' | |
$global:stableVersionDownloadUri = 'https://download.jetbrains.com/webstorm/WebStorm-$version.exe' | |
function au_BeforeUpdate() { | |
$Latest.Checksum32 = Get-RemoteChecksum $Latest.Url32 | |
} | |
function global:au_SearchReplace { | |
return @{ | |
".\tools\chocolateyInstall.ps1" = @{ | |
"(?i)(^[$]installer\s*=\s*)('.*')" = "`$1'$([System.IO.Path]::GetFileName($Latest.Url32))'" | |
"(?i)(^[$]url\s*=\s*)('.*')" = "`$1'$($Latest.Url32)'" | |
"(?i)(^[$]checksum\s*=\s*)('.*')" = "`$1'$($Latest.Checksum32)'" | |
"(?i)(^\s*checksumType\s*=\s*)('.*')" = "`$1'$($Latest.ChecksumType32)'" | |
} | |
} | |
} | |
function global:au_GetLatest { | |
[xml] $updates = (New-Object System.Net.WebClient).DownloadString($global:updatesUri) | |
$versionInfo = $updates.products.product ` | |
| ? { $_.name -eq 'WebStorm' } ` | |
| % { $_.channel } ` | |
| % { $_.build } ` | |
| Sort-Object { [version] $_.number } ` | |
| Select-Object -Last 1 | |
$version = $versionInfo.Version | |
if ($versionInfo.ReleaseDate) { | |
$fullVesionNumber = "$($versionInfo.Version).$($versionInfo.ReleaseDate)" | |
} | |
else { | |
$fullVesionNumber = $versionInfo.Version | |
} | |
$stableVersionDownloadUri = $ExecutionContext.InvokeCommand.ExpandString($global:stableVersionDownloadUri) | |
write-host "fullVesionNumber: $fullVesionNumber" | |
return @{ Url32 = $stableVersionDownloadUri; Version = $fullVersionNumber } | |
} | |
Update-Package -ChecksumFor none -NoCheckChocoVersion -Force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment