1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-08-06 03:20:09 +02:00

Indicate DEV builds in PHP Version Manager

This commit is contained in:
2024-11-15 16:43:59 +01:00
parent 2c39f1db8b
commit 46408f5ee5
2 changed files with 12 additions and 1 deletions

View File

@ -14,6 +14,8 @@ class PhpInstallation {
var iniFiles: [PhpConfigurationFile] = []
var isPreRelease: Bool = false
var isMissingBinary: Bool = false
var isHealthy: Bool = true
@ -59,6 +61,10 @@ class PhpInstallation {
trimNewlines: false
).trimmingCharacters(in: .whitespacesAndNewlines)
if longVersionString.contains("-dev") {
isPreRelease = true
}
// The parser should always work, or the string has to be very unusual.
// If so, the app SHOULD crash, so that the users report what's up.
versionNumber = try! VersionNumber.parse(longVersionString)

View File

@ -46,12 +46,17 @@ class BrewPhpFormulaeHandler: HandlesBrewPhpFormulae {
return Brew.phpVersionFormulae.map { (version, formula) in
var fullVersion: String?
var upgradeVersion: String?
var isPrerelease: Bool = Constants.ExperimentalPhpVersions.contains(version)
if let install = PhpEnvironments.shared.cachedPhpInstallations[version] {
fullVersion = install.versionNumber.text
fullVersion = install.isPreRelease ? "\(fullVersion!)-dev" : fullVersion
upgradeVersion = outdated?.first(where: { formula in
return formula.name == install.formulaName
})?.current_version
isPrerelease = install.isPreRelease
}
return BrewPhpFormula(
@ -59,7 +64,7 @@ class BrewPhpFormulaeHandler: HandlesBrewPhpFormulae {
displayName: "PHP \(version)",
installedVersion: fullVersion,
upgradeVersion: upgradeVersion,
prerelease: Constants.ExperimentalPhpVersions.contains(version)
prerelease: isPrerelease
)
}.sorted { $0.displayName > $1.displayName }
}