mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-11-05 12:30:07 +01:00
✨ Automatically install taps when missing at boot
This commit is contained in:
@@ -138,6 +138,35 @@ class BrewDiagnostics {
|
||||
}
|
||||
}
|
||||
|
||||
public static func verifyAndInstallThirdPartyTaps() async {
|
||||
let requiredTaps = [
|
||||
"shivammathur/php",
|
||||
"shivammathur/extensions"
|
||||
]
|
||||
|
||||
var requiredInstall = false
|
||||
|
||||
// Install required taps if missing (if possible)
|
||||
for tap in requiredTaps where !installedTaps.contains(tap) {
|
||||
await Shell.quiet("brew tap \(tap)")
|
||||
requiredInstall = true
|
||||
}
|
||||
|
||||
// Reload the list of taps after installing
|
||||
if requiredInstall {
|
||||
await loadInstalledTaps()
|
||||
}
|
||||
|
||||
// Check the status of the installed taps
|
||||
for tap in requiredTaps {
|
||||
if installedTaps.contains(tap) {
|
||||
Log.info("As expected, `\(tap)` is installed!")
|
||||
} else {
|
||||
Log.warn("`\(tap)` does not appear to be installed, will be noted in warnings.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Check if the alias conflict as documented in `checkForCaskConflict` actually occurred.
|
||||
*/
|
||||
|
||||
@@ -56,6 +56,11 @@ extension MainMenu {
|
||||
// Actually detect the PHP versions
|
||||
await PhpEnvironments.detectPhpVersions()
|
||||
|
||||
// Verify and install third party taps (if missing)
|
||||
// This may fail if the user has no internet, at which point
|
||||
// the missing tap(s) will be actionable as a warning
|
||||
await BrewDiagnostics.verifyAndInstallThirdPartyTaps()
|
||||
|
||||
// Check for an alias conflict
|
||||
await BrewDiagnostics.checkForCaskConflict()
|
||||
|
||||
|
||||
@@ -71,6 +71,7 @@ struct PhpVersionManagerView: View {
|
||||
)
|
||||
}
|
||||
|
||||
// Finally, load PHP information
|
||||
await PhpEnvironments.detectPhpVersions()
|
||||
await self.handler.refreshPhpVersions(loadOutdated: false)
|
||||
await self.handler.refreshPhpVersions(loadOutdated: true)
|
||||
|
||||
Reference in New Issue
Block a user