1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-08-08 04:20:07 +02:00

👌 Cleanup

This commit is contained in:
2023-01-07 18:10:31 +01:00
parent 6e7c0d827c
commit 0b3a83c1e4
5 changed files with 18 additions and 19 deletions

View File

@ -87,8 +87,6 @@ class PhpExtension {
enabled.toggle() enabled.toggle()
if !isRunningTests { if !isRunningTests {
// When running unit tests, the MainMenu will not be available
// TODO: Investigate an alternate approach w/ notification or publishable
Task { @MainActor in Task { @MainActor in
MainMenu.shared.rebuild() MainMenu.shared.rebuild()
} }

View File

@ -162,7 +162,7 @@ class Valet {
// 1. Evaluate feature support // 1. Evaluate feature support
Valet.shared.evaluateFeatureSupport() Valet.shared.evaluateFeatureSupport()
// 2. Notify user if the version is too old // 2. Notify user if the version is too old (but major version is OK)
if version.text.versionCompare(Constants.MinimumRecommendedValetVersion) == .orderedAscending { if version.text.versionCompare(Constants.MinimumRecommendedValetVersion) == .orderedAscending {
let version = version! let version = version!
let recommended = Constants.MinimumRecommendedValetVersion let recommended = Constants.MinimumRecommendedValetVersion
@ -183,11 +183,6 @@ class Valet {
Log.info("Valet version \(version.text) is recent enough, OK " + Log.info("Valet version \(version.text) is recent enough, OK " +
"(recommended: \(Constants.MinimumRecommendedValetVersion))") "(recommended: \(Constants.MinimumRecommendedValetVersion))")
} }
// 3. Notify user if the version is too high
if version.major > 4 {
// TODO: Notify user if the version is too high
}
} }
/** /**

View File

@ -14,6 +14,14 @@ struct CustomPrefs: Decodable {
let services: [String]? let services: [String]?
let environmentVariables: [String: String]? let environmentVariables: [String: String]?
var exportAsString: String {
return self.environmentVariables!
.map { (key, value) in
return "export \(key)=\(value)"
}
.joined(separator: "&&")
}
public func hasPresets() -> Bool { public func hasPresets() -> Bool {
return self.presets != nil && !self.presets!.isEmpty return self.presets != nil && !self.presets!.isEmpty
} }
@ -26,13 +34,6 @@ struct CustomPrefs: Decodable {
return self.environmentVariables != nil && !self.environmentVariables!.keys.isEmpty return self.environmentVariables != nil && !self.environmentVariables!.keys.isEmpty
} }
// TODO: Rework this
public func getEnvironmentVariables() -> String {
return self.environmentVariables!.map { (key, value) in
return "export \(key)=\(value)"
}.joined(separator: "&&")
}
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case scanApps = "scan_apps" case scanApps = "scan_apps"
case presets = "presets" case presets = "presets"
@ -88,7 +89,7 @@ extension Preferences {
if customPreferences.hasEnvironmentVariables() { if customPreferences.hasEnvironmentVariables() {
Log.info("Configuring the additional exports...") Log.info("Configuring the additional exports...")
if let shell = Shell as? RealShell { if let shell = Shell as? RealShell {
shell.exports = customPreferences.getEnvironmentVariables() shell.exports = customPreferences.exportAsString
} }
} }
} catch { } catch {

View File

@ -77,6 +77,11 @@ struct ServicesView: View {
.foregroundColor(self.manager.statusColor) .foregroundColor(self.manager.statusColor)
Text(self.manager.statusMessage) Text(self.manager.statusMessage)
.font(.system(size: 12)) .font(.system(size: 12))
Button {
} label: {
Text("Learn more").font(.system(size: 12))
}
} }
} }
.frame(height: CGFloat(self.statusHeight)) .frame(height: CGFloat(self.statusHeight))
@ -152,7 +157,7 @@ struct ServicesView_Previews: PreviewProvider {
formulae: ["php", "nginx", "dnsmasq"], formulae: ["php", "nginx", "dnsmasq"],
status: .active status: .active
), perRow: 4) ), perRow: 4)
.frame(width: 330.0) .frame(width: 330.0, height: 150)
.previewDisplayName("Loading") .previewDisplayName("Loading")
ServicesView(manager: FakeServicesManager( ServicesView(manager: FakeServicesManager(

View File

@ -47,9 +47,9 @@ class HomebrewPackageTest: XCTestCase {
XCTAssertEqual(services.first?.service_name, "homebrew.mxcl.dnsmasq") XCTAssertEqual(services.first?.service_name, "homebrew.mxcl.dnsmasq")
} }
/*
// - MARK: LIVE TESTS // - MARK: LIVE TESTS
/// TODO: Use fake data or make this an integration test
/// This test requires that you have a valid Homebrew installation set up, /// This test requires that you have a valid Homebrew installation set up,
/// and requires the Valet services to be installed: php, nginx and dnsmasq. /// and requires the Valet services to be installed: php, nginx and dnsmasq.
/// If this test fails, there is an issue with your Homebrew installation /// If this test fails, there is an issue with your Homebrew installation
@ -72,7 +72,6 @@ class HomebrewPackageTest: XCTestCase {
XCTAssertEqual(services.count, 3) XCTAssertEqual(services.count, 3)
} }
/// TODO: Use fake data or make this an integration test
/// This test requires that you have a valid Homebrew installation set up, /// This test requires that you have a valid Homebrew installation set up,
/// and requires the `php` formula to be installed. /// and requires the `php` formula to be installed.
/// If this test fails, there is an issue with your Homebrew installation /// If this test fails, there is an issue with your Homebrew installation
@ -87,4 +86,5 @@ class HomebrewPackageTest: XCTestCase {
XCTAssertTrue(package.name == "php") XCTAssertTrue(package.name == "php")
} }
*/
} }