Skip to content

Commit

Permalink
Merge pull request #386 from AdmiringWorm/package/codeblocks [AU code…
Browse files Browse the repository at this point in the history
…blocks]

(codeblocks) Migrated to AU
  • Loading branch information
majkinetor authored Nov 11, 2016
2 parents 0e93885 + a23506b commit 07020b9
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 116 deletions.
23 changes: 17 additions & 6 deletions automatic/codeblocks/codeblocks.nuspec
Original file line number Diff line number Diff line change
@@ -1,27 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>{{PackageName}}</id>
<version>{{PackageVersion}}</version>
<id>codeblocks</id>
<version>16.1.0</version>
<title>Code::Blocks</title>
<authors>The Code::Blocks Team</authors>
<owners>chocolatey purity</owners>
<licenseUrl>http://www.codeblocks.org/license</licenseUrl>
<projectUrl>http://www.codeblocks.org/</projectUrl>
<iconUrl>https://cdn.rawgit.com/chocolatey/chocolatey-coreteampackages/e4a49519947c3cff55c17a0b08266c56b0613e64/icons/codeblocks.png</iconUrl>
<projectSourceUrl>http://svn.code.sf.net/p/codeblocks/code/</projectSourceUrl>
<docsUrl>http://wiki.codeblocks.org/index.php/Main_Page</docsUrl>
<mailingListUrl>http://forums.codeblocks.org/</mailingListUrl>
<bugTrackerUrl>https://sourceforge.net/p/codeblocks/tickets/</bugTrackerUrl>
<iconUrl>https://cdn.rawgit.com/chocolatey/chocolatey-coreteampackages/edba4a5849ff756e767cba86641bea97ff5721fe/icons/codeblocks.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>
Code::Blocks is a free C++ IDE built to meet the most demanding needs of its users. It is designed to be very extensible and fully configurable. Finally, an IDE with all the features you need, having a consistent look, feel and operation across platforms. Built around a plugin framework, Code::Blocks can be extended with plugins. Any kind of functionality can be added by installing/coding a plugin. For instance, compiling and debugging functionality is already provided by plugins!
Code::Blocks is a free C++ IDE built to meet the most demanding needs of its users. It is designed to be very extensible and fully configurable.
Finally, an IDE with all the features you need, having a consistent look, feel and operation across platforms.
Built around a plugin framework, Code::Blocks can be extended with plugins. Any kind of functionality can be added by installing/coding a plugin.
For instance, compiling and debugging functionality is already provided by plugins!

### Note

This package downloads the installer with the included GCC compiler.
</description>
<summary>Code::Blocks is a free C++ IDE.</summary>
<releaseNotes>http://www.codeblocks.org/downloads/31</releaseNotes>
<releaseNotes>http://www.codeblocks.org/downloads/45</releaseNotes>
<copyright />
<tags>codeblocks C++ IDE admin</tags>
<packageSourceUrl>https://github.com/chocolatey/chocolatey-coreteampackages</packageSourceUrl>
<packageSourceUrl>https://github.com/chocolatey/chocolatey-coreteampackages/tree/master/automatic/codeblocks</packageSourceUrl>
<dependencies>
<dependency id="chocolatey-fosshub.extension" version="0.2.0" />
<dependency id="chocolatey-uninstall.extension" version="1.1.0" />
</dependencies>
</metadata>
<files>
<file src="tools\**" target="tools" />
Expand Down
23 changes: 17 additions & 6 deletions automatic/codeblocks/tools/chocolateyInstall.ps1
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
34 changes: 24 additions & 10 deletions automatic/codeblocks/tools/chocolateyUninstall.ps1
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"}
}
40 changes: 40 additions & 0 deletions automatic/codeblocks/update.ps1
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
94 changes: 0 additions & 94 deletions ketarin/codeblocks.ketarin.xml

This file was deleted.

0 comments on commit 07020b9

Please sign in to comment.