Skip to content

Commit

Permalink
Merge pull request #113 from theohbrothers/refactor/generate-improve-…
Browse files Browse the repository at this point in the history
…namespacing-of-variables-in-categorized-variants

Refactor (generate): Improve namespacing of variables in categorized variants
  • Loading branch information
joeltimothyoh authored May 31, 2024
2 parents 4d811a5 + 804e426 commit b916142
Show file tree
Hide file tree
Showing 12 changed files with 60 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function Changes-HashSubject-NoMerges-Categorized {
if ($previousRelease) { $funcArgs['SecondRef'] = @($previousRelease)[0] }
$commitHistory = Get-RepositoryCommitHistory @funcArgs
$commitHistoryCollection = $commitHistory -split "`n" | % { $_.Trim() } | ? { $_ }
$commitCategory = @(
$commitHistoryCategory = @(
@{
Name = 'Feature'
Title = 'Features'
Expand Down Expand Up @@ -70,17 +70,17 @@ function Changes-HashSubject-NoMerges-Categorized {
@"
## Changes
"@
foreach ($c in $commitCategory) {
$isTitleOutputted = $false
foreach ($c in $commitHistoryCategory) {
$iscommitHistoryCategoryTitleOutputted = $false
$commitHistoryCollection | % {
if ($_ -match "^[0-9a-f]+ (\s*$($c['Name'])\s*)(\(\s*[a-zA-Z0-9_-]+\s*\)\s*)*:(.+)") {
if (!$isTitleOutputted) {
if (!$iscommitHistoryCategoryTitleOutputted) {
@"
### $($c['Title'])
"@
$isTitleOutputted = $true
$iscommitHistoryCategoryTitleOutputted = $true
}
@"
* $_
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function Changes-HashSubject-NoMerges-CategorizedSorted {
if ($previousRelease) { $funcArgs['SecondRef'] = @($previousRelease)[0] }
$commitHistory = Get-RepositoryCommitHistory @funcArgs
$commitHistoryCollection = $commitHistory -split "`n" | % { $_.Trim() } | ? { $_ }
$commitCategory = @(
$commitHistoryCategory = @(
@{
Name = 'Feature'
Title = 'Features'
Expand Down Expand Up @@ -88,17 +88,17 @@ function Changes-HashSubject-NoMerges-CategorizedSorted {
@"
## Changes
"@
foreach ($c in $commitCategory) {
$isTitleOutputted = $false
foreach ($c in $commitHistoryCategory) {
$iscommitHistoryCategoryTitleOutputted = $false
$commitHistoryCategorizedCustomCollection | Sort-Object -Property Subject | % {
if ("$($_.Ref) $($_.Subject)" -match "^[0-9a-f]+ (\s*$($c['Name'])\s*)(\(\s*[a-zA-Z0-9_-]+\s*\)\s*)*:(.+)") {
if (!$isTitleOutputted) {
if (!$iscommitHistoryCategoryTitleOutputted) {
@"
### $($c['Title'])
"@
$isTitleOutputted = $true
$iscommitHistoryCategoryTitleOutputted = $true
}
@"
* $($_.Ref) $($_.Subject)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function Changes-HashSubjectAuthor-NoMerges-Categorized {
if ($previousRelease) { $funcArgs['SecondRef'] = @($previousRelease)[0] }
$commitHistory = Get-RepositoryCommitHistory @funcArgs
$commitHistoryCollection = $commitHistory -split "`n" | % { $_.Trim() } | ? { $_ }
$commitCategory = @(
$commitHistoryCategory = @(
@{
Name = 'Feature'
Title = 'Features'
Expand Down Expand Up @@ -70,17 +70,17 @@ function Changes-HashSubjectAuthor-NoMerges-Categorized {
@"
## Changes
"@
foreach ($c in $commitCategory) {
$isTitleOutputted = $false
foreach ($c in $commitHistoryCategory) {
$iscommitHistoryCategoryTitleOutputted = $false
$commitHistoryCollection | % {
if ($_ -match "^[0-9a-f]+ (\s*$($c['Name'])\s*)(\(\s*[a-zA-Z0-9_-]+\s*\)\s*)*:(.+)") {
if (!$isTitleOutputted) {
if (!$iscommitHistoryCategoryTitleOutputted) {
@"
### $($c['Title'])
"@
$isTitleOutputted = $true
$iscommitHistoryCategoryTitleOutputted = $true
}
@"
* $_
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function Changes-HashSubjectAuthor-NoMerges-CategorizedSorted {
if ($previousRelease) { $funcArgs['SecondRef'] = @($previousRelease)[0] }
$commitHistory = Get-RepositoryCommitHistory @funcArgs
$commitHistoryCollection = $commitHistory -split "`n" | % { $_.Trim() } | ? { $_ }
$commitCategory = @(
$commitHistoryCategory = @(
@{
Name = 'Feature'
Title = 'Features'
Expand Down Expand Up @@ -90,17 +90,17 @@ function Changes-HashSubjectAuthor-NoMerges-CategorizedSorted {
@"
## Changes
"@
foreach ($c in $commitCategory) {
$isTitleOutputted = $false
foreach ($c in $commitHistoryCategory) {
$iscommitHistoryCategoryTitleOutputted = $false
$commitHistoryCategorizedCustomCollection | Sort-Object -Property Subject | % {
if ("$($_.Ref) $($_.Subject) $($_.Author)" -match "^[0-9a-f]+ (\s*$($c['Name'])\s*)(\(\s*[a-zA-Z0-9_-]+\s*\)\s*)*:(.+)") {
if (!$isTitleOutputted) {
if (!$iscommitHistoryCategoryTitleOutputted) {
@"
### $($c['Title'])
"@
$isTitleOutputted = $true
$iscommitHistoryCategoryTitleOutputted = $true
}
@"
* $($_.Ref) $($_.Subject) $($_.Author)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function VersionDate-HashSubject-NoMerges-Categorized {
if ($previousRelease) { $funcArgs['SecondRef'] = @($previousRelease)[0] }
$commitHistory = Get-RepositoryCommitHistory @funcArgs
$commitHistoryCollection = $commitHistory -split "`n" | % { $_.Trim() } | ? { $_ }
$commitCategory = @(
$commitHistoryCategory = @(
@{
Name = 'Feature'
Title = 'Features'
Expand Down Expand Up @@ -70,17 +70,17 @@ function VersionDate-HashSubject-NoMerges-Categorized {
@"
## $TagName ($(Get-Date -UFormat '%Y-%m-%d'))
"@
foreach ($c in $commitCategory) {
$isTitleOutputted = $false
foreach ($c in $commitHistoryCategory) {
$iscommitHistoryCategoryTitleOutputted = $false
$commitHistoryCollection | % {
if ($_ -match "^[0-9a-f]+ (\s*$($c['Name'])\s*)(\(\s*[a-zA-Z0-9_-]+\s*\)\s*)*:(.+)") {
if (!$isTitleOutputted) {
if (!$iscommitHistoryCategoryTitleOutputted) {
@"
### $($c['Title'])
"@
$isTitleOutputted = $true
$iscommitHistoryCategoryTitleOutputted = $true
}
@"
* $_
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function VersionDate-HashSubject-NoMerges-CategorizedSorted {
if ($previousRelease) { $funcArgs['SecondRef'] = @($previousRelease)[0] }
$commitHistory = Get-RepositoryCommitHistory @funcArgs
$commitHistoryCollection = $commitHistory -split "`n" | % { $_.Trim() } | ? { $_ }
$commitCategory = @(
$commitHistoryCategory = @(
@{
Name = 'Feature'
Title = 'Features'
Expand Down Expand Up @@ -88,17 +88,17 @@ function VersionDate-HashSubject-NoMerges-CategorizedSorted {
@"
## $TagName ($(Get-Date -UFormat '%Y-%m-%d'))
"@
foreach ($c in $commitCategory) {
$isTitleOutputted = $false
foreach ($c in $commitHistoryCategory) {
$iscommitHistoryCategoryTitleOutputted = $false
$commitHistoryCategorizedCustomCollection | Sort-Object -Property Subject | % {
if ("$($_.Ref) $($_.Subject)" -match "^[0-9a-f]+ (\s*$($c['Name'])\s*)(\(\s*[a-zA-Z0-9_-]+\s*\)\s*)*:(.+)") {
if (!$isTitleOutputted) {
if (!$iscommitHistoryCategoryTitleOutputted) {
@"
### $($c['Title'])
"@
$isTitleOutputted = $true
$iscommitHistoryCategoryTitleOutputted = $true
}
@"
* $($_.Ref) $($_.Subject)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function VersionDate-HashSubjectAuthor-NoMerges-Categorized {
if ($previousRelease) { $funcArgs['SecondRef'] = @($previousRelease)[0] }
$commitHistory = Get-RepositoryCommitHistory @funcArgs
$commitHistoryCollection = $commitHistory -split "`n" | % { $_.Trim() } | ? { $_ }
$commitCategory = @(
$commitHistoryCategory = @(
@{
Name = 'Feature'
Title = 'Features'
Expand Down Expand Up @@ -70,17 +70,17 @@ function VersionDate-HashSubjectAuthor-NoMerges-Categorized {
@"
## $TagName ($(Get-Date -UFormat '%Y-%m-%d'))
"@
foreach ($c in $commitCategory) {
$isTitleOutputted = $false
foreach ($c in $commitHistoryCategory) {
$iscommitHistoryCategoryTitleOutputted = $false
$commitHistoryCollection | % {
if ($_ -match "^[0-9a-f]+ (\s*$($c['Name'])\s*)(\(\s*[a-zA-Z0-9_-]+\s*\)\s*)*:(.+)") {
if (!$isTitleOutputted) {
if (!$iscommitHistoryCategoryTitleOutputted) {
@"
### $($c['Title'])
"@
$isTitleOutputted = $true
$iscommitHistoryCategoryTitleOutputted = $true
}
@"
* $_
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function VersionDate-HashSubjectAuthor-NoMerges-CategorizedSorted {
if ($previousRelease) { $funcArgs['SecondRef'] = @($previousRelease)[0] }
$commitHistory = Get-RepositoryCommitHistory @funcArgs
$commitHistoryCollection = $commitHistory -split "`n" | % { $_.Trim() } | ? { $_ }
$commitCategory = @(
$commitHistoryCategory = @(
@{
Name = 'Feature'
Title = 'Features'
Expand Down Expand Up @@ -90,17 +90,17 @@ function VersionDate-HashSubjectAuthor-NoMerges-CategorizedSorted {
@"
## $TagName ($(Get-Date -UFormat '%Y-%m-%d'))
"@
foreach ($c in $commitCategory) {
$isTitleOutputted = $false
foreach ($c in $commitHistoryCategory) {
$iscommitHistoryCategoryTitleOutputted = $false
$commitHistoryCategorizedCustomCollection | Sort-Object -Property Subject | % {
if ("$($_.Ref) $($_.Subject) $($_.Author)" -match "^[0-9a-f]+ (\s*$($c['Name'])\s*)(\(\s*[a-zA-Z0-9_-]+\s*\)\s*)*:(.+)") {
if (!$isTitleOutputted) {
if (!$iscommitHistoryCategoryTitleOutputted) {
@"
### $($c['Title'])
"@
$isTitleOutputted = $true
$iscommitHistoryCategoryTitleOutputted = $true
}
@"
* $($_.Ref) $($_.Subject) $($_.Author)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function VersionDate-Subject-NoMerges-Categorized {
if ($previousRelease) { $funcArgs['SecondRef'] = @($previousRelease)[0] }
$commitHistory = Get-RepositoryCommitHistory @funcArgs
$commitHistoryCollection = $commitHistory -split "`n" | % { $_.Trim() } | ? { $_ }
$commitCategory = @(
$commitHistoryCategory = @(
@{
Name = 'Feature'
Title = 'Features'
Expand Down Expand Up @@ -70,17 +70,17 @@ function VersionDate-Subject-NoMerges-Categorized {
@"
## $TagName ($(Get-Date -UFormat '%Y-%m-%d'))
"@
foreach ($c in $commitCategory) {
$isTitleOutputted = $false
foreach ($c in $commitHistoryCategory) {
$iscommitHistoryCategoryTitleOutputted = $false
$commitHistoryCollection | % {
if ($_ -match "^(\s*$($c['Name'])\s*)(\(\s*[a-zA-Z0-9_-]+\s*\)\s*)*:(.+)") {
if (!$isTitleOutputted) {
if (!$iscommitHistoryCategoryTitleOutputted) {
@"
### $($c['Title'])
"@
$isTitleOutputted = $true
$iscommitHistoryCategoryTitleOutputted = $true
}
@"
* $_
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function VersionDate-Subject-NoMerges-CategorizedSorted {
if ($previousRelease) { $funcArgs['SecondRef'] = @($previousRelease)[0] }
$commitHistory = Get-RepositoryCommitHistory @funcArgs
$commitHistoryCollection = $commitHistory -split "`n" | % { $_.Trim() } | ? { $_ }
$commitCategory = @(
$commitHistoryCategory = @(
@{
Name = 'Feature'
Title = 'Features'
Expand Down Expand Up @@ -86,17 +86,17 @@ function VersionDate-Subject-NoMerges-CategorizedSorted {
@"
## $TagName ($(Get-Date -UFormat '%Y-%m-%d'))
"@
foreach ($c in $commitCategory) {
$isTitleOutputted = $false
foreach ($c in $commitHistoryCategory) {
$iscommitHistoryCategoryTitleOutputted = $false
$commitHistoryCategorizedCustomCollection | Sort-Object -Property Subject | % {
if ("$($_.Subject)" -match "^(\s*$($c['Name'])\s*)(\(\s*[a-zA-Z0-9_-]+\s*\)\s*)*:(.+)") {
if (!$isTitleOutputted) {
if (!$iscommitHistoryCategoryTitleOutputted) {
@"
### $($c['Title'])
"@
$isTitleOutputted = $true
$iscommitHistoryCategoryTitleOutputted = $true
}
@"
* $($_.Subject)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function VersionDate-SubjectAuthor-NoMerges-Categorized {
if ($previousRelease) { $funcArgs['SecondRef'] = @($previousRelease)[0] }
$commitHistory = Get-RepositoryCommitHistory @funcArgs
$commitHistoryCollection = $commitHistory -split "`n" | % { $_.Trim() } | ? { $_ }
$commitCategory = @(
$commitHistoryCategory = @(
@{
Name = 'Feature'
Title = 'Features'
Expand Down Expand Up @@ -70,17 +70,17 @@ function VersionDate-SubjectAuthor-NoMerges-Categorized {
@"
## $TagName ($(Get-Date -UFormat '%Y-%m-%d'))
"@
foreach ($c in $commitCategory) {
$isTitleOutputted = $false
foreach ($c in $commitHistoryCategory) {
$iscommitHistoryCategoryTitleOutputted = $false
$commitHistoryCollection | % {
if ($_ -match "^(\s*$($c['Name'])\s*)(\(\s*[a-zA-Z0-9_-]+\s*\)\s*)*:(.+)") {
if (!$isTitleOutputted) {
if (!$iscommitHistoryCategoryTitleOutputted) {
@"
### $($c['Title'])
"@
$isTitleOutputted = $true
$iscommitHistoryCategoryTitleOutputted = $true
}
@"
* $_
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function VersionDate-SubjectAuthor-NoMerges-CategorizedSorted {
if ($previousRelease) { $funcArgs['SecondRef'] = @($previousRelease)[0] }
$commitHistory = Get-RepositoryCommitHistory @funcArgs
$commitHistoryCollection = $commitHistory -split "`n" | % { $_.Trim() } | ? { $_ }
$commitCategory = @(
$commitHistoryCategory = @(
@{
Name = 'Feature'
Title = 'Features'
Expand Down Expand Up @@ -88,17 +88,17 @@ function VersionDate-SubjectAuthor-NoMerges-CategorizedSorted {
@"
## $TagName ($(Get-Date -UFormat '%Y-%m-%d'))
"@
foreach ($c in $commitCategory) {
$isTitleOutputted = $false
foreach ($c in $commitHistoryCategory) {
$iscommitHistoryCategoryTitleOutputted = $false
$commitHistoryCategorizedCustomCollection | Sort-Object -Property Subject | % {
if ("$($_.Subject) $($_.Author)" -match "^(\s*$($c['Name'])\s*)(\(\s*[a-zA-Z0-9_-]+\s*\)\s*)*:(.+)") {
if (!$isTitleOutputted) {
if (!$iscommitHistoryCategoryTitleOutputted) {
@"
### $($c['Title'])
"@
$isTitleOutputted = $true
$iscommitHistoryCategoryTitleOutputted = $true
}
@"
* $($_.Subject) $($_.Author)
Expand Down

0 comments on commit b916142

Please sign in to comment.