diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..64eb19e --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*TestsResults.xml +*.nupkg +chocolatey.log diff --git a/Build.ps1 b/Build.ps1 new file mode 100644 index 0000000..b2ca98a --- /dev/null +++ b/Build.ps1 @@ -0,0 +1,38 @@ +[CmdletBinding()] +param( + [String]$PackageName = (Split-Path $PSScriptRoot -Leaf), + [String]$RepoName = 'TempLocalPSRepo', + [String]$RepoLocation = $PSScriptRoot, + [String]$NuGetApiKey +) + +Remove-Module -Name $PackageName -Force -ErrorAction SilentlyContinue + +if ((Get-PSRepository -Name $RepoName -ErrorAction SilentlyContinue) -ne $null) { + Unregister-PSRepository -Name $RepoName +} +Register-PSRepository -Name $RepoName -SourceLocation $RepoLocation -PublishLocation $RepoLocation + +if (((Find-Package -Name $PackageName -Source $RepoName -ErrorAction SilentlyContinue) -ne $null) -and (!$NuGetApiKey)) { + Remove-Item (Join-Path -Path $RepoLocation -ChildPath "$PackageName*.nupkg") +} + +$publishParams = @{ + Repository = $RepoName + Force = $True + Path = "$PSScriptRoot\$PackageName" +} + +Copy-Item -Recurse ".\$PackageName" "$Env:ProgramFiles\WindowsPowerShell\Modules\" -Force -Verbose + +if ($NuGetApiKey) { + $publishParams.Add('nuGetApiKey',$NuGetApiKey) +} + +try { + Publish-Module @publishParams +} +finally { + Remove-Item -Recurse "$Env:ProgramFiles\WindowsPowerShell\Modules\$PackageName" -Force -Verbose + Unregister-PSRepository -Name $RepoName +} diff --git a/ChocolateyGet.Resource.psd1 b/ChocolateyGet/ChocolateyGet.Resource.psd1 similarity index 100% rename from ChocolateyGet.Resource.psd1 rename to ChocolateyGet/ChocolateyGet.Resource.psd1 diff --git a/ChocolateyGet.psd1 b/ChocolateyGet/ChocolateyGet.psd1 similarity index 100% rename from ChocolateyGet.psd1 rename to ChocolateyGet/ChocolateyGet.psd1 diff --git a/ChocolateyGet.psm1 b/ChocolateyGet/ChocolateyGet.psm1 similarity index 92% rename from ChocolateyGet.psm1 rename to ChocolateyGet/ChocolateyGet.psm1 index 2ba43db..ae71a98 100644 --- a/ChocolateyGet.psm1 +++ b/ChocolateyGet/ChocolateyGet.psm1 @@ -14,6 +14,8 @@ $script:firstTime = $true # Utility variables $script:FastReferenceRegex = "(?[^#]*)#(?[^\s]*)#(?[^#]*)" +$script:ArgSplitRegex = '\B-(?:-|)' +$script:ArgFilterRegex = '\w*(?:param|arg)\w*' Microsoft.PowerShell.Utility\Import-LocalizedData LocalizedData -filename 'ChocolateyGet.Resource.psd1' @@ -22,14 +24,14 @@ Microsoft.PowerShell.Utility\Import-LocalizedData LocalizedData -filename 'Choco #region Methods # Dot sourcing private script files -Get-ChildItem $ScriptPath/src/private -Recurse -Filter "*.ps1" -File | ForEach-Object { +Get-ChildItem $ScriptPath/src/private -Recurse -Filter "*.ps1" -File | ForEach-Object { . $_.FullName } # Load and export methods # Dot sourcing public function files -Get-ChildItem $ScriptPath/src/public -Recurse -Filter "*.ps1" -File | ForEach-Object { +Get-ChildItem $ScriptPath/src/public -Recurse -Filter "*.ps1" -File | ForEach-Object { . $_.FullName # Find all the functions defined no deeper than the first level deep and export it. diff --git a/LICENSE.txt b/ChocolateyGet/LICENSE.txt similarity index 100% rename from LICENSE.txt rename to ChocolateyGet/LICENSE.txt diff --git a/src/private/ConvertTo-SoftwareIdentity.ps1 b/ChocolateyGet/src/private/ConvertTo-SoftwareIdentity.ps1 similarity index 100% rename from src/private/ConvertTo-SoftwareIdentity.ps1 rename to ChocolateyGet/src/private/ConvertTo-SoftwareIdentity.ps1 diff --git a/src/private/Find-ChocoPackage.ps1 b/ChocolateyGet/src/private/Find-ChocoPackage.ps1 similarity index 100% rename from src/private/Find-ChocoPackage.ps1 rename to ChocolateyGet/src/private/Find-ChocoPackage.ps1 diff --git a/src/private/Get-ChocoPath.ps1 b/ChocolateyGet/src/private/Get-ChocoPath.ps1 similarity index 100% rename from src/private/Get-ChocoPath.ps1 rename to ChocolateyGet/src/private/Get-ChocoPath.ps1 diff --git a/src/private/Get-PackageSources.ps1 b/ChocolateyGet/src/private/Get-PackageSources.ps1 similarity index 100% rename from src/private/Get-PackageSources.ps1 rename to ChocolateyGet/src/private/Get-PackageSources.ps1 diff --git a/src/private/Install-ChocoBinaries.ps1 b/ChocolateyGet/src/private/Install-ChocoBinaries.ps1 similarity index 100% rename from src/private/Install-ChocoBinaries.ps1 rename to ChocolateyGet/src/private/Install-ChocoBinaries.ps1 diff --git a/src/private/Invoke-Choco.ps1 b/ChocolateyGet/src/private/Invoke-Choco.ps1 similarity index 100% rename from src/private/Invoke-Choco.ps1 rename to ChocolateyGet/src/private/Invoke-Choco.ps1 diff --git a/src/private/MiscHelpers.ps1 b/ChocolateyGet/src/private/MiscHelpers.ps1 similarity index 100% rename from src/private/MiscHelpers.ps1 rename to ChocolateyGet/src/private/MiscHelpers.ps1 diff --git a/src/private/PackageNameHelpers.ps1 b/ChocolateyGet/src/private/PackageNameHelpers.ps1 similarity index 100% rename from src/private/PackageNameHelpers.ps1 rename to ChocolateyGet/src/private/PackageNameHelpers.ps1 diff --git a/src/private/PackageVersionHelpers.ps1 b/ChocolateyGet/src/private/PackageVersionHelpers.ps1 similarity index 100% rename from src/private/PackageVersionHelpers.ps1 rename to ChocolateyGet/src/private/PackageVersionHelpers.ps1 diff --git a/src/public/Add-PackageSource.ps1 b/ChocolateyGet/src/public/Add-PackageSource.ps1 similarity index 100% rename from src/public/Add-PackageSource.ps1 rename to ChocolateyGet/src/public/Add-PackageSource.ps1 diff --git a/src/public/BaseFunctions.ps1 b/ChocolateyGet/src/public/BaseFunctions.ps1 similarity index 100% rename from src/public/BaseFunctions.ps1 rename to ChocolateyGet/src/public/BaseFunctions.ps1 diff --git a/src/public/Find-Package.ps1 b/ChocolateyGet/src/public/Find-Package.ps1 similarity index 100% rename from src/public/Find-Package.ps1 rename to ChocolateyGet/src/public/Find-Package.ps1 diff --git a/src/public/Get-Package.ps1 b/ChocolateyGet/src/public/Get-Package.ps1 similarity index 100% rename from src/public/Get-Package.ps1 rename to ChocolateyGet/src/public/Get-Package.ps1 diff --git a/src/public/Install-Package.ps1 b/ChocolateyGet/src/public/Install-Package.ps1 similarity index 100% rename from src/public/Install-Package.ps1 rename to ChocolateyGet/src/public/Install-Package.ps1 diff --git a/src/public/Remove-PackageSource.ps1 b/ChocolateyGet/src/public/Remove-PackageSource.ps1 similarity index 100% rename from src/public/Remove-PackageSource.ps1 rename to ChocolateyGet/src/public/Remove-PackageSource.ps1 diff --git a/src/public/Resolve-PackageSource.ps1 b/ChocolateyGet/src/public/Resolve-PackageSource.ps1 similarity index 100% rename from src/public/Resolve-PackageSource.ps1 rename to ChocolateyGet/src/public/Resolve-PackageSource.ps1 diff --git a/src/public/Save-Package.ps1 b/ChocolateyGet/src/public/Save-Package.ps1 similarity index 100% rename from src/public/Save-Package.ps1 rename to ChocolateyGet/src/public/Save-Package.ps1 diff --git a/src/public/Uninstall-Package.ps1 b/ChocolateyGet/src/public/Uninstall-Package.ps1 similarity index 100% rename from src/public/Uninstall-Package.ps1 rename to ChocolateyGet/src/public/Uninstall-Package.ps1 diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..c780ad1 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,131 @@ +// Obtain an Artifactory server instance, defined in Jenkins --> Manage: +def server = Artifactory.server 'net.cernerrepos' + +pipeline { + agent { + label 'windows_corporate' + } + triggers { + githubPush() + } + options { + skipStagesAfterUnstable() + } + environment { + PACKAGE_NAME = 'ChocolateyGet' + TEAMS_URL = 'https://outlook.office.com/webhook/c70adb63-caaf-4054-acd9-ffc39745b11c@fbc493a8-0d24-4454-a815-f4ca58e8c09d/IncomingWebhook/2e708b5e781f48f99cd4e5223d6b6ddd/db882129-a743-4298-9b1d-53922a4a3d7b' + ARTIFACTORY_INTEGRATION_REPO = 'nuget-integration-local' + ARTIFACTORY_PRODUCTION_REPO = 'nuget-production-local' + } + stages { + stage('Build') { + steps { + powershell "\$ErrorActionPreference = 'Stop'; ./Build.ps1 -PackageName ${env.PACKAGE_NAME}; exit \$lastexitcode" + } + } + stage('Test') { + steps { + script { + try { + powershell "\$ErrorActionPreference = 'Stop'; ./Test.ps1 -PreBuilt -PackageName ${env.PACKAGE_NAME}; exit \$lastexitcode" + } + finally { + nunit testResultsPattern: "*_TestsResults.xml" + archiveArtifacts 'chocolatey.log' + } + } + } + } + stage('Deploy to Integration') { + // Has passed the PR check, and commited - pushing to integration store + when { + allOf { + not{ + changeRequest () + } + } + branch 'integration' + } + steps { + script { + // Create the upload specs: + def uploadSpec = """{ + "files": [ + { + "pattern" : "${env.PACKAGE_NAME}*.nupkg", + "target" : "${env.ARTIFACTORY_INTEGRATION_REPO}/" + } + ] + }""" + + // Upload files to Artifactory: + buildInfo = server.upload spec: uploadSpec + + // Publish the merged build-info to Artifactory + server.publishBuildInfo buildInfo + } + } + } + stage('Deploy to Production') { + // Has passed the PR check, and commited - pushing to integration store + when { + allOf { + not{ + changeRequest () + } + } + branch 'production' + } + steps { + script { + // Create the upload specs: + def uploadSpec = """{ + "files": [ + { + "pattern" : "${env.PACKAGE_NAME}*.nupkg", + "target" : "${env.ARTIFACTORY_INTEGRATION_REPO}/" + } + ] + }""" + + // Upload files to Artifactory: + buildInfo = server.upload spec: uploadSpec + + // Publish the merged build-info to Artifactory + server.publishBuildInfo buildInfo + + // Create the promotion specs: + def promotionConfig = [ + // Mandatory parameters + 'buildName' : buildInfo.name, + 'buildNumber' : buildInfo.number, + 'targetRepo' : env.ARTIFACTORY_PRODUCTION_REPO, + + // Optional parameters + 'sourceRepo' : env.ARTIFACTORY_INTEGRATION_REPO, + 'status' : 'Released', + 'includeDependencies': true, + 'copy' : true, + ] + + // Promote build to Production: + server.promote promotionConfig + } + } + } + } + post { + always { + powershell "Remove-Item ${env.PACKAGE_NAME}*.nupkg -ErrorAction SilentlyContinue" + } + success { + script { teamsNotifySuccess "${env.TEAMS_URL}" } + } + unstable { + script { teamsNotifyUnstable "${env.TEAMS_URL}" } + } + failure { + script { teamsNotifyFailure "${env.TEAMS_URL}" } + } + } +} diff --git a/README.md b/README.md index 9a5d71e..eeb7bce 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,11 @@ -[![Build status](https://ci.appveyor.com/api/projects/status/vxbk2jqy0r6y7cem/branch/master?svg=true)](https://ci.appveyor.com/project/jianyunt/chocolateyget/branch/master) - # ChocolateyGet ChocolateyGet provider allows to download Chocolatey packages from any NuGet repository via OneGet +#### Jenkins Build Status - Production +[![Build Status](https://jenkins.cerner.com/communityworks/buildStatus/icon?job=CommunityWorks/ChocolateyGet/production)](https://jenkins.cerner.com/communityworks/blue/organizations/jenkins/CommunityWorks%2FChocolateyGet/activity) + +#### Jenkins Build Status - Integration +[![Build Status](https://jenkins.cerner.com/communityworks/buildStatus/icon?job=CommunityWorks/ChocolateyGet/integration)](https://jenkins.cerner.com/communityworks/blue/organizations/jenkins/CommunityWorks%2FChocolateyGet/activity) ## Get the ChocolateyGet installed ```PowerShell diff --git a/Test.ps1 b/Test.ps1 new file mode 100644 index 0000000..1b53976 --- /dev/null +++ b/Test.ps1 @@ -0,0 +1,32 @@ +[CmdletBinding()] +param( + [String]$RepoName = 'TempLocalPSRepo', + [String]$RepoLocation = $PSScriptRoot, + [String]$PackageName = (Split-Path $PSScriptRoot -Leaf), + [Switch]$Prebuilt, + [String]$BuildScript = './build.ps1' +) + +if (!$Prebuilt) { + . $BuildScript -PackageName $PackageName -RepoName $RepoName -RepoLocation $RepoLocation +} + +if ((Get-PSRepository -Name $RepoName -ErrorAction SilentlyContinue) -ne $null) { + Unregister-PSRepository -Name $RepoName +} +Register-PSRepository -Name $RepoName -SourceLocation $RepoLocation -PublishLocation $RepoLocation + +$chocoLogPath = Get-Command -Name 'choco' | Split-Path | Split-Path | Join-Path -ChildPath 'logs\chocolatey.log' +Rename-Item -Path $chocoLogPath -NewName "chocolatey.$(Get-Date -Format 'yyyyMMddHHmmss').log" + +try { + Uninstall-Package -Name $PackageName -Force -ErrorAction SilentlyContinue + Install-Package -Name $PackageName -Source $RepoName -Force + + Invoke-Pester "./Test/$PackageName.tests.ps1" -OutputFile worker_TestsResults.xml -OutputFormat NUnitXML +} +finally { + Copy-Item -Path $chocoLogPath -Destination '.' -Force + Uninstall-Package -Name $PackageName -Force + Unregister-PSRepository -Name $RepoName +} diff --git a/Test/ChocolateyGet.tests.ps1 b/Test/ChocolateyGet.tests.ps1 index 59aa520..2594f84 100644 --- a/Test/ChocolateyGet.tests.ps1 +++ b/Test/ChocolateyGet.tests.ps1 @@ -36,24 +36,31 @@ Describe "ChocolateyGet testing" -Tags @('BVT', 'DRT') { It "find-package" { - $a=find-package -ProviderName $ChocolateyGet -name nodejs -ForceBootstrap -force - $a | ?{ $_.name -eq "nodejs" } | should not BeNullOrEmpty + $a=find-package -ProviderName $ChocolateyGet -name cpu-z -ForceBootstrap -force + $a | ?{ $_.name -eq "cpu-z" } | should not BeNullOrEmpty + + $b=find-package -ProviderName $ChocolateyGet -name cpu-z -allversions + $b | ?{ $_.name -eq "cpu-z" } | should not BeNullOrEmpty $b=find-package -ProviderName $ChocolateyGet -name nodejs -allversions -verbose $b | ?{ $_.name -eq "nodejs" } | should not BeNullOrEmpty - $c=find-package -ProviderName $ChocolateyGet -name nodejs -AdditionalArguments --exact -verbose - $c | ?{ $_.name -eq "nodejs" } | should not BeNullOrEmpty - } + $c=find-package -ProviderName $ChocolateyGet -name cpu-z -AdditionalArguments --exact + $c | ?{ $_.name -eq "cpu-z" } | should not BeNullOrEmpty + } It "find-package with wildcard search" { - $d=find-package -ProviderName $ChocolateyGet -name *firefox* -Verbose - $d | ?{ $_.name -eq "firefox" } | should not BeNullOrEmpty + $d=find-package -ProviderName $ChocolateyGet -name *firefox + $d | ?{ $_.name -eq "firefox" } | should not BeNullOrEmpty - } + } + + It "find-install-package cpu-z" { - It "find-install-package nodejs" { + $package = "cpu-z" + $a=find-package $package -verbose -provider $ChocolateyGet -AdditionalArguments --exact | install-package -force + $a.Name -contains $package | Should Be $true $package = "nodejs" $a=find-package $package -verbose -provider $ChocolateyGet -AdditionalArguments --exact | install-package -force -verbose @@ -79,87 +86,87 @@ Describe "ChocolateyGet testing" -Tags @('BVT', 'DRT') { } Describe "ChocolateyGet multi-source testing" -Tags @('BVT', 'DRT') { - BeforeAll { - $altSourceName = "LocalChocoSource" - $altSourceLocation = $PSScriptRoot - $package = "nodejs" - - Save-Package $package -Source 'http://chocolatey.org/api/v2' -Path $altSourceLocation - Unregister-PackageSource -Name $altSourceName -ProviderName $ChocolateyGet -ErrorAction SilentlyContinue - } - AfterAll { - Remove-item $altSourceLocation\$package* -Force -ErrorAction SilentlyContinue - Unregister-PackageSource -Name $altSourceName -ProviderName $ChocolateyGet -ErrorAction SilentlyContinue - } - - It "refuses to register a source with no location" { - $a = Register-PackageSource -Name $altSourceName -ProviderName $ChocolateyGet -Verbose -ErrorAction SilentlyContinue - $a.Name -eq $altSourceName | Should Be $false - } - - It "installs and uninstalls from an alternative package source" { - - $a = Register-PackageSource -Name $altSourceName -ProviderName $ChocolateyGet -Location $altSourceLocation -Verbose - $a.Name -eq $altSourceName | Should Be $true - - $b=find-package $package -verbose -provider $ChocolateyGet -source $altSourceName -AdditionalArguments --exact | install-package -force - $b.Name -contains $package | Should Be $true - - $c = get-package $package -verbose -provider $ChocolateyGet - $c.Name -contains $package | Should Be $true - - $d= Uninstall-package $package -verbose -ProviderName $ChocolateyGet -AdditionalArguments '-y --remove-dependencies' - $d.Name -contains $package | Should Be $true - - Unregister-PackageSource -Name $altSourceName -ProviderName $ChocolateyGet - $e = Get-PackageSource -ProviderName $ChocolateyGet - $e.Name -eq $altSourceName | Should Be $false - } + BeforeAll { + $altSourceName = "LocalChocoSource" + $altSourceLocation = $PSScriptRoot + $package = "cpu-z" + + Save-Package $package -Source 'http://chocolatey.org/api/v2' -Path $altSourceLocation + Unregister-PackageSource -Name $altSourceName -ProviderName $ChocolateyGet -ErrorAction SilentlyContinue + } + AfterAll { + Remove-item $altSourceLocation\$package* -Force -ErrorAction SilentlyContinue + Unregister-PackageSource -Name $altSourceName -ProviderName $ChocolateyGet -ErrorAction SilentlyContinue + } + + It "refuses to register a source with no location" { + $a = Register-PackageSource -Name $altSourceName -ProviderName $ChocolateyGet -Verbose -ErrorAction SilentlyContinue + $a.Name -eq $altSourceName | Should Be $false + } + + It "installs and uninstalls from an alternative package source" { + + $a = Register-PackageSource -Name $altSourceName -ProviderName $ChocolateyGet -Location $altSourceLocation -Verbose + $a.Name -eq $altSourceName | Should Be $true + + $b=find-package $package -verbose -provider $ChocolateyGet -source $altSourceName -AdditionalArguments --exact | install-package -force + $b.Name -contains $package | Should Be $true + + $c = get-package $package -verbose -provider $ChocolateyGet + $c.Name -contains $package | Should Be $true + + $d= Uninstall-package $package -verbose -ProviderName $ChocolateyGet -AdditionalArguments '-y --remove-dependencies' + $d.Name -contains $package | Should Be $true + + Unregister-PackageSource -Name $altSourceName -ProviderName $ChocolateyGet + $e = Get-PackageSource -ProviderName $ChocolateyGet + $e.Name -eq $altSourceName | Should Be $false + } } Describe "ChocolateyGet DSC integration with args/params support" -Tags @('BVT', 'DRT') { - $package = "sysinternals" + $package = "sysinternals" - $argsAndParams = "--paramsglobal --params ""/InstallDir=c:\windows\temp\sysinternals /QuickLaunchShortcut=false"" -y --installargs MaintenanceService=false" + $argsAndParams = "--paramsglobal --params ""/InstallDir=c:\windows\temp\sysinternals /QuickLaunchShortcut=false"" -y --installargs MaintenanceService=false" - It "finds, installs and uninstalls packages when given installation arguments parameters that would otherwise cause search to fail" { + It "finds, installs and uninstalls packages when given installation arguments parameters that would otherwise cause search to fail" { - $a = find-package $package -verbose -provider $ChocolateyGet -AdditionalArguments $argsAndParams - $a = install-package $a -force -AdditionalArguments $argsAndParams -Verbose - $a.Name -contains $package | Should Be $true + $a = find-package $package -verbose -provider $ChocolateyGet -AdditionalArguments $argsAndParams + $a = install-package $a -force -AdditionalArguments $argsAndParams -Verbose + $a.Name -contains $package | Should Be $true - $b = get-package $package -verbose -provider $ChocolateyGet -AdditionalArguments $argsAndParams - $b.Name -contains $package | Should Be $true + $b = get-package $package -verbose -provider $ChocolateyGet -AdditionalArguments $argsAndParams + $b.Name -contains $package | Should Be $true - $c = Uninstall-package $package -verbose -ProviderName $ChocolateyGet -AdditionalArguments $argsAndParams - $c.Name -contains $package | Should Be $true + $c = Uninstall-package $package -verbose -ProviderName $ChocolateyGet -AdditionalArguments $argsAndParams + $c.Name -contains $package | Should Be $true - } + } } Describe "ChocolateyGet support for 'latest' RequiredVersion value with DSC support" -Tags @('BVT', 'DRT') { - $package = "curl" - $version = "7.60.0" + $package = "curl" + $version = "7.60.0" - AfterEach { - Uninstall-Package -Name $package -Verbose -ProviderName $ChocolateyGet -Force -ErrorAction SilentlyContinue - } + AfterEach { + Uninstall-Package -Name $package -Verbose -ProviderName $ChocolateyGet -Force -ErrorAction SilentlyContinue + } - It "does not find the 'latest' locally installed version if an outdated version is installed" { - $a = install-package -name $package -requiredVersion $version -verbose -ProviderName $ChocolateyGet -Force - $a.Name -contains $package | Should Be $true + It "does not find the 'latest' locally installed version if an outdated version is installed" { + $a = install-package -name $package -requiredVersion $version -verbose -ProviderName $ChocolateyGet -Force + $a.Name -contains $package | Should Be $true - $b = get-package $package -requiredVersion 'latest' -verbose -provider $ChocolateyGet -ErrorAction SilentlyContinue - $b.Name -contains $package | Should Be $false - } + $b = get-package $package -requiredVersion 'latest' -verbose -provider $ChocolateyGet -ErrorAction SilentlyContinue + $b.Name -contains $package | Should Be $false + } - It "finds, installs, and uninstalls the latest version when the 'latest' RequiredVersion value is set" { - $a = find-package $package -requiredversion 'latest' -verbose -provider $ChocolateyGet - $a = install-package $a -force -Verbose - $a.Name -contains $package | Should Be $true + It "finds, installs, and uninstalls the latest version when the 'latest' RequiredVersion value is set" { + $a = find-package $package -requiredversion 'latest' -verbose -provider $ChocolateyGet + $a = install-package $a -force -Verbose + $a.Name -contains $package | Should Be $true - $b = get-package $package -requiredversion 'latest' -verbose -provider $ChocolateyGet - $b = Uninstall-package $b -verbose - $b.Name -contains $package | Should Be $true - } + $b = get-package $package -requiredversion 'latest' -verbose -provider $ChocolateyGet + $b = Uninstall-package $b -verbose + $b.Name -contains $package | Should Be $true + } }