Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
$packageName = 'sharpkeys'
$url = 'https://github.com/randyrants/sharpkeys/releases/download/v3.5/sharpkeys35.msi'

$packageArgs = @{
$packageArgs = @{
packageName = 'sharpkeys'
fileType = 'msi'
url = $url
url = ''
checksum = ''
checksumType = ''
silentArgs = '/qn'
validExitCodes = @(0)
softwareName = 'SharpKeys'
Expand Down
34 changes: 34 additions & 0 deletions automatic/sharpkeys/update.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Import-Module au

$releases = 'https://api.github.com/repos/randyrants/sharpkeys/releases/latest'
$headers = @{
'User-Agent' = 'ferventcoder'
'Accept' = 'application/vnd.github.v3+json'
}

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

function global:au_BeforeUpdate {}

function global:au_GetLatest {
$restAPI = Invoke-RestMethod $releases -Headers $headers
$Matches = $null
$restAPI.tag_name -match '(\d+\.?)+'
$version = $Matches[0]
$url32 = $restAPI.assets | Where-Object { ($_.content_type -eq 'application/octet-stream') } `
| Select-Object -First 1 -ExpandProperty browser_download_url

return @{ Version = $version; URL32 = $url32 }
}

if ($MyInvocation.InvocationName -ne '.') { # run the update only if script is not sourced
Update-Package
}