-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDebug-Package.ps1
More file actions
53 lines (38 loc) · 1.36 KB
/
Copy pathDebug-Package.ps1
File metadata and controls
53 lines (38 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<#
.SYNOPSIS
Debug a chocolatey package.
.DESCRIPTION
This script will debug the current package. It expects that you
are in the package directory. For example
PS\nugetpackages\dependencywalker\>
The script will force remove any existing chocolatey package by
the same name in your CHOCOLATEYINSTALL directory. It will
recreate the nuget package and invoke 'cinst' on the same in this
directory.
.EXAMPLE
..\Debug-Package.ps1
Invoke the debug script (located in the root directory) from in
this package directory.
#>
function Test-NullPath($path) {
if($path -eq $null) {
return $false
}
return (Test-Path $path)
}
$nuspec = Resolve-Path *.nuspec
$nupkg = Resolve-Path *.nupkg
$xml = [xml] (Get-Content $nuspec)
$id = $xml.package.metadata.id
$version = $xml.package.metadata.version
$temp = Join-Path $ENV:TEMP "chocolatey\$id"
$lib = Join-Path $ENV:ChocolateyInstall "lib\$id.$version"
'##################################################'
"Debugging package: $id.$version"
'##################################################'
Clear-Host
if(Test-NullPath $nupkg) { Remove-Item $nupkg }
if(Test-NullPath $temp) { Remove-Item $temp -recurse -force }
if(Test-NullPath $lib) { Remove-Item $lib -recurse -force }
nuget pack $nuspec
cinst $id -source $pwd -force