mirror of
https://github.com/actions/runner-images.git
synced 2025-12-12 12:06:59 +00:00
* Minor improvements * fix typos * fix brew rendering * add temp test * Implement tests * Add arguments validation * ToMarkdown() * Use before-All and helpers * Get rid of arrays * Add validation, no new nodes after header * Fix naming * add workflow * Revisit comments + tiny improvements * Fix tables * Fix html table indent * remove comment * attemp to break test - testing CI * revert breaking test * fix nitpicks
56 lines
1.5 KiB
PowerShell
56 lines
1.5 KiB
PowerShell
############################
|
|
### Abstract base nodes ####
|
|
############################
|
|
|
|
# Abstract base class for all nodes
|
|
class BaseNode {
|
|
[Boolean] ShouldBeIncludedToDiff() {
|
|
return $false
|
|
}
|
|
|
|
[String] ToMarkdown() {
|
|
return $this.ToMarkdown(1)
|
|
}
|
|
|
|
[String] ToMarkdown([Int32] $Level) {
|
|
throw "Abtract method 'ToMarkdown(level)' is not implemented for '$($this.GetType().Name)'"
|
|
}
|
|
|
|
[Boolean] IsSimilarTo([BaseNode] $OtherNode) {
|
|
throw "Abtract method 'IsSimilarTo' is not implemented for '$($this.GetType().Name)'"
|
|
}
|
|
|
|
[Boolean] IsIdenticalTo([BaseNode] $OtherNode) {
|
|
throw "Abtract method 'IsIdenticalTo' is not implemented for '$($this.GetType().Name)'"
|
|
}
|
|
}
|
|
|
|
# Abstract base class for all nodes that describe a tool and should be rendered inside diff table
|
|
class BaseToolNode: BaseNode {
|
|
[ValidateNotNullOrEmpty()]
|
|
[String] $ToolName
|
|
|
|
BaseToolNode([String] $ToolName) {
|
|
$this.ToolName = $ToolName
|
|
}
|
|
|
|
[Boolean] ShouldBeIncludedToDiff() {
|
|
return $true
|
|
}
|
|
|
|
[String] GetValue() {
|
|
throw "Abtract method 'GetValue' is not implemented for '$($this.GetType().Name)'"
|
|
}
|
|
|
|
[Boolean] IsSimilarTo([BaseNode] $OtherNode) {
|
|
if ($this.GetType() -ne $OtherNode.GetType()) {
|
|
return $false
|
|
}
|
|
|
|
return $this.ToolName -eq $OtherNode.ToolName
|
|
}
|
|
|
|
[Boolean] IsIdenticalTo([BaseNode] $OtherNode) {
|
|
return $this.IsSimilarTo($OtherNode) -and ($this.GetValue() -eq $OtherNode.GetValue())
|
|
}
|
|
} |