-
Notifications
You must be signed in to change notification settings - Fork 384
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #386 from AdmiringWorm/package/codeblocks [AU code…
…blocks] (codeblocks) Migrated to AU
- Loading branch information
Showing
5 changed files
with
98 additions
and
116 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,18 @@ | ||
$packageName = '{{PackageName}}' | ||
$fileType = 'exe' | ||
$silentArgs = '/S' | ||
# {\{DownloadUrlx64}\} gets “misused” here as 32-bit download link due to limitations of Ketarin/chocopkgup | ||
$url = '{{DownloadUrlx64}}' | ||
$ErrorActionPreference = 'Stop' | ||
|
||
Install-ChocolateyPackage $packageName $fileType $silentArgs $url | ||
$fosshubUrl = 'https://www.fosshub.com/Code-Blocks.html/codeblocks-16.01mingw-setup.exe' | ||
|
||
$packageArgs = @{ | ||
packageName = 'codeblocks' | ||
fileType = 'exe' | ||
softwareName = 'CodeBlocks' | ||
|
||
checksum = '4d1b66c02ea6be91912b3f9cd67a1c3a7933b7e2dd062db00344faf39e3cae1c' | ||
checksumType = 'sha256' | ||
url = Get-UrlFromFosshub $fosshubUrl | ||
|
||
silentArgs = '/S' | ||
validExitCodes = @(0) | ||
} | ||
|
||
Install-ChocolateyPackage @packageArgs |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,28 @@ | ||
$packageName = '{{PackageName}}' | ||
$fileType = 'exe' | ||
$silentArgs = '/S' | ||
$validExitCodes = @(0) | ||
$ErrorActionPreference = 'Stop'; | ||
|
||
$unfile = "${Env:ProgramFiles}\CodeBlocks\uninstall.exe" | ||
$unfilex86 = "${Env:ProgramFiles(x86)}\CodeBlocks\uninstall.exe" | ||
$packageName = 'codeblocks' | ||
|
||
if (Test-Path "$unfile") {$file = "$unfile"} | ||
if (Test-Path "$unfilex86") {$file = "$unfilex86"} | ||
$uninstalled = $false | ||
[array]$key = Get-UninstallRegistryKey -SoftwareName 'CodeBlocks' | ||
|
||
if ((Test-Path "$unfile") -or (Test-Path "$unfilex86")) { | ||
Uninstall-ChocolateyPackage $packageName $fileType $silentArgs $file -validExitCodes $validExitCodes | ||
if ($key.Count -eq 1) { | ||
$key | % { | ||
$packageArgs = @{ | ||
packageName = $packageName | ||
fileType = 'EXE' | ||
silentArgs = '/S' | ||
validExitCodes= @(0) | ||
file = "$($_.UninstallString)" | ||
} | ||
|
||
Uninstall-ChocolateyPackage @packageArgs | ||
Wait-Process -Name "Au_" # This is added to prevent race condition with auto uninstaller | ||
} | ||
} elseif ($key.Count -eq 0) { | ||
Write-Warning "$packageName has already been uninstalled by other means." | ||
} elseif ($key.Count -gt 1) { | ||
Write-Warning "$key.Count matches found!" | ||
Write-Warning "To prevent accidental data loss, no programs will be uninstalled." | ||
Write-Warning "Please alert package maintainer the following keys were matched:" | ||
$key | % {Write-Warning "- $_.DisplayName"} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import-module au | ||
import-module "./../../extensions/chocolatey-fosshub.extension/extensions/Get-UrlFromFosshub.psm1" | ||
|
||
$releases = 'http://www.codeblocks.org/downloads/26' | ||
|
||
function global:au_SearchReplace { | ||
@{ | ||
".\tools\chocolateyInstall.ps1" = @{ | ||
"(^[$]fosshubUrl\s*=\s*)('.*')" = "`$1'$($Latest.URL32)'" | ||
"(?i)(^\s*checksum\s*=\s*)('.*')" = "`$1'$($Latest.Checksum32)'" | ||
"(?i)(^\s*checksumType\s*=\s*)('.*')" = "`$1'$($Latest.ChecksumType32)'" | ||
} | ||
".\codeblocks.nuspec" = @{ | ||
"(\<releaseNotes\>).*(\<\/releaseNotes\>)" = "`${1}$($Latest.ReleaseNotes)`$2" | ||
} | ||
} | ||
} | ||
|
||
function global:au_GetLatest { | ||
$download_page = Invoke-WebRequest -UseBasicParsing -Uri $releases | ||
|
||
$re = 'fosshub.*mingw-setup\.exe$' | ||
$url = $download_page.links | ? href -match $re | select -first 1 -expand href | ||
|
||
if (!$url.StartsWith("https")) { | ||
$url = $url -replace "^http","https" | ||
} | ||
|
||
$version = $url -split '[-]|mingw' | select -Last 1 -Skip 2 | ||
|
||
$changelog = $download_page.links | ? title -match "^changelog$" | select -first 1 -expand href | ||
|
||
return @{ | ||
URL32 = $url; | ||
Version = $version | ||
ReleaseNotes = $changelog | ||
} | ||
} | ||
|
||
update -NoCheckUrl -ChecksumFor 32 |
This file was deleted.
Oops, something went wrong.