File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,7 +35,8 @@ function Get-FirebirdEnvironment {
3535 } - SuccessExitCodes @ (0 , 1 ) - Passthru - ErrorMessage ' Failed to run gstat command. Cannot determine Firebird version.'
3636
3737 $version = $null
38- if ($gstatResult.StdOut [0 ] -match ' \-V(\d+\.\d+\.\d+\.\d+)' ) {
38+ if ($gstatResult.StdOut [0 ] -match ' \-[VT](\d+\.\d+\.\d+\.\d+)' ) {
39+ Write-VerboseMark - Message " Parsed Firebird version from gstat: $ ( $matches [1 ]) "
3940 $version = $matches [1 ]
4041 } else {
4142 throw " Cannot determine Firebird version. Unexpected gstat output: $ ( $gstatResult.StdOut ) "
Original file line number Diff line number Diff line change @@ -10,8 +10,10 @@ function Get-FirebirdVersion {
1010 - 'LI-V5.0.3.1683 Firebird 5.0'
1111 - 'WI-V4.0.5.3140 Firebird 4.0'
1212 - 'LI-V3.0.12.33787 Firebird 3.0'
13+ - 'WI-T6.0.0.1887 Firebird 6.0 2e18929' (snapshot/test builds)
1314
1415 Also accepts just the version prefix (e.g. 'LI-V5.0.3.1683').
16+ The 'V' prefix indicates a release build; 'T' indicates a test/snapshot build.
1517 . PARAMETER VersionString
1618 The Firebird version string to parse. Can be piped.
1719 . EXAMPLE
@@ -29,7 +31,7 @@ function Get-FirebirdVersion {
2931 )
3032
3133 process {
32- if ($VersionString -notmatch ' ^(LI|WI)-V (\d+\.\d+\.\d+)\.(\d+)(.*)$' ) {
34+ if ($VersionString -notmatch ' ^(LI|WI)-([VT]) (\d+\.\d+\.\d+)\.(\d+)(.*)$' ) {
3335 throw " Cannot parse Firebird version string: '$VersionString '"
3436 }
3537
@@ -38,16 +40,18 @@ function Get-FirebirdVersion {
3840 ' WI' { ' Windows' }
3941 }
4042
41- $version = [semver ]$Matches [2 ]
42- $build = [int ]$Matches [3 ]
43- $remainder = $Matches [4 ].Trim()
43+ $isSnapshot = $Matches [2 ] -eq ' T'
44+ $version = [semver ]$Matches [3 ]
45+ $build = [int ]$Matches [4 ]
46+ $remainder = $Matches [5 ].Trim()
4447 $serverName = if ($remainder -ne ' ' ) { $remainder } else { $null }
4548
4649 [PSCustomObject ]@ {
4750 Platform = $platform
4851 Version = $version
4952 Build = $build
5053 ServerName = $serverName
54+ IsSnapshot = $isSnapshot
5155 }
5256 }
5357}
Original file line number Diff line number Diff line change 11Import-Module " $PSScriptRoot /../PSFirebird.psd1" - Force
22
33Describe ' Get-FirebirdVersion' - Tag ' Unit' {
4+ It ' Parses a Firebird 6.x snapshot (test build) version string' {
5+ $result = Get-FirebirdVersion ' WI-T6.0.0.1887 Firebird 6.0 2e18929'
6+ $result.Platform | Should - Be ' Windows'
7+ $result.Version | Should - Be ' 6.0.0'
8+ $result.Build | Should - Be 1887
9+ $result.ServerName | Should - Be ' Firebird 6.0 2e18929'
10+ $result.IsSnapshot | Should - BeTrue
11+ }
12+
13+ It ' Parses a Linux snapshot version string' {
14+ $result = Get-FirebirdVersion ' LI-T6.0.0.1887 Firebird 6.0 2e18929'
15+ $result.Platform | Should - Be ' Linux'
16+ $result.Version | Should - Be ' 6.0.0'
17+ $result.IsSnapshot | Should - BeTrue
18+ }
19+
420 It ' Parses a Firebird 5.x Linux version string' {
521 $result = Get-FirebirdVersion ' LI-V5.0.3.1683 Firebird 5.0'
622 $result.Platform | Should - Be ' Linux'
723 $result.Version | Should - Be ' 5.0.3'
824 $result.Build | Should - Be 1683
925 $result.ServerName | Should - Be ' Firebird 5.0'
26+ $result.IsSnapshot | Should - BeFalse
1027 }
1128
1229 It ' Parses a Firebird 4.x Windows version string' {
You can’t perform that action at this time.
0 commit comments