File: version-template.ps1

package info (click to toggle)
hexchat 2.16.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 12,252 kB
  • sloc: ansic: 60,707; xml: 3,988; perl: 1,144; python: 885; cs: 589; cpp: 307; sh: 130; makefile: 34
file content (12 lines) | stat: -rw-r--r-- 495 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
param ([string] $templateFilename, [string] $outputFilename)

$versionParts = Select-String -Path "${env:SOLUTIONDIR}meson.build" -Pattern "  version: '([^']+)',$" | Select-Object -First 1 | %{ $_.Matches[0].Groups[1].Value.Split('.') }

[string[]] $contents = Get-Content $templateFilename -Encoding UTF8 | %{
	while ($_ -match '^(.*?)<#=(.*?)#>(.*?)$') {
		$_ = $Matches[1] + $(Invoke-Expression $Matches[2]) + $Matches[3]
	}
	$_
}

[System.IO.File]::WriteAllLines($outputFilename, $contents)