From 8a7bfa12fc79beb4c4aa95fd5d4bf9e99f1f294e Mon Sep 17 00:00:00 2001 From: Yonas Kolb Date: Tue, 26 Sep 2017 14:22:15 +0200 Subject: [PATCH] format code --- Sources/ProjectSpec/ProjectSpec.swift | 3 +-- Sources/XcodeGenKit/SettingsPresetFile.swift | 2 +- Sources/XcodeGenKit/SpecLoader.swift | 13 ++++++------- Tests/XcodeGenKitTests/ProjectGeneratorTests.swift | 4 ++-- format_code.sh => format-code.sh | 0 5 files changed, 10 insertions(+), 12 deletions(-) rename format_code.sh => format-code.sh (100%) mode change 100644 => 100755 diff --git a/Sources/ProjectSpec/ProjectSpec.swift b/Sources/ProjectSpec/ProjectSpec.swift index 38c77795..ac1a0f99 100644 --- a/Sources/ProjectSpec/ProjectSpec.swift +++ b/Sources/ProjectSpec/ProjectSpec.swift @@ -31,7 +31,6 @@ public struct ProjectSpec { public var bundleIdPrefix: String? public init() { - } } @@ -98,7 +97,7 @@ extension ProjectSpec.Options: Equatable { public static func ==(lhs: ProjectSpec.Options, rhs: ProjectSpec.Options) -> Bool { return lhs.carthageBuildPath == rhs.carthageBuildPath && - lhs.bundleIdPrefix == rhs.bundleIdPrefix + lhs.bundleIdPrefix == rhs.bundleIdPrefix } } diff --git a/Sources/XcodeGenKit/SettingsPresetFile.swift b/Sources/XcodeGenKit/SettingsPresetFile.swift index 0314077e..be774539 100644 --- a/Sources/XcodeGenKit/SettingsPresetFile.swift +++ b/Sources/XcodeGenKit/SettingsPresetFile.swift @@ -14,7 +14,7 @@ public enum SettingsPresetFile { case config(ConfigType) case platform(Platform) case product(PBXProductType) - case productPlatform(PBXProductType,Platform) + case productPlatform(PBXProductType, Platform) case base var path: String { diff --git a/Sources/XcodeGenKit/SpecLoader.swift b/Sources/XcodeGenKit/SpecLoader.swift index 043b59ca..8898ecbf 100644 --- a/Sources/XcodeGenKit/SpecLoader.swift +++ b/Sources/XcodeGenKit/SpecLoader.swift @@ -16,7 +16,7 @@ public struct SpecLoader { public static func loadSpec(path: Path) throws -> ProjectSpec { let dictionary = try loadDictionary(path: path) - let filteredDictionary = SpecLoader.filterNull(dictionary) as! [String:Any] + let filteredDictionary = SpecLoader.filterNull(dictionary) as! [String: Any] return try ProjectSpec(jsonDictionary: filteredDictionary) } @@ -66,16 +66,15 @@ public struct SpecLoader { return merged } - private static func filterNull(_ object:Any) -> Any { - var returnedValue : Any = object - if let dict = object as? [String:Any] { - var mutabledic : [String: Any] = [:] + private static func filterNull(_ object: Any) -> Any { + var returnedValue: Any = object + if let dict = object as? [String: Any] { + var mutabledic: [String: Any] = [:] for (key, value) in dict { mutabledic[key] = SpecLoader.filterNull(value) } returnedValue = mutabledic - } - else if let array = object as? [Any] { + } else if let array = object as? [Any] { var mutableArray: [Any] = array for (index, value) in array.enumerated() { mutableArray[index] = SpecLoader.filterNull(value) diff --git a/Tests/XcodeGenKitTests/ProjectGeneratorTests.swift b/Tests/XcodeGenKitTests/ProjectGeneratorTests.swift index 8300ada9..8b361df3 100644 --- a/Tests/XcodeGenKitTests/ProjectGeneratorTests.swift +++ b/Tests/XcodeGenKitTests/ProjectGeneratorTests.swift @@ -37,7 +37,7 @@ func projectGeneratorTests() { let buildConfigs = project.pbxproj.configurationLists.getReference(target.buildConfigurationList), let buildConfigReference = buildConfigs.buildConfigurations.first, let buildConfig = project.pbxproj.buildConfigurations.getReference(buildConfigReference) else { - throw failure("Build Config not found") + throw failure("Build Config not found") } try expect(buildConfig.buildSettings["PRODUCT_BUNDLE_IDENTIFIER"] as? String) == "com.test.MyFramework" } @@ -85,7 +85,7 @@ func projectGeneratorTests() { var expectedTargetDebugSettings = BuildSettings() expectedTargetDebugSettings += SettingsPresetFile.platform(.iOS).getBuildSettings() expectedTargetDebugSettings += SettingsPresetFile.product(.application).getBuildSettings() - expectedTargetDebugSettings += SettingsPresetFile.productPlatform(.application,.iOS).getBuildSettings() + expectedTargetDebugSettings += SettingsPresetFile.productPlatform(.application, .iOS).getBuildSettings() expectedTargetDebugSettings += ["SETTING 2": "value 2", "SETTING 3": "value 3", "SETTING": "value"] try expect(targetDebugSettings.equals(expectedTargetDebugSettings)).beTrue() diff --git a/format_code.sh b/format-code.sh old mode 100644 new mode 100755 similarity index 100% rename from format_code.sh rename to format-code.sh