Public/Test-Package.ps1

1
2
3
4
5
6
7
8
9
10
11
function Test-Package() {
    choco pack

    $package_file    = gi *.nupkg | sort -Property CreationTime -Descending | select -First 1
    $package_name    = $package_file.Name  -replace '(\.\d+)+\.nupkg$'
    $package_version = ($package_file.BaseName -replace $package_name).Substring(1)

    #https://github.com/chocolatey/choco/wiki/CreatePackages#testing-your-package
    cinst $package_name --version $package_version --source "'$pwd;https://chocolatey.org/api/v2/'" --force
}