Skip to content

Commit

Permalink
🐛 Gracefully detect #178 during startup
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoverbruggen committed Jun 29, 2022
1 parent 1066bdc commit 6fbbd49
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
8 changes: 4 additions & 4 deletions PHP Monitor.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1593,7 +1593,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 911;
CURRENT_PROJECT_VERSION = 912;
DEBUG = YES;
DEVELOPMENT_TEAM = 8M54J5J787;
ENABLE_HARDENED_RUNTIME = YES;
Expand All @@ -1603,7 +1603,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 11.0;
MARKETING_VERSION = 5.4;
MARKETING_VERSION = 5.4.1;
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -1620,7 +1620,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 911;
CURRENT_PROJECT_VERSION = 912;
DEBUG = NO;
DEVELOPMENT_TEAM = 8M54J5J787;
ENABLE_HARDENED_RUNTIME = YES;
Expand All @@ -1630,7 +1630,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 11.0;
MARKETING_VERSION = 5.4;
MARKETING_VERSION = 5.4.1;
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
13 changes: 13 additions & 0 deletions phpmon/Domain/App/Startup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,19 @@ class Startup {
descriptionText: "startup.errors.which_alias_issue.desc".localized
),
// =================================================================================
// Determine that Valet works correctly (no issues in platform detected)
// =================================================================================
EnvironmentCheck(
command: {
let output = valet("--version", sudo: false)
return output.contains("Composer detected issues in your platform")
},
name: "`no global composer issues",
titleText: "startup.errors.global_composer_platform_issues.title".localized,
subtitleText: "startup.errors.global_composer_platform_issues.subtitle".localized,
descriptionText: "startup.errors.global_composer_platform_issues.desc".localized
),
// =================================================================================
// Determine the Valet version and ensure it isn't unknown.
// =================================================================================
EnvironmentCheck(
Expand Down
5 changes: 5 additions & 0 deletions phpmon/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,11 @@ You can do this by running `composer global update` in your terminal. After that
"startup.errors.sudoers_valet.subtitle" = "You must run `sudo valet trust` to ensure Valet can start and stop services without having to use sudo every time. The app will not work correctly until you resolve this issue. If you did this before, please run `sudo valet trust` again.";
"startup.errors.sudoers_valet.desc" = "If you keep seeing this error, it is possible that there is a permission issue where PHP Monitor cannot validate the file, which can usually be resolved by running: `sudo chmod +r /private/etc/sudoers.d/valet`";

/// Platform issue detected
"startup.errors.global_composer_platform_issues.title" = "Composer detected issues in your platform";
"startup.errors.global_composer_platform_issues.subtitle" = "You will have to run `composer global update`. The easiest way to prevent this issue from occurring in the future is to:\n\n1. Run `composer global update`.\n2. Restart PHP Monitor. It should work again!\n3. Switch to the oldest PHP version you have installed.\n4. Run `composer global update` again (via the Terminal or via PHP Monitor).";
"startup.errors.global_composer_platform_issues.desc" = "Alternatively, you can go to Preferences and check the 'Automatically update global dependencies' option. This will update your global Composer dependencies whenever you change PHP versions, so this may not be ideal if you may not have constant access to the internet.";

/// Cannot retrieve services
"startup.errors.services_json_error.title" = "Cannot determine services status";
"startup.errors.services_json_error.subtitle" = "PHP Monitor usually queries `brew` using the following command to test if the services can be retrieved: `sudo brew services info nginx --json`.\n\nPHP Monitor could not interpret this response.";
Expand Down

0 comments on commit 6fbbd49

Please sign in to comment.