Skip to content

Commit d909f75

Browse files
author
Freddy Kristiansen
authored
Merge pull request #2837 from freddydk/master
Issue #2813
2 parents abedf6f + 4641adc commit d909f75

4 files changed

Lines changed: 19 additions & 7 deletions

File tree

AppHandling/Sort-AppFilesByDependencies.ps1

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,13 @@ try {
4848
$appJson = Invoke-ScriptInBcContainer -containerName $containerName -scriptblock { Param($appFile)
4949
Get-NavAppInfo -Path $appFile | ConvertTo-Json -Depth 99
5050
} -argumentList (Get-BcContainerPath -containerName $containerName -path $destFile) | ConvertFrom-Json
51-
#Remove-Item -Path $destFile
51+
Remove-Item -Path $destFile
52+
$appJson.Version = "$($appJson.Version.Major).$($appJson.Version.Minor).$($appJson.Version.Build).$($appJson.Version.Revision)"
5253
$appJson | Add-Member -NotePropertyName 'Id' -NotePropertyValue $appJson.AppId.Value
5354
if ($appJson.Dependencies) {
54-
$appJson.Dependencies | % { if ($_) {
55+
$appJson.Dependencies | ForEach-Object { if ($_) {
5556
$_ | Add-Member -NotePropertyName 'Id' -NotePropertyValue $_.AppId
56-
$_ | Add-Member -NotePropertyName 'Version' -NotePropertyValue $_.MinVersion.ToString()
57+
$_ | Add-Member -NotePropertyName 'Version' -NotePropertyValue "$($_.MinVersion.Major).$($_.MinVersion.Minor).$($_.MinVersion.Build).$($_.MinVersion.Revision)"
5758
} }
5859
}
5960
}

Common/Invoke-gh.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#>
77
function invoke-gh {
88
Param(
9+
[parameter(mandatory = $false, ValueFromPipeline = $true)]
10+
[string] $inputStr = "",
911
[switch] $silent,
1012
[switch] $returnValue,
1113
[parameter(mandatory = $true, position = 0)][string] $command,
@@ -21,7 +23,7 @@ function invoke-gh {
2123
$arguments += "$_ "
2224
}
2325
}
24-
cmdDo -command gh -arguments $arguments -silent:$silent -returnValue:$returnValue
26+
cmdDo -command gh -arguments $arguments -silent:$silent -returnValue:$returnValue -inputStr $inputStr
2527
}
2628

2729
Export-ModuleMember -Function Invoke-gh

Common/Invoke-git.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#>
77
function invoke-git {
88
Param(
9+
[parameter(mandatory = $false, ValueFromPipeline = $true)]
10+
[string] $inputStr = "",
911
[switch] $silent,
1012
[switch] $returnValue,
1113
[parameter(mandatory = $true, position = 0)][string] $command,
@@ -21,6 +23,6 @@ function invoke-git {
2123
$arguments += "$_ "
2224
}
2325
}
24-
cmdDo -command git -arguments $arguments -silent:$silent -returnValue:$returnValue
26+
cmdDo -command git -arguments $arguments -silent:$silent -returnValue:$returnValue -inputStr $inputStr
2527
}
2628
Export-ModuleMember -Function Invoke-git

HelperFunctions.ps1

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ function CmdDo {
7575
[string] $command = "",
7676
[string] $arguments = "",
7777
[switch] $silent,
78-
[switch] $returnValue
78+
[switch] $returnValue,
79+
[string] $inputStr = ""
7980
)
8081

8182
$oldNoColor = "$env:NO_COLOR"
@@ -88,6 +89,9 @@ function CmdDo {
8889
$pinfo.FileName = $command
8990
$pinfo.RedirectStandardError = $true
9091
$pinfo.RedirectStandardOutput = $true
92+
if ($inputStr) {
93+
$pinfo.RedirectStandardInput = $true
94+
}
9195
$pinfo.WorkingDirectory = Get-Location
9296
$pinfo.UseShellExecute = $false
9397
$pinfo.Arguments = $arguments
@@ -96,7 +100,10 @@ function CmdDo {
96100
$p = New-Object System.Diagnostics.Process
97101
$p.StartInfo = $pinfo
98102
$p.Start() | Out-Null
99-
103+
if ($inputStr) {
104+
$p.StandardInput.WriteLine($inputStr)
105+
$p.StandardInput.Close()
106+
}
100107
$outtask = $p.StandardOutput.ReadToEndAsync()
101108
$errtask = $p.StandardError.ReadToEndAsync()
102109
$p.WaitForExit();

0 commit comments

Comments
 (0)