mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-09 04:42:59 +02:00
Compare commits
43 Commits
Author | SHA1 | Date | |
---|---|---|---|
4568f03a65 | |||
2eda8d6382 | |||
dd330fecce | |||
aaa7c636db | |||
ff75fb7be3 | |||
4d7b01831b | |||
0fceb852bb | |||
9fb5f33770 | |||
2f658ee569 | |||
ad179a325a | |||
4baeaea85f | |||
9e25254ec8 | |||
00cc6711a1 | |||
209244e162 | |||
e48d8ed98b | |||
834f76e5a1 | |||
7e48893247 | |||
e29ca9e1ad | |||
40e05d9445 | |||
3ebf51b319 | |||
4b8ad911f1 | |||
efd902b4f3 | |||
918e272da7 | |||
272a9182d3 | |||
63f85aff91 | |||
581c2d1974 | |||
4deef64537 | |||
bedabaa3bb | |||
9da3772212 | |||
e62b03d070 | |||
9a11d2efed | |||
b134e62328 | |||
5c69133c42 | |||
f4448e0640 | |||
7fd30d7c54 | |||
2c57dea97f | |||
a77fa5557a | |||
45704fc736 | |||
f28354e634 | |||
8055a32bde | |||
5b3054326e | |||
e7f3c7e59c | |||
a407515534 |
5
.github/ISSUE_TEMPLATE/bug_report.md
vendored
5
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -29,5 +29,10 @@ If applicable, add screenshots to help explain your problem.
|
|||||||
- OS: [e.g. macOS Monterey]
|
- OS: [e.g. macOS Monterey]
|
||||||
- PHP Monitor version [e.g. v5.0.1]
|
- PHP Monitor version [e.g. v5.0.1]
|
||||||
|
|
||||||
|
**Additional log**
|
||||||
|
You can help me figure out even more information by sending me your verbose log for your latest session of PHP Monitor. Logging is disabled by default.
|
||||||
|
|
||||||
|
You can start extra verbose logging by running: `touch ~/.config/phpmon/verbose` and restarting PHP Monitor. You can find the latest log in: `~/.config/phpmon/last_session.log`. Please attach it here!
|
||||||
|
|
||||||
**Additional context**
|
**Additional context**
|
||||||
Add any other context about the problem here.
|
Add any other context about the problem here.
|
||||||
|
@@ -2831,7 +2831,7 @@
|
|||||||
CODE_SIGN_IDENTITY = "Apple Development";
|
CODE_SIGN_IDENTITY = "Apple Development";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 1030;
|
CURRENT_PROJECT_VERSION = 1035;
|
||||||
DEAD_CODE_STRIPPING = YES;
|
DEAD_CODE_STRIPPING = YES;
|
||||||
DEBUG = YES;
|
DEBUG = YES;
|
||||||
DEVELOPMENT_TEAM = 8M54J5J787;
|
DEVELOPMENT_TEAM = 8M54J5J787;
|
||||||
@@ -2843,7 +2843,7 @@
|
|||||||
"@executable_path/../Frameworks",
|
"@executable_path/../Frameworks",
|
||||||
);
|
);
|
||||||
MACOSX_DEPLOYMENT_TARGET = 11.0;
|
MACOSX_DEPLOYMENT_TARGET = 11.0;
|
||||||
MARKETING_VERSION = 5.7;
|
MARKETING_VERSION = 5.7.2;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon;
|
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
@@ -2860,7 +2860,7 @@
|
|||||||
CODE_SIGN_IDENTITY = "Apple Development";
|
CODE_SIGN_IDENTITY = "Apple Development";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 1030;
|
CURRENT_PROJECT_VERSION = 1035;
|
||||||
DEAD_CODE_STRIPPING = YES;
|
DEAD_CODE_STRIPPING = YES;
|
||||||
DEBUG = NO;
|
DEBUG = NO;
|
||||||
DEVELOPMENT_TEAM = 8M54J5J787;
|
DEVELOPMENT_TEAM = 8M54J5J787;
|
||||||
@@ -2872,7 +2872,7 @@
|
|||||||
"@executable_path/../Frameworks",
|
"@executable_path/../Frameworks",
|
||||||
);
|
);
|
||||||
MACOSX_DEPLOYMENT_TARGET = 11.0;
|
MACOSX_DEPLOYMENT_TARGET = 11.0;
|
||||||
MARKETING_VERSION = 5.7;
|
MARKETING_VERSION = 5.7.2;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon;
|
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
@@ -3088,7 +3088,7 @@
|
|||||||
CODE_SIGN_IDENTITY = "Apple Development";
|
CODE_SIGN_IDENTITY = "Apple Development";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 1030;
|
CURRENT_PROJECT_VERSION = 1035;
|
||||||
DEBUG = NO;
|
DEBUG = NO;
|
||||||
DEVELOPMENT_TEAM = 8M54J5J787;
|
DEVELOPMENT_TEAM = 8M54J5J787;
|
||||||
ENABLE_HARDENED_RUNTIME = YES;
|
ENABLE_HARDENED_RUNTIME = YES;
|
||||||
@@ -3099,7 +3099,7 @@
|
|||||||
"@executable_path/../Frameworks",
|
"@executable_path/../Frameworks",
|
||||||
);
|
);
|
||||||
MACOSX_DEPLOYMENT_TARGET = 11.0;
|
MACOSX_DEPLOYMENT_TARGET = 11.0;
|
||||||
MARKETING_VERSION = 5.7;
|
MARKETING_VERSION = 5.7.2;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon.dev;
|
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon.dev;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME) DEV";
|
PRODUCT_NAME = "$(TARGET_NAME) DEV";
|
||||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
@@ -3198,7 +3198,7 @@
|
|||||||
CODE_SIGN_IDENTITY = "Apple Development";
|
CODE_SIGN_IDENTITY = "Apple Development";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 1030;
|
CURRENT_PROJECT_VERSION = 1035;
|
||||||
DEBUG = YES;
|
DEBUG = YES;
|
||||||
DEVELOPMENT_TEAM = 8M54J5J787;
|
DEVELOPMENT_TEAM = 8M54J5J787;
|
||||||
ENABLE_HARDENED_RUNTIME = YES;
|
ENABLE_HARDENED_RUNTIME = YES;
|
||||||
@@ -3209,7 +3209,7 @@
|
|||||||
"@executable_path/../Frameworks",
|
"@executable_path/../Frameworks",
|
||||||
);
|
);
|
||||||
MACOSX_DEPLOYMENT_TARGET = 11.0;
|
MACOSX_DEPLOYMENT_TARGET = 11.0;
|
||||||
MARKETING_VERSION = 5.7;
|
MARKETING_VERSION = 5.7.2;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon.dev;
|
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon.dev;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
|
@@ -89,6 +89,10 @@
|
|||||||
argument = "--v"
|
argument = "--v"
|
||||||
isEnabled = "NO">
|
isEnabled = "NO">
|
||||||
</CommandLineArgument>
|
</CommandLineArgument>
|
||||||
|
<CommandLineArgument
|
||||||
|
argument = "--cli"
|
||||||
|
isEnabled = "YES">
|
||||||
|
</CommandLineArgument>
|
||||||
<CommandLineArgument
|
<CommandLineArgument
|
||||||
argument = "--configuration:~/.phpmon_fconf_working.json"
|
argument = "--configuration:~/.phpmon_fconf_working.json"
|
||||||
isEnabled = "NO">
|
isEnabled = "NO">
|
||||||
|
@@ -553,6 +553,10 @@ If you would like to report a crash, please include the associated **log files**
|
|||||||
|
|
||||||
To find the logs, take a look in `~/Library/Logs/DiagnosticReports` (in Finder) and see if there's any (log) files that start with "PHP Monitor".
|
To find the logs, take a look in `~/Library/Logs/DiagnosticReports` (in Finder) and see if there's any (log) files that start with "PHP Monitor".
|
||||||
|
|
||||||
|
Additionally, you can help me figure out even more information by sending me your verbose log for your latest session of PHP Monitor. Logging is disabled by default.
|
||||||
|
|
||||||
|
You can start extra verbose logging by running: `touch ~/.config/phpmon/verbose` and restarting PHP Monitor. You can find the latest log in: `~/.config/phpmon/last_session.log`. Please attach it to the relevant bug report.
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
## 📝 Having another issue?
|
## 📝 Having another issue?
|
||||||
|
@@ -25,9 +25,9 @@ class Actions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static func stopValetServices() async {
|
public static func stopValetServices() async {
|
||||||
await brew("services stop \(Homebrew.Formulae.php)", sudo: Homebrew.Formulae.php.elevated)
|
await brew("services stop \(Homebrew.Formulae.php.name)", sudo: Homebrew.Formulae.php.elevated)
|
||||||
await brew("services stop \(Homebrew.Formulae.nginx)", sudo: Homebrew.Formulae.nginx.elevated)
|
await brew("services stop \(Homebrew.Formulae.nginx.name)", sudo: Homebrew.Formulae.nginx.elevated)
|
||||||
await brew("services stop \(Homebrew.Formulae.dnsmasq)", sudo: Homebrew.Formulae.dnsmasq.elevated)
|
await brew("services stop \(Homebrew.Formulae.dnsmasq.name)", sudo: Homebrew.Formulae.dnsmasq.elevated)
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func fixHomebrewPermissions() throws {
|
public static func fixHomebrewPermissions() throws {
|
||||||
|
@@ -12,47 +12,76 @@ class Log {
|
|||||||
|
|
||||||
static var shared = Log()
|
static var shared = Log()
|
||||||
|
|
||||||
|
var logFilePath = "~/.config/phpmon/last_session.log"
|
||||||
|
var logExists = false
|
||||||
|
|
||||||
enum Verbosity: Int {
|
enum Verbosity: Int {
|
||||||
case error = 1,
|
case error = 1,
|
||||||
warning = 2,
|
warning = 2,
|
||||||
info = 3,
|
info = 3,
|
||||||
performance = 4
|
performance = 4,
|
||||||
|
cli = 5
|
||||||
|
|
||||||
public func isApplicable() -> Bool {
|
public func isApplicable() -> Bool {
|
||||||
return Log.shared.verbosity.rawValue >= self.rawValue
|
return Log.shared.verbosity.rawValue >= self.rawValue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var verbosity: Verbosity = .warning
|
public func prepareLogFile() {
|
||||||
|
if !isRunningTests && Verbosity.cli.isApplicable() {
|
||||||
|
_ = system("mkdir -p ~/.config/phpmon 2> /dev/null")
|
||||||
|
_ = system("rm ~/.config/phpmon/last_session.log 2> /dev/null")
|
||||||
|
_ = system("touch ~/.config/phpmon/last_session.log 2> /dev/null")
|
||||||
|
self.logExists = FileSystem.fileExists(self.logFilePath)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var verbosity: Verbosity = .warning {
|
||||||
|
didSet {
|
||||||
|
self.prepareLogFile()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static func err(_ item: Any) {
|
static func err(_ item: Any) {
|
||||||
if Verbosity.error.isApplicable() {
|
if Verbosity.error.isApplicable() {
|
||||||
print("[E] \(item)")
|
Log.shared.log("[E] \(item)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static func warn(_ item: Any) {
|
static func warn(_ item: Any) {
|
||||||
if Verbosity.warning.isApplicable() {
|
if Verbosity.warning.isApplicable() {
|
||||||
print("[W] \(item)")
|
Log.shared.log("[W] \(item)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static func info(_ item: Any) {
|
static func info(_ item: Any) {
|
||||||
if Verbosity.info.isApplicable() {
|
if Verbosity.info.isApplicable() {
|
||||||
print("\(item)")
|
Log.shared.log("\(item)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static func perf(_ item: Any) {
|
static func perf(_ item: Any) {
|
||||||
if Verbosity.performance.isApplicable() {
|
if Verbosity.performance.isApplicable() {
|
||||||
print("[P] \(item)")
|
Log.shared.log("[P] \(item)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static func separator(as verbosity: Verbosity = .info) {
|
static func separator(as verbosity: Verbosity = .info) {
|
||||||
if verbosity.isApplicable() {
|
if verbosity.isApplicable() {
|
||||||
print("==================================")
|
Log.shared.log("==================================")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func log(_ text: String) {
|
||||||
|
print(text)
|
||||||
|
|
||||||
|
if logExists && Verbosity.cli.isApplicable() {
|
||||||
|
let logFile = URL(string: self.logFilePath.replacingTildeWithHomeDirectory)!
|
||||||
|
if let fileHandle = try? FileHandle(forWritingTo: logFile) {
|
||||||
|
fileHandle.seekToEndOfFile()
|
||||||
|
fileHandle.write(text.appending("\n").data(using: .utf8).unsafelyUnwrapped)
|
||||||
|
fileHandle.closeFile()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -40,5 +40,4 @@ class VersionExtractor {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -68,6 +68,7 @@ class RealShell: ShellProtocol {
|
|||||||
let task = Process()
|
let task = Process()
|
||||||
task.launchPath = self.launchPath
|
task.launchPath = self.launchPath
|
||||||
task.arguments = ["--noprofile", "-norc", "--login", "-c", completeCommand]
|
task.arguments = ["--noprofile", "-norc", "--login", "-c", completeCommand]
|
||||||
|
|
||||||
return task
|
return task
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,6 +114,35 @@ class RealShell: ShellProtocol {
|
|||||||
encoding: .utf8
|
encoding: .utf8
|
||||||
)!
|
)!
|
||||||
|
|
||||||
|
if Log.shared.verbosity == .cli {
|
||||||
|
var args = task.arguments
|
||||||
|
let last: String = "\"" + (args?.popLast() ?? "") + "\""
|
||||||
|
let concat = [self.launchPath] + task.arguments! + [last]
|
||||||
|
let command = concat.joined(separator: " ")
|
||||||
|
var log = """
|
||||||
|
|
||||||
|
<~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
$ \(command)
|
||||||
|
|
||||||
|
[OUT]:
|
||||||
|
\(stdOut)
|
||||||
|
"""
|
||||||
|
|
||||||
|
if !stdErr.isEmpty {
|
||||||
|
log.append("""
|
||||||
|
[ERR]:
|
||||||
|
\(stdErr)
|
||||||
|
""")
|
||||||
|
}
|
||||||
|
|
||||||
|
log.append("""
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~>
|
||||||
|
|
||||||
|
""")
|
||||||
|
|
||||||
|
Log.info(log)
|
||||||
|
}
|
||||||
|
|
||||||
return .out(stdOut, stdErr)
|
return .out(stdOut, stdErr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -56,10 +56,9 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
|
|||||||
When the application initializes, create all singletons.
|
When the application initializes, create all singletons.
|
||||||
*/
|
*/
|
||||||
override init() {
|
override init() {
|
||||||
logger.verbosity = .info
|
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
logger.verbosity = .performance
|
logger.verbosity = .performance
|
||||||
|
|
||||||
if let profile = CommandLine.arguments.first(where: { $0.matches(pattern: "--configuration:*") }) {
|
if let profile = CommandLine.arguments.first(where: { $0.matches(pattern: "--configuration:*") }) {
|
||||||
Self.initializeTestingProfile(profile.replacingOccurrences(of: "--configuration:", with: ""))
|
Self.initializeTestingProfile(profile.replacingOccurrences(of: "--configuration:", with: ""))
|
||||||
}
|
}
|
||||||
@@ -70,6 +69,16 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
|
|||||||
Log.info("Extra verbose mode has been activated.")
|
Log.info("Extra verbose mode has been activated.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if CommandLine.arguments.contains("--cli") {
|
||||||
|
logger.verbosity = .cli
|
||||||
|
Log.info("Extra CLI mode has been activated via --cli flag.")
|
||||||
|
}
|
||||||
|
|
||||||
|
if FileSystem.fileExists("~/.config/phpmon/verbose") {
|
||||||
|
logger.verbosity = .cli
|
||||||
|
Log.info("Extra CLI mode is on (`~/.config/phpmon/verbose` exists).")
|
||||||
|
}
|
||||||
|
|
||||||
Log.separator(as: .info)
|
Log.separator(as: .info)
|
||||||
Log.info("PHP MONITOR by Nico Verbruggen")
|
Log.info("PHP MONITOR by Nico Verbruggen")
|
||||||
Log.info("Version \(App.version)")
|
Log.info("Version \(App.version)")
|
||||||
|
78
phpmon/Domain/App/ServicesManager.swift
Normal file
78
phpmon/Domain/App/ServicesManager.swift
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
//
|
||||||
|
// ServicesManager.swift
|
||||||
|
// PHP Monitor
|
||||||
|
//
|
||||||
|
// Created by Nico Verbruggen on 11/06/2022.
|
||||||
|
// Copyright © 2022 Nico Verbruggen. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
class ServicesManager: ObservableObject {
|
||||||
|
|
||||||
|
static var shared = ServicesManager()
|
||||||
|
|
||||||
|
@Published var rootServices: [String: HomebrewService] = [:]
|
||||||
|
@Published var userServices: [String: HomebrewService] = [:]
|
||||||
|
|
||||||
|
public static func loadHomebrewServices(completed: (() -> Void)? = nil) {
|
||||||
|
let rootServiceNames = [
|
||||||
|
Homebrew.Formulae.php,
|
||||||
|
Homebrew.Formulae.nginx,
|
||||||
|
Homebrew.Formulae.dnsmasq
|
||||||
|
]
|
||||||
|
|
||||||
|
DispatchQueue.global(qos: .background).async {
|
||||||
|
let data = Shell
|
||||||
|
.pipe("sudo \(Paths.brew) services info --all --json", requiresPath: true)
|
||||||
|
.data(using: .utf8)!
|
||||||
|
|
||||||
|
let services = try! JSONDecoder()
|
||||||
|
.decode([HomebrewService].self, from: data)
|
||||||
|
.filter({ return rootServiceNames.contains($0.name) })
|
||||||
|
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
ServicesManager.shared.rootServices = Dictionary(
|
||||||
|
uniqueKeysWithValues: services.map { ($0.name, $0) }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let userServiceNames = Preferences.custom.services ?? []
|
||||||
|
|
||||||
|
DispatchQueue.global(qos: .background).async {
|
||||||
|
let data = Shell
|
||||||
|
.pipe("\(Paths.brew) services info --all --json", requiresPath: true)
|
||||||
|
.data(using: .utf8)!
|
||||||
|
|
||||||
|
let services = try! JSONDecoder()
|
||||||
|
.decode([HomebrewService].self, from: data)
|
||||||
|
.filter({ return userServiceNames.contains($0.name) })
|
||||||
|
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
ServicesManager.shared.userServices = Dictionary(
|
||||||
|
uniqueKeysWithValues: services.map { ($0.name, $0) }
|
||||||
|
)
|
||||||
|
completed?()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func loadData() {
|
||||||
|
Self.loadHomebrewServices()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Dummy data for preview purposes.
|
||||||
|
*/
|
||||||
|
func withDummyServices(_ services: [String: Bool]) -> Self {
|
||||||
|
for (service, enabled) in services {
|
||||||
|
let item = HomebrewService.dummy(named: service, enabled: enabled)
|
||||||
|
self.rootServices[service] = item
|
||||||
|
}
|
||||||
|
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -242,7 +242,7 @@ class Startup {
|
|||||||
.components(separatedBy: "Laravel Valet")[1]
|
.components(separatedBy: "Laravel Valet")[1]
|
||||||
.trimmingCharacters(in: .whitespaces)
|
.trimmingCharacters(in: .whitespaces)
|
||||||
// Extract the version number
|
// Extract the version number
|
||||||
Valet.shared.version = try! VersionNumber.parse(VersionExtractor.from(output)!)
|
Valet.shared.version = try! VersionNumber.parse(VersionExtractor.from(versionString)!)
|
||||||
// Get the actual version
|
// Get the actual version
|
||||||
return Valet.shared.version == nil
|
return Valet.shared.version == nil
|
||||||
},
|
},
|
||||||
|
@@ -10,6 +10,34 @@ import XCTest
|
|||||||
|
|
||||||
class ValetVersionExtractorTest: XCTestCase {
|
class ValetVersionExtractorTest: XCTestCase {
|
||||||
|
|
||||||
|
func test_can_determine_valet_version_regardless_of_deprecations() async {
|
||||||
|
let output = """
|
||||||
|
Deprecated: Return type of Tightenco\\Collect\\Support\\Collection::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/dummy/.composer/vendor/tightenco/collect/src/Collect/Support/Collection.php on line 1789
|
||||||
|
|
||||||
|
Deprecated: Return type of Tightenco\\Collect\\Support\\Collection::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/dummy/.composer/vendor/tightenco/collect/src/Collect/Support/Collection.php on line 1800
|
||||||
|
|
||||||
|
Deprecated: Return type of Tightenco\\Collect\\Support\\Collection::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/dummy/.composer/vendor/tightenco/collect/src/Collect/Support/Collection.php on line 1812
|
||||||
|
|
||||||
|
Deprecated: Return type of Tightenco\\Collect\\Support\\Collection::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/dummy/.composer/vendor/tightenco/collect/src/Collect/Support/Collection.php on line 1827
|
||||||
|
|
||||||
|
Deprecated: Return type of Tightenco\\Collect\\Support\\Collection::count() should either be compatible with Countable::count(): int, or the #[\\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/dummy/.composer/vendor/tightenco/collect/src/Collect/Support/Collection.php on line 1768
|
||||||
|
|
||||||
|
Deprecated: Return type of Tightenco\\Collect\\Support\\Collection::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/dummy/.composer/vendor/tightenco/collect/src/Collect/Support/Collection.php on line 1747
|
||||||
|
|
||||||
|
Deprecated: Return type of Tightenco\\Collect\\Support\\Collection::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/dummy/.composer/vendor/tightenco/collect/src/Collect/Support/Collection.php on line 1716
|
||||||
|
Laravel Valet 3.3.0
|
||||||
|
"""
|
||||||
|
|
||||||
|
let versionString = output
|
||||||
|
.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||||
|
.components(separatedBy: "Laravel Valet")[1]
|
||||||
|
.trimmingCharacters(in: .whitespaces)
|
||||||
|
|
||||||
|
let version = try! VersionNumber.parse(VersionExtractor.from(versionString)!)
|
||||||
|
|
||||||
|
XCTAssertEqual(version.major, 3)
|
||||||
|
}
|
||||||
|
|
||||||
func test_can_determine_valet_version() async {
|
func test_can_determine_valet_version() async {
|
||||||
let version = await valet("--version", sudo: false)
|
let version = await valet("--version", sudo: false)
|
||||||
XCTAssert(version.contains("Laravel Valet 2") || version.contains("Laravel Valet 3"))
|
XCTAssert(version.contains("Laravel Valet 2") || version.contains("Laravel Valet 3"))
|
||||||
|
Reference in New Issue
Block a user