1- properties {
2- $BaseDirectory = Resolve-Path ..
3- $ArtifactsDirectory = " $BaseDirectory \Artifacts\"
1+ properties {
2+ $BaseDirectory = Resolve-Path ..
3+ $ArtifactsDirectory = " $BaseDirectory \Artifacts\"
44 $LibDir = " $BaseDirectory \Lib"
55 $defaultRulePrefix = " AV"
66}
77
88task default - depends Clean , ExtractVersionsFromGit, Compile, CompileCheatsheet, BuildHtml
99
10- task Clean {
10+ task Clean {
1111 if (Test-Path $ArtifactsDirectory ) {
1212 Get-ChildItem $ArtifactsDirectory | ForEach { Remove-Item $_.FullName - Recurse - Force }
1313 }
1414}
1515
1616task ExtractVersionsFromGit {
17-
18- $json = . " $LibDir \GitVersion.exe"
19-
17+
18+ $json = . " $LibDir \GitVersion.exe"
19+
2020 if ($LASTEXITCODE -eq 0 ) {
2121 $version = (ConvertFrom-Json ($json -join " `n " ));
22-
22+
2323 $script :SemVer = $version.SemVer ;
2424 $script :CommitDate = ([datetime ]$version.CommitDate ).ToString(" MMMM d, yyyy" );
2525 }
@@ -51,11 +51,11 @@ task Compile {
5151 $outfile = " $ArtifactsDirectory \Guidelines\CSharpCodingGuidelines.md"
5252
5353 foreach ($file in $files ) {
54- $rawContent = Get-Content $file | Out-String
54+ $rawContent = Get-Content $file | Out-String
5555
5656 $rawContent = $rawContent.replace (' %semver%' , $script :Semver )
57- $rawContent = $rawContent.replace (' %commitdate%' , $script :CommitDate )
58- $rawContent = $rawContent.replace (' 
57+ $rawContent = $rawContent.replace (' %commitdate%' , $script :CommitDate )
58+ $rawContent = $rawContent.replace (' 
5959
6060 # Extract the title of the section from the Frontmatter block
6161 $title = " "
@@ -86,19 +86,19 @@ task Compile {
8686 if ($rule -match " ---(.|\n)*title\: (.+)" ) {
8787 $ruleTitle = $Matches [2 ].Trim()
8888 }
89-
89+
9090 # Extract the severity of the rule from the Frontmatter block
9191 $ruleSeverity = " "
9292 if ($rule -match " ---(.|\n)*severity\: (.+)" ) {
9393 $ruleSeverity = $Matches [2 ].Trim()
9494 }
95-
95+
9696 # Extract the id of the rule from the Frontmatter block
9797 $ruleId = " "
9898 if ($rule -match " ---(.|\n)*rule_id\: (.+)" ) {
9999 $ruleId = $Matches [2 ].Trim()
100100 }
101-
101+
102102 # Extract the id prefix of the rule from the Frontmatter block
103103 $ruleIdPrefix = " {{ site.default_rule_prefix }}"
104104 if ($rule -match " ---(.|\n)*custom_prefix\: (.+)" ) {
@@ -126,7 +126,7 @@ task Compile {
126126
127127 Add-Content - Path $outfile $content
128128 }
129-
129+
130130 Copy-Item - Path " $BaseDirectory \Assets\css\guidelines.css" - Destination " $ArtifactsDirectory \Guidelines\style.css" - recurse - Force
131131 Copy-Item - Path " $BaseDirectory \Assets\Images\" - Destination " $ArtifactsDirectory \Guidelines\Assets\Images" - recurse - Force
132132}
@@ -137,13 +137,13 @@ task CompileCheatsheet {
137137 }
138138
139139 $outfile = " $ArtifactsDirectory \Cheatsheet\Cheatsheet.md"
140-
140+
141141 $content = Get-Content " $BaseDirectory \_pages\Cheatsheet.md"
142142 $content = ($content -replace ' %semver%' , $script :Semver )
143- $content = ($content -replace ' %commitdate%' , $script :CommitDate )
143+ $content = ($content -replace ' %commitdate%' , $script :CommitDate )
144144 $content = ($content -replace ' {{ site.default_rule_prefix }}' , $defaultRulePrefix )
145145 Add-Content $outfile $content
146-
146+
147147 Copy-Item - Path " $BaseDirectory \assets\css\CheatSheet.css" - Destination " $ArtifactsDirectory \Cheatsheet\style.css" - recurse - Force
148148 Copy-Item - Path " $BaseDirectory \assets\Images" - Destination " $ArtifactsDirectory \Cheatsheet\Assets\Images" - recurse - Force
149149}
@@ -157,26 +157,25 @@ task BuildHtml {
157157 Set-Location " $ArtifactsDirectory \Guidelines"
158158
159159 $outfile = " $ArtifactsDirectory \CSharpCodingGuidelines.htm"
160-
161- if (Test-Path $outfile ) {
160+
161+ if (Test-Path $outfile ) {
162162 Remove-Item $outfile
163163 }
164-
165- & " $LibDir \Pandoc\pandoc.exe" CSharpCodingGuidelines.md -f markdown_phpextra - s - o $outfile -- self- contained
164+
165+ & " $LibDir \Pandoc\pandoc.exe" CSharpCodingGuidelines.md -f markdown_phpextra - s - o $outfile -- self- contained
166166
167167 Set-Location " $ArtifactsDirectory \Cheatsheet\"
168168
169169 $outfile = " $ArtifactsDirectory \CSharpCodingGuidelinesCheatsheet.htm"
170-
170+
171171 if (Test-Path $outfile ) {
172172 Remove-Item $outfile
173173 }
174-
175- & " $LibDir \Pandoc\pandoc.exe" Cheatsheet.md -f markdown+ markdown_in_html_blocks - s - o $outfile -- self- contained
174+
175+ & " $LibDir \Pandoc\pandoc.exe" Cheatsheet.md -f markdown+ markdown_in_html_blocks - s - o $outfile -- self- contained
176176 }
177177 finally
178178 {
179179 Set-Location $PreviousPwd
180180 }
181-
182181}
0 commit comments