diff --git a/PHP Monitor.xcodeproj/project.pbxproj b/PHP Monitor.xcodeproj/project.pbxproj index def7010..fcf4701 100644 --- a/PHP Monitor.xcodeproj/project.pbxproj +++ b/PHP Monitor.xcodeproj/project.pbxproj @@ -161,6 +161,7 @@ C4D89BC62783C99400A02B68 /* ComposerJson.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4D89BC52783C99400A02B68 /* ComposerJson.swift */; }; C4D936C927E3EB6100BD69FE /* PhpHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4D936C827E3EB6100BD69FE /* PhpHelper.swift */; }; C4D936CA27E3EB6100BD69FE /* PhpHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4D936C827E3EB6100BD69FE /* PhpHelper.swift */; }; + C4D936CB27E3EE4A00BD69FE /* SiteListCellProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = C464ADB1275A87CA003FCD53 /* SiteListCellProtocol.swift */; }; C4D9ADBF277610E1007277F4 /* PhpSwitcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4D9ADBE277610E1007277F4 /* PhpSwitcher.swift */; }; C4D9ADC0277610E1007277F4 /* PhpSwitcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4D9ADBE277610E1007277F4 /* PhpSwitcher.swift */; }; C4D9ADC8277611A0007277F4 /* InternalSwitcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4D9ADC7277611A0007277F4 /* InternalSwitcher.swift */; }; @@ -1052,6 +1053,7 @@ C48D6C75279CD3E400F26D7E /* PhpVersionNumberTest.swift in Sources */, C43603A1275E67610028EFC6 /* AppDelegate+Notifications.swift in Sources */, C42759682627662800093CAE /* NSMenuExtension.swift in Sources */, + C4D936CB27E3EE4A00BD69FE /* SiteListCellProtocol.swift in Sources */, C4B97B76275CF08C003F3378 /* AppDelegate+MenuOutlets.swift in Sources */, C4F780CD25D80B75000DBC97 /* Alert.swift in Sources */, C481F79726164A78004FBCFF /* PrefsVC.swift in Sources */, diff --git a/phpmon-tests/Versions/PhpVersionDetectionTest.swift b/phpmon-tests/Versions/PhpVersionDetectionTest.swift index 88a4b24..12e9bf9 100644 --- a/phpmon-tests/Versions/PhpVersionDetectionTest.swift +++ b/phpmon-tests/Versions/PhpVersionDetectionTest.swift @@ -22,7 +22,7 @@ class PhpVersionDetectionTest: XCTestCase { "unrelatedphp@1.0", // should be omitted, invalid "php@5.6", "php@5.4" // should be omitted, not supported - ], checkBinaries: false) + ], checkBinaries: false, generateHelpers: false) XCTAssertEqual(outcome, ["8.0", "7.0"]) } diff --git a/phpmon/Common/PHP/PHP Version/PhpEnv.swift b/phpmon/Common/PHP/PHP Version/PhpEnv.swift index f7c4a3f..f5fe99c 100644 --- a/phpmon/Common/PHP/PHP Version/PhpEnv.swift +++ b/phpmon/Common/PHP/PHP Version/PhpEnv.swift @@ -117,10 +117,14 @@ class PhpEnv { /** Extracts valid PHP versions from an array of strings. This array of strings is usually retrieved from `grep`. + + If `generateHelpers` is set to true, after detecting + all versions, helper scripts are generated as well. */ public func extractPhpVersions( from versions: [String], - checkBinaries: Bool = true + checkBinaries: Bool = true, + generateHelpers: Bool = true ) -> [String] { var output : [String] = [] @@ -146,15 +150,15 @@ class PhpEnv { } } - writeHelpers(with: output) + if generateHelpers { + versions.forEach { PhpHelper.generate(for: $0) } + } return output } private func writeHelpers(with versions: [String]) { - for version in versions { - PhpHelper.generate(for: version) - } + } public func validVersions(for constraint: String) -> [PhpVersionNumber] {