mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-10 21:10:08 +02:00
✨ Allow pre-release builds to be installed
This commit is contained in:
@@ -18,6 +18,13 @@ struct Constants {
|
|||||||
*/
|
*/
|
||||||
static let MinimumRecommendedValetVersion = "2.16.2"
|
static let MinimumRecommendedValetVersion = "2.16.2"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The PHP versions that are considered pre-release versions.
|
||||||
|
*/
|
||||||
|
static let ExperimentalPhpVersions: Set = [
|
||||||
|
"8.3", "8.4"
|
||||||
|
]
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The PHP versions supported by this application.
|
* The PHP versions supported by this application.
|
||||||
* Any other PHP versions are considered invalid.
|
* Any other PHP versions are considered invalid.
|
||||||
@@ -25,7 +32,9 @@ struct Constants {
|
|||||||
static let DetectedPhpVersions: Set = [
|
static let DetectedPhpVersions: Set = [
|
||||||
"5.6",
|
"5.6",
|
||||||
"7.0", "7.1", "7.2", "7.3", "7.4",
|
"7.0", "7.1", "7.2", "7.3", "7.4",
|
||||||
"8.0", "8.1", "8.2", "8.3"
|
"8.0", "8.1", "8.2",
|
||||||
|
"8.3",
|
||||||
|
"8.4"
|
||||||
]
|
]
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -42,13 +51,13 @@ struct Constants {
|
|||||||
[
|
[
|
||||||
"7.0", "7.1", "7.2", "7.3", "7.4",
|
"7.0", "7.1", "7.2", "7.3", "7.4",
|
||||||
"8.0", "8.1", "8.2",
|
"8.0", "8.1", "8.2",
|
||||||
"8.3" // dev
|
"8.3", "8.4" // dev
|
||||||
],
|
],
|
||||||
4: // Valet v4 dropped support for v7.0
|
4: // Valet v4 dropped support for v7.0
|
||||||
[
|
[
|
||||||
"7.1", "7.2", "7.3", "7.4",
|
"7.1", "7.2", "7.3", "7.4",
|
||||||
"8.0", "8.1", "8.2",
|
"8.0", "8.1", "8.2",
|
||||||
"8.3" // dev
|
"8.3", "8.4" // dev
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@@ -45,6 +45,7 @@ class Brew {
|
|||||||
|
|
||||||
/// Each formula for each PHP version that can be installed.
|
/// Each formula for each PHP version that can be installed.
|
||||||
public static let phpVersionFormulae = [
|
public static let phpVersionFormulae = [
|
||||||
|
"8.3": "shivammathur/php/php@8.3",
|
||||||
"8.2": "php@8.2",
|
"8.2": "php@8.2",
|
||||||
"8.1": "php@8.1",
|
"8.1": "php@8.1",
|
||||||
"8.0": "php@8.0",
|
"8.0": "php@8.0",
|
||||||
|
@@ -21,11 +21,28 @@ struct BrewFormula {
|
|||||||
/// The upgrade that is currently available, if it exists.
|
/// The upgrade that is currently available, if it exists.
|
||||||
let upgradeVersion: String?
|
let upgradeVersion: String?
|
||||||
|
|
||||||
|
/// Whether this formula is a stable version of PHP.
|
||||||
|
let prerelease: Bool
|
||||||
|
|
||||||
/// Whether the formula is currently installed.
|
/// Whether the formula is currently installed.
|
||||||
var isInstalled: Bool {
|
var isInstalled: Bool {
|
||||||
return installedVersion != nil
|
return installedVersion != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
init(
|
||||||
|
name: String,
|
||||||
|
displayName: String,
|
||||||
|
installedVersion: String?,
|
||||||
|
upgradeVersion: String?,
|
||||||
|
prerelease: Bool = false
|
||||||
|
) {
|
||||||
|
self.name = name
|
||||||
|
self.displayName = displayName
|
||||||
|
self.installedVersion = installedVersion
|
||||||
|
self.upgradeVersion = upgradeVersion
|
||||||
|
self.prerelease = prerelease
|
||||||
|
}
|
||||||
|
|
||||||
/// Whether the formula can be upgraded.
|
/// Whether the formula can be upgraded.
|
||||||
var hasUpgrade: Bool {
|
var hasUpgrade: Bool {
|
||||||
return upgradeVersion != nil
|
return upgradeVersion != nil
|
||||||
|
@@ -56,7 +56,8 @@ class BrewFormulaeHandler: HandlesBrewFormulae {
|
|||||||
name: formula,
|
name: formula,
|
||||||
displayName: "PHP \(version)",
|
displayName: "PHP \(version)",
|
||||||
installedVersion: fullVersion,
|
installedVersion: fullVersion,
|
||||||
upgradeVersion: upgradeVersion
|
upgradeVersion: upgradeVersion,
|
||||||
|
prerelease: Constants.ExperimentalPhpVersions.contains(version)
|
||||||
)
|
)
|
||||||
}.sorted { $0.displayName > $1.displayName }
|
}.sorted { $0.displayName > $1.displayName }
|
||||||
}
|
}
|
||||||
|
@@ -11,6 +11,13 @@ import Foundation
|
|||||||
class FakeBrewFormulaeHandler: HandlesBrewFormulae {
|
class FakeBrewFormulaeHandler: HandlesBrewFormulae {
|
||||||
public func loadPhpVersions(loadOutdated: Bool) async -> [BrewFormula] {
|
public func loadPhpVersions(loadOutdated: Bool) async -> [BrewFormula] {
|
||||||
return [
|
return [
|
||||||
|
BrewFormula(
|
||||||
|
name: "php",
|
||||||
|
displayName: "PHP 8.3",
|
||||||
|
installedVersion: nil,
|
||||||
|
upgradeVersion: "8.3.0",
|
||||||
|
prerelease: true
|
||||||
|
),
|
||||||
BrewFormula(
|
BrewFormula(
|
||||||
name: "php",
|
name: "php",
|
||||||
displayName: "PHP 8.2",
|
displayName: "PHP 8.2",
|
||||||
|
@@ -135,7 +135,21 @@ struct PhpVersionManagerView: View {
|
|||||||
.foregroundColor(formula.iconColor)
|
.foregroundColor(formula.iconColor)
|
||||||
.padding(.horizontal, 5)
|
.padding(.horizontal, 5)
|
||||||
VStack(alignment: .leading, spacing: 2) {
|
VStack(alignment: .leading, spacing: 2) {
|
||||||
Text(formula.displayName).bold()
|
HStack {
|
||||||
|
Text(formula.displayName).bold()
|
||||||
|
|
||||||
|
if formula.prerelease {
|
||||||
|
Text("phpman.version.prerelease".localized.uppercased())
|
||||||
|
.font(.system(size: 9))
|
||||||
|
.padding(.horizontal, 5)
|
||||||
|
.padding(.vertical, 1)
|
||||||
|
.background(Color.appPrimary)
|
||||||
|
.foregroundColor(Color.white)
|
||||||
|
.clipShape(Capsule())
|
||||||
|
.fixedSize(horizontal: true, vertical: true)
|
||||||
|
.frame(maxHeight: 7)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if formula.isInstalled && formula.hasUpgrade {
|
if formula.isInstalled && formula.hasUpgrade {
|
||||||
Text("phpman.version.has_update".localized(
|
Text("phpman.version.has_update".localized(
|
||||||
|
@@ -108,6 +108,7 @@
|
|||||||
"phpman.buttons.install" = "Install";
|
"phpman.buttons.install" = "Install";
|
||||||
"phpman.buttons.update" = "Update";
|
"phpman.buttons.update" = "Update";
|
||||||
"phpman.buttons.repair" = "Repair";
|
"phpman.buttons.repair" = "Repair";
|
||||||
|
"phpman.version.prerelease" = "Pre-release";
|
||||||
|
|
||||||
"phpman.title" = "PHP Version Manager";
|
"phpman.title" = "PHP Version Manager";
|
||||||
"phpman.description" = "**PHP Version Manager** lets you install, upgrade and delete different PHP versions via Homebrew without needing to run the commands in the terminal yourself.";
|
"phpman.description" = "**PHP Version Manager** lets you install, upgrade and delete different PHP versions via Homebrew without needing to run the commands in the terminal yourself.";
|
||||||
|
Reference in New Issue
Block a user