Skip to content

Commit e981f8e

Browse files
Merge pull request #201 from StartAutomating/EZ-Fix
EZOut 2.0.3
2 parents 01e9fdd + db1d0e6 commit e981f8e

File tree

11 files changed

+104
-69
lines changed

11 files changed

+104
-69
lines changed

Build/EZOut.PSA.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Get-BskyActorProfile -Actor $env:AT_PROTOCOL_HANDLE -Cache | Out-Host
2222

2323
$isMergeToMain =
2424
($gitHubEvent.head_commit.message -match "Merge Pull Request #(?<PRNumber>\d+)") -and
25-
$gitHubEvent.ref -eq 'refs/heads/main'
25+
$gitHubEvent.ref -in 'refs/heads/main','refs/heads/master'
2626

2727
Push-Location ($PSScriptRoot | Split-Path)
2828

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
## EZOut 2.0.3:
2+
3+
* Mounting EZOut as a drive (#200)
4+
* Exporting $EZOut (#199)
5+
* Improving Multifile output (#195, #196, #197, #198)
6+
* Fixing PSA branch (#194)
7+
8+
---
9+
110
## 2.0.2
211

312
* Import Improvements

Commands/Format.PS1XML/Out-FormatData.ps.ps1

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -400,42 +400,41 @@ $Aspect = {
400400
if (-not $configurationXml) { return }
401401

402402
if ($OutputPath) {
403-
403+
$alreadyExportedTypeNames = @{}
404+
$allTypeNames = @()
405+
404406
if ($outputPath -is [string]) {
405407
$createdOutputFile = New-Item -ItemType File -Path $OutputPath -Force
406408
if (-not $createdOutputFile) { return }
407409
$configurationXml.Save($createdOutputFile.FullName)
408410
Get-Item -LiteralPath $createdOutputFile.FullName
409411
}
410-
else {
412+
else {
411413
$fileOutputs = [Ordered]@{}
412414
$viewsXml = "<Views>$views</Views>" -as [xml]
413415
if (-not $viewsXml) { return }
414416
:nextView foreach ($view in $viewsXml.Views.View) {
415417
$viewTypeNames = @($view.ViewSelectedBy.TypeName)
416418
if (($OutputPath -isnot [Collections.IDictionary])) { continue }
417-
foreach ($_ in $OutputPath.GetEnumerator()) {
418-
if ($_.Key -isnot [regex] -and $_.Key -isnot [string]) {
419-
continue nextview
420-
}
421-
if ($_.Key -is [string] -and -not ($viewTypeNames -like $_.Key)) {
422-
continue nextview
423-
}
424-
if ($_.Key -is [Regex] -and -not ($viewTypeNames -match $_.Key)) {
425-
continue nextview
426-
}
427-
$kv = $_
428-
if (-not $fileOutputs[$kv.Value]) {
429-
$fileOutputs[$kv.Value] = @()
419+
foreach ($outPath in $OutputPath.GetEnumerator()) {
420+
continue nextView if ($alreadyExportedTypeNames[$viewTypeNames]) {}
421+
continue if ($outPath.Key -isnot [regex] -and $outPath.Key -isnot [string])
422+
continue if ($outPath.Key -is [string] -and -not ($viewTypeNames -like $outPath.Key))
423+
continue if ($outPath.Key -is [Regex] -and -not ($viewTypeNames -match $outPath.Key))
424+
425+
if (-not $fileOutputs[$outPath.Value]) {
426+
$fileOutputs[$outPath.Value] = @()
430427
}
431-
$fileOutputs[$kv.Value] += $view
428+
$fileOutputs[$outPath.Value] += $view
429+
$alreadyExportedTypeNames[$viewTypeNames] = $kv.Value
430+
continue nextView
432431
}
433432
}
434433
foreach ($fileOut in $fileOutputs.GetEnumerator()) {
435434
$controlsInThisFile = [Ordered]@{}
436435

437436
$fileViews = "
438-
<Views>$(foreach ($view in $fileOut.Value) {
437+
<ViewDefinitions>$(foreach ($view in $fileOut.Value) {
439438
$customControlReferences = $view.SelectNodes(".//CustomControlName")
440439
if (-not $customControlReferences) { continue }
441440
$controlsXml = "<Controls>$Controls</Controls>" -as [xml]
@@ -446,10 +445,10 @@ $Aspect = {
446445
}
447446
}
448447
$view.OuterXml
449-
})</Views>
448+
})</ViewDefinitions>
450449
"
451450
$fileControls = if ($controlsInThisFile.Count) {
452-
@($controlsInThisFile.Values)
451+
"<Controls>$(@($controlsInThisFile.Values))</Controls>"
453452
} else { $null }
454453
$fileXml = "
455454
<!-- Generated with EZOut $($MyInvocation.MyCommand.Module.Version): Install-Module EZOut or https://github.com/StartAutomating/EZOut -->

Commands/Format.PS1XML/Out-FormatData.ps1

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -412,42 +412,42 @@ $Aspect = {
412412
if (-not $configurationXml) { return }
413413

414414
if ($OutputPath) {
415-
415+
$alreadyExportedTypeNames = @{}
416+
$allTypeNames = @()
416417
if ($outputPath -is [string]) {
417418
$createdOutputFile = New-Item -ItemType File -Path $OutputPath -Force
418419
if (-not $createdOutputFile) { return }
419420
$configurationXml.Save($createdOutputFile.FullName)
420421
Get-Item -LiteralPath $createdOutputFile.FullName
421422
}
422-
else {
423+
else {
423424
$fileOutputs = [Ordered]@{}
424425
$viewsXml = "<Views>$views</Views>" -as [xml]
425426
if (-not $viewsXml) { return }
426427
:nextView foreach ($view in $viewsXml.Views.View) {
427428
$viewTypeNames = @($view.ViewSelectedBy.TypeName)
428429
if (($OutputPath -isnot [Collections.IDictionary])) { continue }
429-
foreach ($_ in $OutputPath.GetEnumerator()) {
430-
if ($_.Key -isnot [regex] -and $_.Key -isnot [string]) {
431-
continue nextview
432-
}
433-
if ($_.Key -is [string] -and -not ($viewTypeNames -like $_.Key)) {
434-
continue nextview
430+
foreach ($outPath in $OutputPath.GetEnumerator()) {
431+
if ($alreadyExportedTypeNames[$viewTypeNames]) {
432+
continue nextView
435433
}
436-
if ($_.Key -is [Regex] -and -not ($viewTypeNames -match $_.Key)) {
437-
continue nextview
438-
}
439-
$kv = $_
440-
if (-not $fileOutputs[$kv.Value]) {
441-
$fileOutputs[$kv.Value] = @()
434+
if (($outPath.Key -isnot [regex] -and $outPath.Key -isnot [string])) { continue }
435+
if (($outPath.Key -is [string] -and -not ($viewTypeNames -like $outPath.Key))) { continue }
436+
if (($outPath.Key -is [Regex] -and -not ($viewTypeNames -match $outPath.Key))) { continue }
437+
438+
if (-not $fileOutputs[$outPath.Value]) {
439+
$fileOutputs[$outPath.Value] = @()
442440
}
443-
$fileOutputs[$kv.Value] += $view
441+
$fileOutputs[$outPath.Value] += $view
442+
$alreadyExportedTypeNames[$viewTypeNames] = $kv.Value
443+
continue nextView
444444
}
445445
}
446446
foreach ($fileOut in $fileOutputs.GetEnumerator()) {
447447
$controlsInThisFile = [Ordered]@{}
448448

449449
$fileViews = "
450-
<Views>$(foreach ($view in $fileOut.Value) {
450+
<ViewDefinitions>$(foreach ($view in $fileOut.Value) {
451451
$customControlReferences = $view.SelectNodes(".//CustomControlName")
452452
if (-not $customControlReferences) { continue }
453453
$controlsXml = "<Controls>$Controls</Controls>" -as [xml]
@@ -458,10 +458,10 @@ $Aspect = {
458458
}
459459
}
460460
$view.OuterXml
461-
})</Views>
461+
})</ViewDefinitions>
462462
"
463463
$fileControls = if ($controlsInThisFile.Count) {
464-
@($controlsInThisFile.Values)
464+
"<Controls>$(@($controlsInThisFile.Values))</Controls>"
465465
} else { $null }
466466
$fileXml = "
467467
<!-- Generated with EZOut $($MyInvocation.MyCommand.Module.Version): Install-Module EZOut or https://github.com/StartAutomating/EZOut -->
756 Bytes
Binary file not shown.

Commands/Types.PS1XML/Out-TypeData.ps1

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,25 +76,27 @@ function Out-TypeData {
7676
}
7777
else {
7878
$fileOutputs = [Ordered]@{}
79+
$alreadyExportedTypeNames = @{}
80+
$allTypeNames = @()
7981

8082
:nextType foreach ($typeXml in $xml.Types.Type) {
8183
$viewTypeNames = @($typeXml.Name)
84+
$allTypeNames += $viewTypeNames
8285
if (($OutputPath -isnot [Collections.IDictionary])) { continue }
83-
foreach ($_ in $OutputPath.GetEnumerator()) {
84-
if ($_.Key -isnot [regex] -and $_.Key -isnot [string]) {
85-
continue nextType
86-
}
87-
if ($_.Key -is [string] -and -not ($viewTypeNames -like $_.Key)) {
88-
continue nextType
89-
}
90-
if ($_.Key -is [Regex] -and -not ($viewTypeNames -match $_.Key)) {
86+
foreach ($outPath in $OutputPath.GetEnumerator()) {
87+
if ($alreadyExportedTypeNames[$viewTypeNames]) {
9188
continue nextType
9289
}
93-
$kv = $_
94-
if (-not $fileOutputs[$kv.Value]) {
95-
$fileOutputs[$kv.Value] = @()
90+
if (($outPath.Key -isnot [regex] -and $outPath.Key -isnot [string])) { continue }
91+
if (($outPath.Key -is [string] -and -not ($viewTypeNames -like $outPath.Key))) { continue }
92+
if (($outPath.Key -is [Regex] -and -not ($viewTypeNames -match $outPath.Key))) { continue }
93+
94+
if (-not $fileOutputs[$outPath.Value]) {
95+
$fileOutputs[$outPath.Value] = @()
9696
}
97-
$fileOutputs[$kv.Value] += $typeXml.OuterXml
97+
$fileOutputs[$outPath.Value] += $typeXml.OuterXml
98+
$alreadyExportedTypeNames[$viewTypeNames] = $kv.Value
99+
continue nextType
98100
}
99101
}
100102
foreach ($fileOut in $fileOutputs.GetEnumerator()) {

EZOut.format.ps1xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- Generated with EZOut 2.0.2: Install-Module EZOut or https://github.com/StartAutomating/EZOut -->
1+
<!-- Generated with EZOut 2.0.3: Install-Module EZOut or https://github.com/StartAutomating/EZOut -->
22
<Configuration>
33
<ViewDefinitions>
44
<View>

EZOut.psd1

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@{
22
ModuleToProcess = 'EZOut.psm1'
3-
ModuleVersion = '2.0.2'
3+
ModuleVersion = '2.0.3'
44
GUID = 'cef786f0-8a0b-4a5d-a2c6-b433095354cd'
55
Author = 'James Brundage'
66
CompanyName = 'Start-Automating'
@@ -69,20 +69,12 @@
6969

7070
Tags = '.ps1xml', 'Format','Output','Types', 'Colorized'
7171
ReleaseNotes = @'
72-
## 2.0.2
72+
## EZOut 2.0.3:
7373
74-
* Import Improvements
75-
* Import-TypeView - -TextFileType (#174)
76-
* Import-TypeView - *.class.ps1 will become netproperties (#167)
77-
* Import-FormatView - Adding -FormatFilePattern (#175)
78-
* Import-FormatView - Including *.control.ps1 (#162)
79-
* Output Improvements
80-
* Out-TypeData -OutputPath (#173, #178)
81-
* Out-FormatData -OutputPath (#172, #177)
82-
* Write-EZFormatFile -OutputPath (#179/#180)
83-
* Write-EZFormatFile piping support (#188)
84-
* Out-Alternate - Adding -ModuleName/-PS1XMLPath (#163)
85-
* Integrated PSA into build (#189, #190, #191, #192)
74+
* Mounting EZOut as a drive (#200)
75+
* Exporting $EZOut (#199)
76+
* Improving Multifile output (#195, #196, #197, #198)
77+
* Fixing PSA branch (#194)
8678
8779
---
8880

EZOut.psm1

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,25 @@ if ($partsDirectory) { # If we have parts directory
4747

4848

4949
Update-FormatData -PrependPath $psScriptRoot\EZOut.format.ps1xml
50+
$myModule = $myInvocation.MyCommand.ScriptBlock.Module
51+
$executionContext.SessionState.PSVariable.Set(
52+
$myModule.Name,
53+
$myModule
54+
)
5055

51-
Export-ModuleMember -Function * -Alias *
52-
$myInvocation.MyCommand.ScriptBlock.Module.OnRemove = {
56+
Export-ModuleMember -Function * -Alias * -Variable $myModule.Name
57+
$newPSDrive = $ExecutionContext.SessionState.InvokeCommand.GetCommand('New-PSDrive', 'Cmdlet')
58+
if ($newPSDrive) {
59+
try {
60+
$newDriveSplat = @{Name = $myModule.Name;Scope = 'Global';PSProvider='FileSystem'}
61+
$newDriveSplat.Root = $myModule | Split-Path
62+
& $newPSDrive @newDriveSplat
63+
} catch {
64+
Write-Verbose "$_"
65+
}
66+
}
67+
68+
$myModule.OnRemove = {
5369
$myModule = Get-Module EZOut
5470
$debuggingTypeNames = $myModule.DebuggingTypeNames
5571
if ($debuggingTypeNames) {
@@ -58,10 +74,18 @@ $myInvocation.MyCommand.ScriptBlock.Module.OnRemove = {
5874
try {
5975
Remove-TypeData -TypeName $typeName -Confirm:$false -ErrorAction Ignore
6076
} catch {
61-
Write-Debug "$_"
77+
Write-Verbose "$_"
6278
}
6379
}
6480
}
6581
Clear-FormatData
6682
Clear-TypeData
83+
$removePSDrive = $ExecutionContext.SessionState.InvokeCommand.GetCommand('Remove-PSDrive', 'Cmdlet')
84+
if ($removePSDrive) {
85+
try {
86+
& $removePSDrive -Name $myModule.Name -Confirm:$false
87+
} catch {
88+
Write-Debug "$_"
89+
}
90+
}
6791
}

EZOut.types.ps1xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- Generated with EZOut 2.0.2: Install-Module EZOut or https://github.com/StartAutomating/EZOut -->
1+
<!-- Generated with EZOut 2.0.3: Install-Module EZOut or https://github.com/StartAutomating/EZOut -->
22
<Types>
33
<Type>
44
<Name>EZOut.Invisible</Name>

0 commit comments

Comments
 (0)