mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-07 20:10:08 +02:00
✨ Added environment check groups
This commit is contained in:
@ -2809,7 +2809,7 @@
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 1020;
|
||||
CURRENT_PROJECT_VERSION = 1100;
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
DEBUG = YES;
|
||||
DEVELOPMENT_TEAM = 8M54J5J787;
|
||||
@ -2821,7 +2821,7 @@
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 11.0;
|
||||
MARKETING_VERSION = 5.7;
|
||||
MARKETING_VERSION = 6.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
@ -2838,7 +2838,7 @@
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 1020;
|
||||
CURRENT_PROJECT_VERSION = 1100;
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
DEBUG = NO;
|
||||
DEVELOPMENT_TEAM = 8M54J5J787;
|
||||
@ -2850,7 +2850,7 @@
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 11.0;
|
||||
MARKETING_VERSION = 5.7;
|
||||
MARKETING_VERSION = 6.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
@ -3066,7 +3066,7 @@
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 1020;
|
||||
CURRENT_PROJECT_VERSION = 1100;
|
||||
DEBUG = NO;
|
||||
DEVELOPMENT_TEAM = 8M54J5J787;
|
||||
ENABLE_HARDENED_RUNTIME = YES;
|
||||
@ -3077,7 +3077,7 @@
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 11.0;
|
||||
MARKETING_VERSION = 5.7;
|
||||
MARKETING_VERSION = 6.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon.dev;
|
||||
PRODUCT_NAME = "$(TARGET_NAME) DEV";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
@ -3176,7 +3176,7 @@
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 1020;
|
||||
CURRENT_PROJECT_VERSION = 1100;
|
||||
DEBUG = YES;
|
||||
DEVELOPMENT_TEAM = 8M54J5J787;
|
||||
ENABLE_HARDENED_RUNTIME = YES;
|
||||
@ -3187,7 +3187,7 @@
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 11.0;
|
||||
MARKETING_VERSION = 5.7;
|
||||
MARKETING_VERSION = 6.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon.dev;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
|
@ -55,4 +55,10 @@ class Log {
|
||||
}
|
||||
}
|
||||
|
||||
static func line(as verbosity: Verbosity = .info) {
|
||||
if verbosity.isApplicable() {
|
||||
print("----------------------------------")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ class FSNotifier {
|
||||
self.url = url
|
||||
|
||||
self.linked = FileSystem.fileExists(Paths.php)
|
||||
print("Initial PHP linked state: \(linked)")
|
||||
Log.info("[FSN] Initial PHP linked state: \(linked ? "linked" : "unlinked")")
|
||||
|
||||
fileDescriptor = open(url.path, O_EVTONLY)
|
||||
|
||||
|
@ -43,3 +43,9 @@ struct EnvironmentCheck {
|
||||
return await !self.command()
|
||||
}
|
||||
}
|
||||
|
||||
struct EnvironmentCheckGroup {
|
||||
let name: String
|
||||
let condition: () -> Bool
|
||||
let checks: [EnvironmentCheck]
|
||||
}
|
||||
|
@ -21,7 +21,12 @@ class Startup {
|
||||
// Do the important system setup checks
|
||||
Log.info("[ARCH] The user is running PHP Monitor with the architecture: \(App.architecture)")
|
||||
|
||||
for check in self.checks {
|
||||
for group in self.groups {
|
||||
if group.condition() {
|
||||
Log.line()
|
||||
Log.info("Running \(group.name) checks!")
|
||||
Log.line()
|
||||
for check in group.checks {
|
||||
if await check.succeeds() {
|
||||
Log.info("[OK] \(check.name)")
|
||||
continue
|
||||
@ -32,6 +37,12 @@ class Startup {
|
||||
await showAlert(for: check)
|
||||
return false
|
||||
}
|
||||
} else {
|
||||
Log.line()
|
||||
Log.info("Skipping \(group.name) checks!")
|
||||
Log.line()
|
||||
}
|
||||
}
|
||||
|
||||
// If we get here, nothing has gone wrong. That's what we want!
|
||||
initializeSwitcher()
|
||||
@ -81,7 +92,8 @@ class Startup {
|
||||
|
||||
// MARK: - Check (List)
|
||||
|
||||
public var checks: [EnvironmentCheck] = [
|
||||
public var groups: [EnvironmentCheckGroup] = [
|
||||
EnvironmentCheckGroup(name: "core", condition: { return true }, checks: [
|
||||
// =================================================================================
|
||||
// The Homebrew binary must exist.
|
||||
// =================================================================================
|
||||
@ -99,7 +111,6 @@ class Startup {
|
||||
buttonText: "alert.homebrew_missing.quit".localized,
|
||||
requiresAppRestart: true
|
||||
),
|
||||
/*
|
||||
// =================================================================================
|
||||
// The PHP binary must exist.
|
||||
// =================================================================================
|
||||
@ -110,7 +121,6 @@ class Startup {
|
||||
subtitleText: "startup.errors.php_binary.subtitle".localized,
|
||||
descriptionText: "startup.errors.php_binary.desc".localized(Paths.php)
|
||||
),
|
||||
*/
|
||||
// =================================================================================
|
||||
// Make sure we can detect one or more PHP installations.
|
||||
// =================================================================================
|
||||
@ -125,6 +135,8 @@ class Startup {
|
||||
),
|
||||
descriptionText: "startup.errors.php_opt.desc".localized
|
||||
),
|
||||
]),
|
||||
EnvironmentCheckGroup(name: "valet", condition: { return Valet.installed() }, checks: [
|
||||
// =================================================================================
|
||||
// The Valet binary must exist.
|
||||
// =================================================================================
|
||||
@ -159,19 +171,6 @@ class Startup {
|
||||
descriptionText: "startup.errors.sudoers_valet.desc".localized
|
||||
),
|
||||
// =================================================================================
|
||||
// Verify if the Homebrew services are running (as root).
|
||||
// =================================================================================
|
||||
EnvironmentCheck(
|
||||
command: {
|
||||
await HomebrewDiagnostics.loadInstalledTaps()
|
||||
return await HomebrewDiagnostics.cannotLoadService("dnsmasq")
|
||||
},
|
||||
name: "`sudo \(Paths.brew) services info` JSON loaded",
|
||||
titleText: "startup.errors.services_json_error.title".localized,
|
||||
subtitleText: "startup.errors.services_json_error.subtitle".localized,
|
||||
descriptionText: "startup.errors.services_json_error.desc".localized
|
||||
),
|
||||
// =================================================================================
|
||||
// Determine that Valet is installed
|
||||
// =================================================================================
|
||||
EnvironmentCheck(
|
||||
@ -201,6 +200,19 @@ class Startup {
|
||||
descriptionText: "startup.errors.valet_json_invalid.desc".localized
|
||||
),
|
||||
// =================================================================================
|
||||
// Verify if the Homebrew services are running (as root).
|
||||
// =================================================================================
|
||||
EnvironmentCheck(
|
||||
command: {
|
||||
await HomebrewDiagnostics.loadInstalledTaps()
|
||||
return await HomebrewDiagnostics.cannotLoadService("dnsmasq")
|
||||
},
|
||||
name: "`sudo \(Paths.brew) services info` JSON loaded",
|
||||
titleText: "startup.errors.services_json_error.title".localized,
|
||||
subtitleText: "startup.errors.services_json_error.subtitle".localized,
|
||||
descriptionText: "startup.errors.services_json_error.desc".localized
|
||||
),
|
||||
// =================================================================================
|
||||
// Check for `which` alias issue
|
||||
// =================================================================================
|
||||
EnvironmentCheck(
|
||||
@ -218,7 +230,6 @@ class Startup {
|
||||
// =================================================================================
|
||||
// Determine that Valet works correctly (no issues in platform detected)
|
||||
// =================================================================================
|
||||
/*
|
||||
EnvironmentCheck(
|
||||
command: {
|
||||
return await Shell.pipe("valet --version").out
|
||||
@ -260,13 +271,13 @@ class Startup {
|
||||
EnvironmentCheck(
|
||||
command: {
|
||||
// We currently support Valet 2, 3 or 4. Any other version should get an alert.
|
||||
return ![2, 3, 4].contains(Valet.shared.version.major)
|
||||
return ![2, 3, 4].contains(Valet.shared.version?.major)
|
||||
},
|
||||
name: "valet version is supported",
|
||||
titleText: "startup.errors.valet_version_not_supported.title".localized,
|
||||
subtitleText: "startup.errors.valet_version_not_supported.subtitle".localized,
|
||||
descriptionText: "startup.errors.valet_version_not_supported.desc".localized
|
||||
)
|
||||
*/
|
||||
])
|
||||
]
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ class Valet {
|
||||
static let shared = Valet()
|
||||
|
||||
/// The version of Valet that was detected.
|
||||
var version: VersionNumber? = nil
|
||||
var version: VersionNumber?
|
||||
|
||||
/// The Valet configuration file.
|
||||
var config: Valet.Configuration!
|
||||
@ -57,6 +57,10 @@ class Valet {
|
||||
}
|
||||
}
|
||||
|
||||
public static func installed() -> Bool {
|
||||
return FileSystem.fileExists(Paths.binPath.appending("/valet"))
|
||||
}
|
||||
|
||||
/**
|
||||
Check if a particular feature is enabled.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user