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