From 17d32731cce4b3507a6cdd5b19affa847a39f44c Mon Sep 17 00:00:00 2001 From: corbob Date: Thu, 17 Oct 2019 20:08:31 -0700 Subject: [PATCH 1/3] Initial Pass at something. Adding it to Source Control so I have it... --- PSProfile/Classes/PSProfile.Classes.ps1 | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/PSProfile/Classes/PSProfile.Classes.ps1 b/PSProfile/Classes/PSProfile.Classes.ps1 index f0cc21b..f26795f 100644 --- a/PSProfile/Classes/PSProfile.Classes.ps1 +++ b/PSProfile/Classes/PSProfile.Classes.ps1 @@ -638,14 +638,25 @@ if ($env:AWS_PROFILE) { $g = 0 $b = 0 $pInfo.EnumerateDirectories('.git',[System.IO.SearchOption]::AllDirectories) | ForEach-Object { + $PathName = $_.Parent.BaseName + $FullPathName = $_.Parent.FullName $g++ $this._log( - "Found git project @ $($_.Parent.FullName)", + "Found git project @ $($FullPathName)", 'FindProjects', 'Verbose' ) - $this.GitPathMap[$_.Parent.BaseName] = $_.Parent.FullName - $bldPath = [System.IO.Path]::Combine($_.Parent.FullName,'build.ps1') + $currPath = $_.Parent + while($this.GitPathMap.ContainsKey($PathName)){ + $this._log( + "Uh oh... $PathName already exists for a git repository...", + 'FindProjects', + 'Warning' + ) + $PathName = "$PathName-$($currPath.Parent.BaseName)" + } + $this.GitPathMap[$PathName] = $FullPathName + $bldPath = [System.IO.Path]::Combine($FullPathName,'build.ps1') if ([System.IO.File]::Exists($bldPath)) { $b++ $this._log( @@ -653,7 +664,7 @@ if ($env:AWS_PROFILE) { 'FindProjects', 'Verbose' ) - $this.PSBuildPathMap[$_.Parent.BaseName] = $_.Parent.FullName + $this.PSBuildPathMap[$PathName] = $FullPathName } } $this._log( From 42411d4bf95914fdde04eeb6a29dc626643bd87b Mon Sep 17 00:00:00 2001 From: corbob Date: Thu, 17 Oct 2019 21:17:19 -0700 Subject: [PATCH 2/3] Some more changes... This doesn't update the build paths if they already existed... --- PSProfile/Classes/PSProfile.Classes.ps1 | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/PSProfile/Classes/PSProfile.Classes.ps1 b/PSProfile/Classes/PSProfile.Classes.ps1 index f26795f..4d92bd9 100644 --- a/PSProfile/Classes/PSProfile.Classes.ps1 +++ b/PSProfile/Classes/PSProfile.Classes.ps1 @@ -646,14 +646,13 @@ if ($env:AWS_PROFILE) { 'FindProjects', 'Verbose' ) - $currPath = $_.Parent + $currPath = $_ while($this.GitPathMap.ContainsKey($PathName)){ - $this._log( - "Uh oh... $PathName already exists for a git repository...", - 'FindProjects', - 'Warning' - ) - $PathName = "$PathName-$($currPath.Parent.BaseName)" + $currPath = $currPath.Parent + $doublePath = [System.IO.DirectoryInfo]::new($this.GitPathMap[$PathName]) + $this.GitPathMap["$($doublePath.Parent)\$($doublePath.BaseName)"] = $doublePath.FullName + $this.GitPathMap.Remove($PathName) + $PathName = "$($currPath.Parent.BaseName)\$PathName" } $this.GitPathMap[$PathName] = $FullPathName $bldPath = [System.IO.Path]::Combine($FullPathName,'build.ps1') From 14d5c63639774bb8f3f428a3b58a8e8b8d88dc10 Mon Sep 17 00:00:00 2001 From: corbob Date: Mon, 21 Oct 2019 20:35:12 -0700 Subject: [PATCH 3/3] Update Build Paths if they're duplicated. This will keep the git path and build path in sync. --- PSProfile/Classes/PSProfile.Classes.ps1 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/PSProfile/Classes/PSProfile.Classes.ps1 b/PSProfile/Classes/PSProfile.Classes.ps1 index 4d92bd9..7194ae2 100644 --- a/PSProfile/Classes/PSProfile.Classes.ps1 +++ b/PSProfile/Classes/PSProfile.Classes.ps1 @@ -652,6 +652,11 @@ if ($env:AWS_PROFILE) { $doublePath = [System.IO.DirectoryInfo]::new($this.GitPathMap[$PathName]) $this.GitPathMap["$($doublePath.Parent)\$($doublePath.BaseName)"] = $doublePath.FullName $this.GitPathMap.Remove($PathName) + if($this.PSBuildPathMap.ContainsKey($PathName)){ + $PSBuildPath = [System.IO.DirectoryInfo]::new($this.PSBuildPathMap[$PathName]) + $this.PSBuildPathMap["$($PSBuildPath.Parent)\$($PSBuildPath.BaseName)"] = $doublePath.FullName + $this.PSBuildPathMap.Remove($PathName) + } $PathName = "$($currPath.Parent.BaseName)\$PathName" } $this.GitPathMap[$PathName] = $FullPathName