mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-07 12:00:09 +02:00
👌 Improved parallelization
This commit is contained in:
@ -619,7 +619,7 @@
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 55;
|
||||
CURRENT_PROJECT_VERSION = 56;
|
||||
DEVELOPMENT_TEAM = 8M54J5J787;
|
||||
ENABLE_HARDENED_RUNTIME = YES;
|
||||
INFOPLIST_FILE = phpmon/Info.plist;
|
||||
@ -643,7 +643,7 @@
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 55;
|
||||
CURRENT_PROJECT_VERSION = 56;
|
||||
DEVELOPMENT_TEAM = 8M54J5J787;
|
||||
ENABLE_HARDENED_RUNTIME = YES;
|
||||
INFOPLIST_FILE = phpmon/Info.plist;
|
||||
|
@ -99,16 +99,13 @@ class Actions {
|
||||
availableVersions: [String],
|
||||
completed: @escaping () -> Void
|
||||
) {
|
||||
print("Switching to \(version)")
|
||||
print("Switching to \(version), unlinking all versions...")
|
||||
|
||||
let group = DispatchGroup()
|
||||
group.enter()
|
||||
|
||||
var versionsDisabled: [String: Bool] = [:]
|
||||
availableVersions.forEach { (available) in
|
||||
versionsDisabled[available] = false
|
||||
}
|
||||
|
||||
availableVersions.forEach { (available) in
|
||||
group.enter()
|
||||
|
||||
DispatchQueue.global(qos: .userInitiated).async {
|
||||
let formula = (available == App.shared.brewPhpVersion)
|
||||
? "php" : "php@\(available)"
|
||||
@ -116,18 +113,19 @@ class Actions {
|
||||
brew("unlink \(formula)")
|
||||
brew("services stop \(formula)", sudo: true)
|
||||
|
||||
versionsDisabled[available] = true
|
||||
if !versionsDisabled.values.contains(false) {
|
||||
group.leave()
|
||||
}
|
||||
group.leave()
|
||||
}
|
||||
}
|
||||
|
||||
group.notify(queue: .global(qos: .userInitiated)) {
|
||||
print("All versions have been unlinked!")
|
||||
print("Linking the new version!")
|
||||
|
||||
let formula = (version == App.shared.brewPhpVersion) ? "php" : "php@\(version)"
|
||||
brew("link \(formula) --overwrite --force")
|
||||
brew("services start \(formula)", sudo: true)
|
||||
|
||||
print("The new version has been linked!")
|
||||
completed()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user