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

Commit

Permalink
1° part of migration to default chocolatey folder for installation
Browse files Browse the repository at this point in the history
  • Loading branch information
Jérémie Bertrand committed Jan 29, 2017
1 parent a94080a commit 35f9a04
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions BuildScripts/AppVeyor-Build.ps1
Expand Up @@ -96,6 +96,7 @@ function CreatePackage($versionInfos)
Copy-Item $tools\chocolatey\Pretzel\pretzel.nuspec chocoTemp\Pretzel\pretzel.nuspec
Copy-Item $tools\chocolatey\Pretzel\chocolateyInstall.ps1 chocoTemp\Pretzel\tools\chocolateyInstall.ps1
Copy-Item $tools\chocolatey\Pretzel\chocolateyUninstall.ps1 chocoTemp\Pretzel\tools\chocolateyUninstall.ps1
Copy-Item $tools\chocolatey\Pretzel\chocolateyBeforeModify.ps1 chocoTemp\Pretzel\tools\chocolateyBeforeModify.ps1

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

Expand Down
30 changes: 30 additions & 0 deletions tools/chocolatey/Pretzel/chocolateyBeforeModify.ps1
@@ -0,0 +1,30 @@
Write-Debug "Migrate Pretzel from BinRoot to normal Chocolatey directory"

$binRoot = Get-BinRoot
$installDir = Join-Path $binRoot "Pretzel"

# Remove folder
If (Test-Path $installDir){
Remove-Item $installDir -Recurse
}

# Remove path

# get the PATH variable
$envPath = $env:PATH
$pathType = [System.EnvironmentVariableTarget]::User

if ($envPath.ToLower().Contains($installDir.ToLower()))
{
$statementTerminator = ";"
Write-Debug "PATH environment variable contains old pretzel path $installDir. Removing..."
$actualPath = [System.Collections.ArrayList](Get-EnvironmentVariable -Name 'Path' -Scope $pathType).split($statementTerminator)

$actualPath.Remove($installDir)
$newPath = $actualPath -Join $statementTerminator

Set-EnvironmentVariable -Name 'Path' -Value $newPath -Scope $pathType

} else {
Write-Debug " The path to uninstall `'$installDir`' was not found in the `'$pathType`' PATH. Could not remove."
}
3 changes: 3 additions & 0 deletions tools/chocolatey/Pretzel/pretzel.nuspec
Expand Up @@ -13,5 +13,8 @@
<description>A simple, pluggable site generation tool for .NET developers and Windows users</description>
<tags>Jekyll Liquid Razor Markdown blog hmtl static site engine</tags>
<releaseNotes>https://github.com/Code52/pretzel/releases</releaseNotes>
<dependencies>
<dependency id="chocolatey" version="0.9.10" />
</dependencies>
</metadata>
</package>

0 comments on commit 35f9a04

Please sign in to comment.