1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-08-07 03:50:08 +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()
if !isRunningTests {
// When running unit tests, the MainMenu will not be available
// TODO: Investigate an alternate approach w/ notification or publishable
Task { @MainActor in
MainMenu.shared.rebuild()
}

View File

@ -162,7 +162,7 @@ class Valet {
// 1. Evaluate feature support
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 {
let version = version!
let recommended = Constants.MinimumRecommendedValetVersion
@ -183,11 +183,6 @@ class Valet {
Log.info("Valet version \(version.text) is recent enough, OK " +
"(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 environmentVariables: [String: String]?
var exportAsString: String {
return self.environmentVariables!
.map { (key, value) in
return "export \(key)=\(value)"
}
.joined(separator: "&&")
}
public func hasPresets() -> Bool {
return self.presets != nil && !self.presets!.isEmpty
}
@ -26,13 +34,6 @@ struct CustomPrefs: Decodable {
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 {
case scanApps = "scan_apps"
case presets = "presets"
@ -88,7 +89,7 @@ extension Preferences {
if customPreferences.hasEnvironmentVariables() {
Log.info("Configuring the additional exports...")
if let shell = Shell as? RealShell {
shell.exports = customPreferences.getEnvironmentVariables()
shell.exports = customPreferences.exportAsString
}
}
} catch {

View File

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

View File

@ -47,9 +47,9 @@ class HomebrewPackageTest: XCTestCase {
XCTAssertEqual(services.first?.service_name, "homebrew.mxcl.dnsmasq")
}
/*
// - 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,
/// and requires the Valet services to be installed: php, nginx and dnsmasq.
/// If this test fails, there is an issue with your Homebrew installation
@ -72,7 +72,6 @@ class HomebrewPackageTest: XCTestCase {
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,
/// and requires the `php` formula to be installed.
/// If this test fails, there is an issue with your Homebrew installation
@ -87,4 +86,5 @@ class HomebrewPackageTest: XCTestCase {
XCTAssertTrue(package.name == "php")
}
*/
}