Skip to content

Commit

Permalink
DSCResources/cChocoPackageInstall/cChocoPackageInstall.psm1
Browse files Browse the repository at this point in the history
  • Loading branch information
mrhockeymonkey committed Aug 14, 2019
1 parent 743b627 commit 7788501
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
7 changes: 4 additions & 3 deletions DSCResources/cChocoPackageInstall/cChocoPackageInstall.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ function Test-ChocoInstalled
Write-Verbose -Message 'Test-ChocoInstalled'
$env:Path = [Environment]::GetEnvironmentVariable('Path','Machine')

#Write-Verbose -Message "Env:Path contains: $env:Path"
Write-Verbose -Message "Env:Path contains: $env:Path"
if (Test-Command -command choco)
{
Write-Verbose -Message 'YES - Choco is Installed'
Expand Down Expand Up @@ -337,6 +337,7 @@ function UninstallPackage
function IsPackageInstalled
{
[CmdletBinding(DefaultParameterSetName = 'RequiredVersion')]
[OutputType([bool])]
param(
[Parameter(Position=0, Mandatory)]
[string]$pName,
Expand All @@ -350,7 +351,7 @@ function IsPackageInstalled
Write-Verbose -Message "Start IsPackageInstalled $pName"

$env:Path = [Environment]::GetEnvironmentVariable('Path','Machine')
#Write-Verbose -Message "Path variables: $env:Path"
Write-Verbose -Message "Path variables: $env:Path"

$installedPackages = Get-ChocoInstalledPackage

Expand Down Expand Up @@ -447,7 +448,7 @@ Function Upgrade-Package {
)

$env:Path = [Environment]::GetEnvironmentVariable('Path','Machine')
#Write-Verbose -Message "Path variables: $env:Path"
Write-Verbose -Message "Path variables: $env:Path"

[string]$chocoParams = '-dv -y'
if ($pParams) {
Expand Down
9 changes: 8 additions & 1 deletion Tests/cChoco_ScriptAnalyzerTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@ if ($Modules.count -gt 0) {
Context Testing Module '$($module.FullName)' {
foreach ($rule in $rules) {
It passes the PSScriptAnalyzer Rule $rule {
(Invoke-ScriptAnalyzer -Path $module.FullName -IncludeRule $rule.RuleName ).Count | Should Be 0
$Failures = Invoke-ScriptAnalyzer -Path $module.FullName -IncludeRule $rule.RuleName
$FailuresCount = ($Failures | Measure-Object).Count
if ($FailuresCount -gt 0) {
$Failures | ForEach-Object {
Write-Warning "Script: $($_.ScriptName), Line $($_.Line), Message $($_.Message)"
}
}
$FailuresCount | Should Be 0
}
}
}
Expand Down

0 comments on commit 7788501

Please sign in to comment.