Skip to content
This repository was archived by the owner on Jun 25, 2020. It is now read-only.

Commit 35f9a04

Browse files
author
Jérémie Bertrand
committed
1° part of migration to default chocolatey folder for installation
1 parent a94080a commit 35f9a04

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

BuildScripts/AppVeyor-Build.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ function CreatePackage($versionInfos)
9696
Copy-Item $tools\chocolatey\Pretzel\pretzel.nuspec chocoTemp\Pretzel\pretzel.nuspec
9797
Copy-Item $tools\chocolatey\Pretzel\chocolateyInstall.ps1 chocoTemp\Pretzel\tools\chocolateyInstall.ps1
9898
Copy-Item $tools\chocolatey\Pretzel\chocolateyUninstall.ps1 chocoTemp\Pretzel\tools\chocolateyUninstall.ps1
99+
Copy-Item $tools\chocolatey\Pretzel\chocolateyBeforeModify.ps1 chocoTemp\Pretzel\tools\chocolateyBeforeModify.ps1
99100

100101
ReplaceChocoInstInfos chocoTemp\Pretzel\tools\chocolateyInstall.ps1 $version $tag $artifacts\Pretzel.$version.zip
101102

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Write-Debug "Migrate Pretzel from BinRoot to normal Chocolatey directory"
2+
3+
$binRoot = Get-BinRoot
4+
$installDir = Join-Path $binRoot "Pretzel"
5+
6+
# Remove folder
7+
If (Test-Path $installDir){
8+
Remove-Item $installDir -Recurse
9+
}
10+
11+
# Remove path
12+
13+
# get the PATH variable
14+
$envPath = $env:PATH
15+
$pathType = [System.EnvironmentVariableTarget]::User
16+
17+
if ($envPath.ToLower().Contains($installDir.ToLower()))
18+
{
19+
$statementTerminator = ";"
20+
Write-Debug "PATH environment variable contains old pretzel path $installDir. Removing..."
21+
$actualPath = [System.Collections.ArrayList](Get-EnvironmentVariable -Name 'Path' -Scope $pathType).split($statementTerminator)
22+
23+
$actualPath.Remove($installDir)
24+
$newPath = $actualPath -Join $statementTerminator
25+
26+
Set-EnvironmentVariable -Name 'Path' -Value $newPath -Scope $pathType
27+
28+
} else {
29+
Write-Debug " The path to uninstall `'$installDir`' was not found in the `'$pathType`' PATH. Could not remove."
30+
}

tools/chocolatey/Pretzel/pretzel.nuspec

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,8 @@
1313
<description>A simple, pluggable site generation tool for .NET developers and Windows users</description>
1414
<tags>Jekyll Liquid Razor Markdown blog hmtl static site engine</tags>
1515
<releaseNotes>https://github.com/Code52/pretzel/releases</releaseNotes>
16+
<dependencies>
17+
<dependency id="chocolatey" version="0.9.10" />
18+
</dependencies>
1619
</metadata>
1720
</package>

0 commit comments

Comments
 (0)