File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -49,14 +49,14 @@ function Get-GitModule {
4949 }
5050 Write-Verbose - Message " $ ( Get-Date -f T) cloning repository to $tempDir "
5151 git clone $P1 -- branch $Branch -- single- branch $tempDir -- quiet
52- $psd1 = ( Get-ChildItem $tempDir - Include * .psd1 - Recurse).FullName
52+ $psd1 = Get-ChildItem $tempDir - Include * .psd1 - Recurse
5353
5454 if ($psd1 -is [array ]) {
5555 $errorText = " $FunctionName found multiple module manifests for $ModuleName "
56- } elseif (! ($psd1 -is [string ])) {
56+ } elseif (! ($psd1.FullName -is [string ])) {
5757 $errorText = " $FunctionName found no module manifest for $ModuleName "
5858 } else {
59- $ModuleVersion = (Get-Content - Raw $psd1 | Invoke-Expression ).ModuleVersion
59+ $ModuleVersion = (Get-Content - Raw $psd1.FullName | Invoke-Expression ).ModuleVersion
6060 $errorText = $null
6161 }
6262
@@ -78,9 +78,11 @@ function Get-GitModule {
7878 [PSCustomObject ]@ {
7979 Name = $ModuleName
8080 Version = $ModuleVersion
81- Path = if ($KeepTempCopy ) {$tempDir } else {$null }
82- Root = ((Split-Path $psd1 - Parent) -eq $tempDir )
83- Git = $P1
81+ LocalPath = if ($KeepTempCopy ) {$tempDir } else {$null }
82+ Root = ((Split-Path $psd1.FullName - Parent) -eq $tempDir )
83+ SameName = ($psd1.BaseName -eq $ModuleName )
84+ ManifestName = $psd1.BaseName
85+ GitPath = $P1
8486 }
8587 }
8688 }
Original file line number Diff line number Diff line change @@ -43,7 +43,14 @@ function Install-GitModule {
4343
4444 $ModuleInfo = Get-GitModule - ProjectUri $P1 - KeepTempCopy
4545 if (! $ModuleInfo -or ($ModuleInfo.Count -gt 1 )) {continue } # we have the error in get-gitmodule
46- if (! $ModuleInfo.Root ) {Write-Warning - Message " $FunctionName installing module with manifest not located in module root directory" }
46+
47+ # verify properties
48+ if (! $ModuleInfo.Root ) {
49+ Write-Warning - Message " $FunctionName installing module with manifest not located in module root directory"
50+ }
51+ if (! $ModuleInfo.SameName ) {
52+ Write-Warning - Message " $FunctionName installing module with module name not the same as its directory name"
53+ }
4754
4855 # check target directory
4956 $TargetDir = Join-Path (Join-Path $DestinationPath $ModuleInfo.Name ) $ModuleInfo.Version
@@ -56,16 +63,16 @@ function Install-GitModule {
5663
5764 # copy module
5865 Write-Verbose - Message " $ ( Get-Date -f T) installing module to $TargetDir "
59- Copy-Item " $ ( $ModuleInfo.Path ) /*" $TargetDir - Force - Recurse | Out-Null
66+ Copy-Item " $ ( $ModuleInfo.LocalPath ) /*" $TargetDir - Force - Recurse | Out-Null
6067
6168 # clean up
6269 $gitDir = Join-Path $TargetDir ' .git'
6370 if (Test-Path $gitDir ) {Remove-Item $gitDir - Recurse - Force}
64- Remove-Item $ModuleInfo.Path - Recurse - Force | Out-Null
71+ Remove-Item $ModuleInfo.LocalPath - Recurse - Force | Out-Null
6572 Write-Verbose - Message " $ ( Get-Date -f T) module $ModuleName installation completed"
6673
6774 # return value
68- $ModuleInfo.Path = $TargetDir
75+ $ModuleInfo.LocalPath = $TargetDir
6976 $ModuleInfo
7077 }
7178 }
Original file line number Diff line number Diff line change @@ -23,4 +23,8 @@ Describe "$CommandName basic testing" -Tag 'Functionality' {
2323 (Get-GitModule $moduleURL ).Name | Should - Be $moduleName
2424 }
2525
26- }
26+ It " $CommandName properly parses retrieved module" {
27+ (Get-GitModule $moduleURL ).SameName | Should - Be $true
28+ }
29+
30+ }
You can’t perform that action at this time.
0 commit comments