modules/IssueProcessor/Jira/JiraReleaseNotes.psm1
using module '..\..\Config.psm1' using module '..\Enums.psm1' using module '..\Issue.psm1' using module '.\JiraNotes.psm1' class JiraReleaseNotes: JiraNotes { [string] $headerTemplate = '{0}/main-header.html' [string] $issueListHeaderTemplate = '{0}/issueList-header.html' [string] $issueListBodyTemplate = '{0}/issueList-body.html' [string] $issueListFooterTemplate = '{0}/issueList-footer.html' [string] $footerTemplate = '{0}/issueList-footer.html' JiraReleaseNotes([string] $projectName, [Issue[]] $issues): base($projectName, $issues) { } hidden [PSCustomObject[]] getAsObject(){ $return = @() foreach ($issue in $this.issues){ $return += ([PSCustomObject]@{ PSTypeName = 'ReleaseNote'; key = $issue.key; type = $issue.type; status = $issue.status; assignee = $issue.assignee; priority = $issue.priority; linked = $issue.linkedIsssuesToString() }) } return $return } hidden [string] getAsHtml([string] $releaseStage, [string] $version){ $config = [Config]::Load() # Parameters $header = Get-Item ($this.headerTemplate -f $config.templates.releaseNotes) $issueHeader = Get-Item ($this.issueListHeaderTemplate -f $config.templates.releaseNotes) $issueBody = Get-Item ($this.issueListBodyTemplate -f $config.templates.releaseNotes) $issueFooter = Get-Item ($this.issueListFooterTemplate -f $config.templates.releaseNotes) $footer = Get-Item ($this.footer -f $config.templates.releaseNotes) $return = $header $issueType = '' $returnType = '' foreach ($issue in $this.issues){ if ($issueType -ne $issue.type){ if ($issueType -ne '') { $returnType = $returnType + $issueHeader } $returnType = $returnType + $issueHeader.Replace('{{type}}', $issue.type) $issueType = $issue.type } $itemBody = $issueBody.Replace('{{key}}', $issue.key).Replace('{{type}}', $issue.type) $itemBody = $itemBody.Replace('{{priority}}', $issue.priority).Replace('{{priorityIcon}}', $issue.priorityIcon.Replace('.svg', '.png')) $itemBody = $itemBody.Replace('{{summary}}', $issue.summary).Replace('{{links}}', $issue.linkedIssuesToString('<br />')) $itemBody = $itemBody.Replace('{{status}}', $issue.status).Replace('{{assignee}}', $issue.assignee) $returnType = $returnType + $itemBody } $returnType = $returnType + $issueFooter $return = $return + $returnType + $footer $return = $return.Replace('{{project}}', $this.projectName).Replace('{{version}}', $version) $return = $return.Replace('{{stage}}', $releaseStage) return $return } } |