@@ -3,13 +3,13 @@ function Update-GitModule {
3
3
[CmdletBinding (HelpUri = ' https://github.com/iricigor/InstallModuleFromGit/blob/master/Docs/Update-GitModule.md' )]
4
4
5
5
param (
6
-
7
-
6
+
7
+
8
8
[Parameter (Mandatory , ValueFromPipelineByPropertyName , Position = 0 , ParameterSetName = ' ByUri' )]
9
9
[string []]$ProjectUri ,
10
10
# https://github.com/dfinke/InstallModuleFromGitHub
11
11
# https://github.com/iricigor/FIFA2018
12
-
12
+
13
13
[Parameter (Mandatory , ParameterSetName = ' ByName' )]
14
14
[string []]$Name ,
15
15
@@ -29,10 +29,10 @@ function Update-GitModule {
29
29
}
30
30
31
31
if ($env: AGENT_TEMPDIRECTORY ) {
32
- $tmpRoot = $env: AGENT_TEMPDIRECTORY
32
+ $tmpRoot = $env: AGENT_TEMPDIRECTORY
33
33
} else {
34
34
$tmpRoot = [System.IO.Path ]::GetTempPath()
35
- }
35
+ }
36
36
37
37
if ($Name ) {$ProjectUri = ConvertTo-Uri - Name $Name }
38
38
@@ -51,7 +51,10 @@ function Update-GitModule {
51
51
# TODO: continue only after cleanup!
52
52
53
53
# 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
55
58
$LocalModuleInfo = $AllModules | Sort-Object Version - Descending | Select - First 1
56
59
if (! $LocalModuleInfo ) {
57
60
Write-Error " $FunctionName cannot find local module '$ModuleName '"
@@ -62,7 +65,6 @@ function Update-GitModule {
62
65
} else {
63
66
Install-ModuleInfo - ModuleInfo $RemoteModuleInfo - DestinationPath $DestinationPath - Force:$Force
64
67
}
65
-
66
68
}
67
69
}
68
70
0 commit comments