File: version-template.ps1

package info (click to toggle)
hexchat 2.10.1-1%2Bdeb8u2
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 16,676 kB
  • ctags: 6,393
  • sloc: ansic: 61,990; sh: 11,673; xml: 3,987; perl: 1,144; cs: 576; cpp: 323; makefile: 297; python: 45
file content (12 lines) | stat: -rw-r--r-- 510 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
param ([string] $templateFilename, [string] $outputFilename)

$versionParts = Select-String -Path "${env:SOLUTIONDIR}configure.ac" -Pattern '^AC_INIT\(\[HexChat\],\[([^]]+)\]\)$' | 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)