mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-06 19:40:08 +02:00
🚧 WIP: Handle temporarily unavailable formulae
This commit is contained in:
@ -21,8 +21,6 @@ struct BrewPhpFormula: Equatable {
|
|||||||
/// The upgrade that is currently available, if it exists.
|
/// The upgrade that is currently available, if it exists.
|
||||||
let upgradeVersion: String?
|
let upgradeVersion: String?
|
||||||
|
|
||||||
// TODO: A rebuild attribute could be checked, to check if a Tap update exists for a pre-release version
|
|
||||||
|
|
||||||
/// Whether this formula is a stable version of PHP.
|
/// Whether this formula is a stable version of PHP.
|
||||||
let prerelease: Bool
|
let prerelease: Bool
|
||||||
|
|
||||||
@ -49,6 +47,16 @@ struct BrewPhpFormula: Equatable {
|
|||||||
var hasUpgrade: Bool {
|
var hasUpgrade: Bool {
|
||||||
return upgradeVersion != nil
|
return upgradeVersion != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var hasFormulaFile: Bool {
|
||||||
|
guard let version = shortVersion else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return FileSystem.fileExists(
|
||||||
|
"\(Paths.tapPath)/shivammathur/homebrew-php/Formula/php@\(version).rb"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
/// Whether this formula alias is different.
|
/// Whether this formula alias is different.
|
||||||
var hasUpgradedFormulaAlias: Bool {
|
var hasUpgradedFormulaAlias: Bool {
|
||||||
|
@ -238,7 +238,7 @@ struct PhpVersionManagerView: View {
|
|||||||
} else {
|
} else {
|
||||||
Button("phpman.buttons.install".localizedForSwiftUI) {
|
Button("phpman.buttons.install".localizedForSwiftUI) {
|
||||||
Task { await self.install(formula) }
|
Task { await self.install(formula) }
|
||||||
}.disabled(formula.hasUpgradedFormulaAlias)
|
}.disabled(formula.hasUpgradedFormulaAlias || !formula.hasFormulaFile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -268,6 +268,17 @@ struct PhpVersionManagerView: View {
|
|||||||
Text("phpman.version.installed".localized(formula.installedVersion!))
|
Text("phpman.version.installed".localized(formula.installedVersion!))
|
||||||
.font(.system(size: 11))
|
.font(.system(size: 11))
|
||||||
.foregroundColor(.gray)
|
.foregroundColor(.gray)
|
||||||
|
} else if !formula.hasFormulaFile {
|
||||||
|
HStack(spacing: 5) {
|
||||||
|
Text("phpman.version.unavailable".localizedForSwiftUI)
|
||||||
|
.font(.system(size: 11))
|
||||||
|
.foregroundColor(.gray)
|
||||||
|
HelpButton(action: {
|
||||||
|
// Show an alert that displays information about the missing formula
|
||||||
|
// and what can be done to fix this particular issue.
|
||||||
|
// Running `brew tap shivammathur/php` generally works, I think.
|
||||||
|
})
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Text("phpman.version.available_for_installation".localizedForSwiftUI)
|
Text("phpman.version.available_for_installation".localizedForSwiftUI)
|
||||||
.font(.system(size: 11))
|
.font(.system(size: 11))
|
||||||
|
@ -138,6 +138,7 @@ and restart PHP Monitor for extensions to become visible. If the problem persist
|
|||||||
"phpman.version.has_update" = "Version %@ installed, %@ available.";
|
"phpman.version.has_update" = "Version %@ installed, %@ available.";
|
||||||
"phpman.version.installed" = "Version %@ is currently installed.";
|
"phpman.version.installed" = "Version %@ is currently installed.";
|
||||||
"phpman.version.available_for_installation" = "This version can be installed.";
|
"phpman.version.available_for_installation" = "This version can be installed.";
|
||||||
|
"phpman.version.unavailable" = "This version is temporarily unavailable.";
|
||||||
"phpman.version.automatic_upgrade" = "This version will be automatically installed by upgrading an older version.";
|
"phpman.version.automatic_upgrade" = "This version will be automatically installed by upgrading an older version.";
|
||||||
"phpman.buttons.uninstall" = "Uninstall";
|
"phpman.buttons.uninstall" = "Uninstall";
|
||||||
"phpman.buttons.install" = "Install";
|
"phpman.buttons.install" = "Install";
|
||||||
|
Reference in New Issue
Block a user