trim trailing spaces

This commit is contained in:
David Refoua 2022-10-15 12:46:13 +03:30
parent 23edc8036f
commit abbab3f8b4
10 changed files with 34 additions and 45 deletions

View File

@ -66,33 +66,26 @@ function Digest-Hash($path) {
}
function Get-VersionStr() {
# Clear existing variable
if ($string) { Clear-Variable -name string }
# Determine if git is available
if (Get-Command "git.exe" -ErrorAction SilentlyContinue)
{
if (Get-Command "git.exe" -ErrorAction SilentlyContinue) {
# Determine if the current diesctory is a git repository
$GitPresent = Invoke-Expression "git rev-parse --is-inside-work-tree" -erroraction SilentlyContinue
if ( $GitPresent -eq 'true' )
{
if ( $GitPresent -eq 'true' ) {
$string = Invoke-Expression "git describe --abbrev=0 --tags"
}
}
# Fallback used when Git is not available
if ( -not($string) )
{
if ( -not($string) ) {
$string = Parse-Changelog ($PSScriptRoot + '\..\' + 'CHANGELOG.md')
}
# Add build number, if AppVeyor is present
if ( $Env:APPVEYOR -eq 'True' )
{
if ( $Env:APPVEYOR -eq 'True' ) {
$string = $string + '.' + $Env:APPVEYOR_BUILD_NUMBER
}
@ -100,11 +93,9 @@ function Get-VersionStr() {
$string = $string -replace '^v+','' # normalize version string
return $string
}
function Parse-Changelog($file) {
# Define the regular expression to match the version string from changelog
[regex]$regex = '^## \[(?<version>[\w\-\.]+)\]\([^\n()]+\)\s+\([^\n()]+\)$';
@ -115,7 +106,6 @@ function Parse-Changelog($file) {
}
function Create-RC($string, $path) {
$version = $string + '.0.0.0.0' # padding for version string
if ( !(Test-Path "$path.sample") ) {
@ -141,7 +131,6 @@ function Create-RC($string, $path) {
# Write the results
Set-Content -Path $path -Value $resource
}
function Register-Cmder() {