@@ -70,7 +70,6 @@ function GetOperation {
7070 }
7171
7272 $resourcesExist = @ ()
73- $resourcesMissing = @ ()
7473
7574 Add-Type - AssemblyName " $PSScriptRoot /dependencies/NuGet.Versioning.dll"
7675
@@ -85,25 +84,19 @@ function GetOperation {
8584 if ($versionRange.Satisfies ($resourceVersion )) {
8685 $resourcesExist += $resource
8786 }
88- else {
89- $resourcesMissing += $inputResource
90- }
9187 }
9288 catch {
9389 # Fallback: simple string comparison (not full NuGet range support)
9490 if ($resource.Version.ToString () -eq $inputResource.Version ) {
9591 $resourcesExist += $resource
9692 }
97- else {
98- $resourcesMissing += $inputResource
99- }
10093 }
10194 }
10295 }
10396 }
10497 }
10598
106- PopulatePSResourcesObjectByRepository - resourcesExist $resourcesExist - resourcesMissing $resourcesMissing - repositoryName $inputObj.repositoryName - scope $inputObj.Scope
99+ PopulatePSResourcesObjectByRepository - resourcesExist $resourcesExist - inputResources $inputObj .resources - repositoryName $inputObj.repositoryName - scope $inputObj.Scope
107100 }
108101 default { throw " Unknown ResourceType: $ResourceType " }
109102 }
@@ -197,40 +190,44 @@ function FilterPSResourcesByRepository {
197190function PopulatePSResourcesObjectByRepository {
198191 param (
199192 $resourcesExist ,
200- $resourcesMissing ,
193+ $inputResources ,
201194 $repositoryName ,
202195 $scope
203196 )
204197
205198 $resources = @ ()
199+ $resourcesObj = @ ()
206200
207- $resources += $resourcesExist | ForEach-Object {
208- [pscustomobject ]@ {
209- name = $_.Name
210- version = $_.Version.ToString ()
211- _exists = $true
201+ if (-not $resourcesExist ) {
202+ $resourcesObj = $inputResources | ForEach-Object {
203+ [pscustomobject ]@ {
204+ name = $_.Name
205+ version = $_.Version.ToString ()
206+ _exists = $false
207+ }
212208 }
213209 }
214-
215- $resources += $resourcesMissing | ForEach-Object {
216- [pscustomobject ]@ {
217- name = $_.Name
218- version = $_.Version.ToString ()
219- _exists = $false
210+ else {
211+ $resources += $resourcesExist | ForEach-Object {
212+ [pscustomobject ]@ {
213+ name = $_.Name
214+ version = $_.Version.ToString ()
215+ _exists = $true
216+ }
220217 }
221- }
222218
223- $resourcesObj = if ($scope ) {
224- [pscustomobject ]@ {
225- repositoryName = $repositoryName
226- scope = $scope
227- resources = $resources
219+ $resourcesObj = if ($scope ) {
220+ [pscustomobject ]@ {
221+ repositoryName = $repositoryName
222+ scope = $scope
223+ resources = $resources
224+ }
228225 }
229- }
230- else {
231- [ pscustomobject ] @ {
232- repositoryName = $repositoryName
233- resources = $resources
226+ else {
227+ [ pscustomobject ] @ {
228+ repositoryName = $repositoryName
229+ resources = $resources
230+ }
234231 }
235232 }
236233
0 commit comments