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
29 changes: 29 additions & 0 deletions automatic/fondue/fondue.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Do not remove this test for UTF-8: if “Ω” doesn’t appear as greek uppercase omega letter enclosed in quotation marks, you should use an editor that supports UTF-8, not this one. -->
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>fondue</id>
<version>1.0.2</version>
<owners>steviecoaster</owners>
<title>fondue (Install)</title>
<authors>Chocolatey Software</authors>
<projectUrl>https://github.com/chocolatey-solutions/Fondue</projectUrl>
<iconUrl>https://img.chocolatey.org/nupkg/chocolateyicon.png</iconUrl>
<copyright>Chocolatey Software</copyright>
<licenseUrl>https://github.com/chocolatey-solutions/Fondue/blob/main/LICENSE</licenseUrl>
<projectSourceUrl>https://github.com/chocolatey-solutions/Fondue</projectSourceUrl>
<docsUrl>https://chocolatey-solutions.github.io/Fondue/</docsUrl>
<mailingListUrl>https://ch0.co/community</mailingListUrl>
<bugTrackerUrl>https://github.com/chocolatey-solutions/Fondue/issues</bugTrackerUrl>
<tags>fondue maintainer package development author</tags>
<summary>A PowerShell module that melts away the complexity of creating and managing Chocolatey packages.</summary>
<description>Fondue provides a rich set of cmdlets that streamline every step of the Chocolatey package lifecycle — from scaffolding new packages and metapackages, to managing dependencies, updating metadata, syncing installed software, and validating your work before publishing.</description>
<dependencies>
</dependencies>

</metadata>
<files>
<!-- this section controls what actually gets packaged into the Chocolatey package -->
<file src="tools\**" target="tools" />
</files>
</package>
Binary file added automatic/fondue/tools/Fondue.zip
Binary file not shown.
2 changes: 2 additions & 0 deletions automatic/fondue/tools/chocolateyBeforeModify.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
$ErrorActionPreference = 'Stop'
Remove-Module -Name $env:ChocolateyPackageName -Force -ErrorAction SilentlyContinue
75 changes: 75 additions & 0 deletions automatic/fondue/tools/chocolateyInstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
$ErrorActionPreference = 'Stop'

$toolsDir = Split-Path -Parent $MyInvocation.MyCommand.Definition
$ModuleName = $env:ChocolateyPackageName # this may be different from the package name and different case
$ModuleVersion = $env:ChocolateyPackageVersion # this may change so keep this here
$SavedParamsPath = Join-Path $toolsDir -ChildPath 'parameters.saved'

if ($PSVersionTable.PSVersion.Major -lt 5) {
Write-Warning "$ModuleName has not been tested on this version of PowerShell"
}

# Module may already be installed outside of Chocolatey
Remove-Module -Name $ModuleName -Force -ErrorAction SilentlyContinue

# remove the saved parameters file if it exists
if (Test-Path -Path $savedParamsPath) {
Remove-Item -Path $savedParamsPath -Force
}

$sourcePath = Join-Path $toolsDir -ChildPath "$($ModuleName).zip"
$destinationPath = @()

$PathSegment = @{
Windows = "WindowsPowerShell\Modules\"
Core = "PowerShell\Modules\"

AllUsers = $env:ProgramFiles
CurrentUser = try {
$PROFILE | Split-Path | Split-Path
} catch {
Write-Warning "Profile is set to '$($PROFILE)'. Current user '$($env:USERNAME)' may not be able to install at user level."
}
}

$Parameters = Get-PackageParameters

if (-not $Parameters.ContainsKey('Windows') -and -not $Parameters.ContainsKey('Core')) {
$Parameters += @{
Windows = $PSVersionTable.PSVersion.Major -le 5
Core = $PSVersionTable.PSVersion.Major -gt 5
}
}

if (-not $Parameters.ContainsKey('AllUsers') -and -not $Parameters.ContainsKey('CurrentUser')) {
$Parameters += @{
AllUsers = Test-ProcessAdminRights
CurrentUser = -not (Test-ProcessAdminRights)
}
}

foreach ($Scope in $Parameters.Keys.Where{$Parameters[$_] -and $_ -in @("AllUsers", "CurrentUser")}) {
if ($Parameters.Windows) {
$destinationPath += Join-Path -Path $PathSegment.$Scope -ChildPath $PathSegment.Windows
}

if ($Parameters.Core) {
$destinationPath += Join-Path -Path $PathSegment.$Scope -ChildPath $PathSegment.Core
}
}

foreach ($destPath in $destinationPath) {
Write-Verbose "Installing '$($modulename)' to '$($destPath)'."

# Check if the destination path exists and create if not
if (Test-Path -Path $destPath) {
$null = New-Item -Path $destPath -ItemType Directory -Force
}
Get-ChocolateyUnzip -FileFullPath $sourcePath -Destination $destPath -PackageName $moduleName

# save the locations where the module was installed so we can uninstall it
Add-Content -Path $savedParamsPath -Value $destPath
}

# cleanup the module from the Chocolatey $toolsDir folder
Remove-Item -Path $sourcePath -Force -Recurse
27 changes: 27 additions & 0 deletions automatic/fondue/tools/chocolateyUninstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
$ErrorActionPreference = 'Stop'

$toolsDir = Split-Path -Parent $MyInvocation.MyCommand.Definition
$moduleName = $env:ChocolateyPackageName # this may be different from the package name and different case
$savedParamsPath = Join-Path $toolsDir -ChildPath 'parameters.saved'

if (Test-Path -Path $savedParamsPath) {
$removePath = Get-Content -Path $savedParamsPath
} else {
$removePath = Join-Path -Path $env:ProgramFiles -ChildPath "WindowsPowerShell\Modules\$moduleName"
}

ForEach ($path in $removePath) {
Write-Verbose "Removing all version of '$moduleName' from '$path'."
Remove-Item -Path $path -Recurse -Force -ErrorAction SilentlyContinue
}

# remove path of module from $env:PSModulePath
if ($PSVersionTable.PSVersion.Major -lt 4) {
$modulePaths = [Environment]::GetEnvironmentVariable('PSModulePath', 'Machine') -split ';'

Write-Verbose "Removing '$sourcePath' from PSModulePath."
$newModulePath = $modulePaths | Where-Object { $_ -ne $sourcePath }

[Environment]::SetEnvironmentVariable('PSModulePath', $newModulePath, 'Machine')
$env:PSModulePath = $newModulePath
}
24 changes: 24 additions & 0 deletions automatic/fondue/update.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Import-Module Chocolatey-AU

#Create a temp dir
$tempDir = New-Item -Path $env:TEMP -Name (New-Guid).Guid -ItemType Directory
$fondue = Join-Path $tempDir -ChildPath 'Fondue'
$zipFile = Join-Path $tempDir -ChildPath 'Fondue.zip'

Save-Module -Name Fondue -Path $tempDir -Repository PSGallery
Compress-Archive -Path $fondue -DestinationPath $zipFile

$toolsDir = Join-Path (Split-Path -Parent $MyInvocation.MyCommand.Definition) -ChildPath 'tools'

Copy-Item $zipFile -Destination $toolsDir -Force

Remove-Item $tempDir -Recurse -Force
function global:au_GetLatest {
$LatestRelease = Find-Module Fondue -Repository PSGallery

@{
Version = $LatestRelease.Version
}
}

update -ChecksumFor none -NoCheckChocoVersion
Loading