1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-11-07 21:20:07 +01:00

👌 Did someone say "out of range"?

This commit is contained in:
2023-03-13 21:08:24 +01:00
parent a6aecff557
commit 7b7a5e5236
2 changed files with 15 additions and 10 deletions

View File

@@ -94,7 +94,7 @@ public class PhpVersionInstaller {
if process.terminationStatus <= 0 { if process.terminationStatus <= 0 {
Task { @MainActor in Task { @MainActor in
subject.progress = 100 subject.progress = 1
} }
await PhpEnv.detectPhpVersions() await PhpEnv.detectPhpVersions()
@@ -109,6 +109,8 @@ public class PhpVersionInstaller {
subject.description = "The operation failed." subject.description = "The operation failed."
} }
} }
} else {
Log.err("\(version) is not contained within installable list")
} }
} }
@@ -122,22 +124,22 @@ public class PhpVersionInstaller {
private static func reportInstallationProgress(_ text: String) -> Double? { private static func reportInstallationProgress(_ text: String) -> Double? {
if text.contains("Fetching") { if text.contains("Fetching") {
return 10 return 0.1
} }
if text.contains("Downloading") { if text.contains("Downloading") {
return 25 return 0.25
} }
if text.contains("Already downloaded") || text.contains("Downloaded") { if text.contains("Already downloaded") || text.contains("Downloaded") {
return 50 return 0.50
} }
if text.contains("Installing") { if text.contains("Installing") {
return 60 return 0.60
} }
if text.contains("Pouring") { if text.contains("Pouring") {
return 80 return 0.80
} }
if text.contains("Summary") { if text.contains("Summary") {
return 100 return 1
} }
return nil return nil
} }

View File

@@ -100,7 +100,7 @@ extension StatusMenu {
? "Install PHP \(result.version)..." ? "Install PHP \(result.version)..."
: "Remove PHP \(result.version)..." : "Remove PHP \(result.version)..."
var action: Selector? = result.action == .install let action: Selector? = result.action == .install
? #selector(MainMenu.installPhpVersion(sender:)) ? #selector(MainMenu.installPhpVersion(sender:))
: #selector(MainMenu.removePhpVersion(sender:)) : #selector(MainMenu.removePhpVersion(sender:))
@@ -108,11 +108,14 @@ extension StatusMenu {
continue continue
} }
addItem(PhpMenuItem( let menuItem = PhpMenuItem(
title: title, title: title,
action: action, action: action,
keyEquivalent: "" keyEquivalent: ""
)) )
menuItem.version = result.version
addItem(menuItem)
} }
if !PhpEnv.shared.incompatiblePhpVersions.isEmpty { if !PhpEnv.shared.incompatiblePhpVersions.isEmpty {