mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-08 04:20:07 +02:00
✨ Added menu item to run composer global update
This commit is contained in:
@ -327,6 +327,30 @@ class MainMenu: NSObject, NSWindowDelegate, NSMenuDelegate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@objc func updateComposerDependencies() {
|
||||||
|
DispatchQueue.global(qos: .userInitiated).async {
|
||||||
|
let output = Shell.user.execute(
|
||||||
|
"composer global update", requiresPath: true, waitUntilExit: true
|
||||||
|
)
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
if output.task.terminationStatus > 0 {
|
||||||
|
// Error code means > 0
|
||||||
|
Alert.notify(
|
||||||
|
message: "alert.composer_failure.title".localized,
|
||||||
|
info: "alert.composer_failure.info".localized,
|
||||||
|
style: .critical
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
// Error code -1 is OK
|
||||||
|
LocalNotification.send(
|
||||||
|
title: "alert.composer_success.title".localized,
|
||||||
|
subtitle: "alert.composer_success.info".localized
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@objc func openActiveConfigFolder() {
|
@objc func openActiveConfigFolder() {
|
||||||
if (App.phpInstall!.version.error) {
|
if (App.phpInstall!.version.error) {
|
||||||
// php version was not identified
|
// php version was not identified
|
||||||
|
@ -87,10 +87,15 @@ class StatusMenu : NSMenu {
|
|||||||
|
|
||||||
// Configuration
|
// Configuration
|
||||||
self.addItem(HeaderView.asMenuItem(text: "mi_configuration".localized))
|
self.addItem(HeaderView.asMenuItem(text: "mi_configuration".localized))
|
||||||
self.addItem(NSMenuItem(title: "mi_global_composer".localized, action: #selector(MainMenu.openGlobalComposerFolder), keyEquivalent: "g"))
|
|
||||||
self.addItem(NSMenuItem(title: "mi_php_config".localized, action: #selector(MainMenu.openActiveConfigFolder), keyEquivalent: "c"))
|
self.addItem(NSMenuItem(title: "mi_php_config".localized, action: #selector(MainMenu.openActiveConfigFolder), keyEquivalent: "c"))
|
||||||
self.addItem(NSMenuItem(title: "mi_phpinfo".localized, action: #selector(MainMenu.openPhpInfo), keyEquivalent: "i"))
|
self.addItem(NSMenuItem(title: "mi_phpinfo".localized, action: #selector(MainMenu.openPhpInfo), keyEquivalent: "i"))
|
||||||
|
|
||||||
|
// Composer
|
||||||
|
self.addItem(NSMenuItem.separator())
|
||||||
|
self.addItem(HeaderView.asMenuItem(text: "mi_composer".localized))
|
||||||
|
self.addItem(NSMenuItem(title: "mi_global_composer".localized, action: #selector(MainMenu.openGlobalComposerFolder), keyEquivalent: "g"))
|
||||||
|
self.addItem(NSMenuItem(title: "mi_update_global_composer".localized, action: #selector(MainMenu.updateComposerDependencies), keyEquivalent: ""))
|
||||||
|
|
||||||
if (App.shared.busy) {
|
if (App.shared.busy) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -35,10 +35,12 @@
|
|||||||
"mi_post_max_size" = "Max POST";
|
"mi_post_max_size" = "Max POST";
|
||||||
"mi_upload_max_filesize" = "Max Upload";
|
"mi_upload_max_filesize" = "Max Upload";
|
||||||
|
|
||||||
|
"mi_composer" = "Composer";
|
||||||
"mi_valet_config" = "Locate Valet folder (.config/valet)";
|
"mi_valet_config" = "Locate Valet folder (.config/valet)";
|
||||||
"mi_php_config" = "Locate PHP configuration file (php.ini)";
|
"mi_php_config" = "Locate PHP configuration file (php.ini)";
|
||||||
"mi_global_composer" = "Locate global composer.json file (.composer)";
|
"mi_global_composer" = "Locate global composer.json file (.composer)";
|
||||||
"mi_phpinfo" = "Show current configuration (phpinfo)";
|
"mi_phpinfo" = "Show current configuration (phpinfo)";
|
||||||
|
"mi_update_global_composer" = "Update global Composer dependencies";
|
||||||
"mi_detected_extensions" = "Detected Extensions";
|
"mi_detected_extensions" = "Detected Extensions";
|
||||||
"mi_no_extensions_detected" = "No additional extensions detected.";
|
"mi_no_extensions_detected" = "No additional extensions detected.";
|
||||||
|
|
||||||
@ -128,6 +130,15 @@ directories, since PHP Monitor controls the services.";
|
|||||||
|
|
||||||
// ALERTS
|
// ALERTS
|
||||||
|
|
||||||
|
// Composer Update
|
||||||
|
"alert.composer_success.title" = "Global dependencies updated";
|
||||||
|
"alert.composer_success.info" = "Your global Composer dependencies have been updated.";
|
||||||
|
|
||||||
|
"alert.composer_failure.title" = "Updating global dependencies failed";
|
||||||
|
"alert.composer_failure.info" = "Something went wrong updating your global Composer dependencies.
|
||||||
|
|
||||||
|
To find out what went wrong, try running `composer global update` in a terminal window.";
|
||||||
|
|
||||||
// Force Reload Started
|
// Force Reload Started
|
||||||
"alert.force_reload.title" = "PHP Monitor will force reload the latest version of PHP";
|
"alert.force_reload.title" = "PHP Monitor will force reload the latest version of PHP";
|
||||||
"alert.force_reload.info" = "This can take a while. You'll get another alert when the force reload has completed.";
|
"alert.force_reload.info" = "This can take a while. You'll get another alert when the force reload has completed.";
|
||||||
|
Reference in New Issue
Block a user