mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-11-06 04:40:07 +01:00
🚧 WIP: Boot check changes
This commit is contained in:
@@ -9,31 +9,40 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
class Environment {
|
class Environment {
|
||||||
public static func performBootChecks()
|
|
||||||
|
public static func presentAlertOnMainThreadIf(_ condition: Bool, messageText: String, informativeText: String)
|
||||||
{
|
{
|
||||||
if (!Shell.execute(command: "which php").contains("/usr/local/bin/php")) {
|
if (condition) {
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
Alert.present(
|
Alert.present(
|
||||||
messageText: "PHP is not correctly installed",
|
messageText: messageText,
|
||||||
informativeText: "You must install PHP via brew. Try running `which php` in Terminal, it should return `/usr/local/bin/php`. The app will not work correctly until you resolve this issue."
|
informativeText: informativeText
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!Shell.execute(command: "ls /usr/local/opt | grep php@7.3").contains("php@7.3")) {
|
|
||||||
DispatchQueue.main.async {
|
|
||||||
Alert.present(
|
|
||||||
messageText: "PHP 7.3 is not correctly installed",
|
|
||||||
informativeText: "PHP 7.3 alias was not found in `/usr/local/opt`. The app will not work correctly until you resolve this issue."
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!Shell.execute(command: "which valet").contains("/usr/local/bin/valet")) {
|
|
||||||
DispatchQueue.main.async {
|
|
||||||
Alert.present(
|
|
||||||
messageText: "Laravel Valet is not correctly installed",
|
|
||||||
informativeText: "You must install Valet via brew. Try running `which valet` in Terminal, it should return `/usr/local/bin/valet`. The app will not work correctly until you resolve this issue."
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
// TODO: Quit the app in any of these scenarios?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static func performBootChecks()
|
||||||
|
{
|
||||||
|
self.presentAlertOnMainThreadIf(
|
||||||
|
!Shell.execute(command: "which php").contains("/usr/local/bin/php"),
|
||||||
|
messageText: "PHP is not correctly installed",
|
||||||
|
informativeText: "You must install PHP via brew. Try running `which php` in Terminal, it should return `/usr/local/bin/php`. The app will not work correctly until you resolve this issue."
|
||||||
|
)
|
||||||
|
|
||||||
|
self.presentAlertOnMainThreadIf(
|
||||||
|
!Shell.execute(command: "ls /usr/local/opt | grep php@7.3").contains("php@7.3"),
|
||||||
|
messageText: "PHP 7.3 is not correctly installed",
|
||||||
|
informativeText: "PHP 7.3 alias was not found in `/usr/local/opt`. The app will not work correctly until you resolve this issue."
|
||||||
|
)
|
||||||
|
|
||||||
|
self.presentAlertOnMainThreadIf(
|
||||||
|
!Shell.execute(command: "which valet").contains("/usr/local/bin/valet"),
|
||||||
|
messageText: "Laravel Valet is not correctly installed",
|
||||||
|
informativeText: "You must install Valet via brew. Try running `which valet` in Terminal, it should return `/usr/local/bin/valet`. The app will not work correctly until you resolve this issue."
|
||||||
|
)
|
||||||
|
|
||||||
|
// TODO: Add check for /private/etc/sudoers.d/brew || /private/etc/sudoers.d/valet
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user