Skip to content

Commit 5f7760e

Browse files
authored
added erroraction zero (#49)
1 parent 65bf069 commit 5f7760e

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

Public/Update-GitModule.ps1

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ function Update-GitModule {
33
[CmdletBinding(HelpUri='https://github.com/iricigor/InstallModuleFromGit/blob/master/Docs/Update-GitModule.md')]
44

55
param (
6-
7-
6+
7+
88
[Parameter(Mandatory,ValueFromPipelineByPropertyName,Position=0,ParameterSetName='ByUri')]
99
[string[]]$ProjectUri,
1010
# https://github.com/dfinke/InstallModuleFromGitHub
1111
# https://github.com/iricigor/FIFA2018
12-
12+
1313
[Parameter(Mandatory,ParameterSetName='ByName')]
1414
[string[]]$Name,
1515

@@ -29,10 +29,10 @@ function Update-GitModule {
2929
}
3030

3131
if ($env:AGENT_TEMPDIRECTORY) {
32-
$tmpRoot = $env:AGENT_TEMPDIRECTORY
32+
$tmpRoot = $env:AGENT_TEMPDIRECTORY
3333
} else {
3434
$tmpRoot = [System.IO.Path]::GetTempPath()
35-
}
35+
}
3636

3737
if ($Name) {$ProjectUri = ConvertTo-Uri -Name $Name}
3838

@@ -51,7 +51,10 @@ function Update-GitModule {
5151
# TODO: continue only after cleanup!
5252

5353
# Check version, and if higher install it
54-
$AllModules = @((Get-Module -Name $ModuleName -ListAvailable),(Get-InstalledModule -Name $ModuleName)) | Select Name, Version
54+
$AllModules = @(
55+
(Get-Module -Name $ModuleName -ListAvailable),
56+
(Get-InstalledModule -Name $ModuleName -ErrorAction SilentlyContinue)
57+
) | Select Name, Version
5558
$LocalModuleInfo = $AllModules | Sort-Object Version -Descending | Select -First 1
5659
if (!$LocalModuleInfo) {
5760
Write-Error "$FunctionName cannot find local module '$ModuleName'"
@@ -62,7 +65,6 @@ function Update-GitModule {
6265
} else {
6366
Install-ModuleInfo -ModuleInfo $RemoteModuleInfo -DestinationPath $DestinationPath -Force:$Force
6467
}
65-
6668
}
6769
}
6870

Tests/module/InstallModuleFromGit.Tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Describe 'Proper Module Declaration' -Tag 'Documentation' {
3838

3939
$ModuleManifest = Test-ModuleManifest $ModuleManifestFile
4040
$ModuleVersion = $ModuleManifest.Version
41-
It 'Module version must be x.y.z' {
41+
It 'Module version must be x.y.z' {
4242
($ModuleVersion.ToString() -split '\.').Count -ge 3 | Should -Be $true -Because "Module with version $ModuleVersion cannot exist online"
4343
}
4444

tools/InvokeTests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function InstallModule ([string]$Name,[version]$Version,[version]$MaxVersion=$nu
3131

3232
if ($env:TF_BUILD) {
3333
$PSVersionTable
34-
Get-ChildItem Env:\
34+
Get-ChildItem Env:\
3535
$Env:PSModulePath -split (';:'[[int]($IsLinux -or $IsMacOS)])
3636
Get-Module -ListAvailable | Format-Table -Property ModuleType, Name, Version
3737
}
@@ -57,7 +57,7 @@ switch ($TestsToRun) {
5757
'FunctionalityOnly' { $Tags = @('Functionality','Other') }
5858
'DocumentationOnly' { $Tags = @('Documentation','Other') }
5959
'All' { $Tags = @('Documentation','Functionality','Other') }
60-
}
60+
}
6161

6262
Write-Host "Run Pester tests"
6363
$Result = Invoke-Pester -Path "$tests/module", "$tests/functions" -Tag $Tags -PassThru -OutputFile PesterTestResults.xml

0 commit comments

Comments
 (0)