From c2775c38a84c4f1ad26a0fee459914cd4f938ded Mon Sep 17 00:00:00 2001 From: David Jennes Date: Fri, 26 May 2017 20:23:03 +0200 Subject: [PATCH 1/2] Rename `stringToSwiftIdentifier` to `swiftIdentifier` --- Pods/Pods.xcodeproj/project.pbxproj | 26 +++++++++++++------------- Sources/Environment.swift | 2 +- Sources/Filters+Strings.swift | 4 ++-- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Pods/Pods.xcodeproj/project.pbxproj b/Pods/Pods.xcodeproj/project.pbxproj index 9d4ace85..8b58a74c 100644 --- a/Pods/Pods.xcodeproj/project.pbxproj +++ b/Pods/Pods.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 47; + objectVersion = 46; objects = { /* Begin PBXBuildFile section */ @@ -123,17 +123,17 @@ 2E6EDE0590FA1A030C93F83C2EEFC65C /* Pods-Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-Tests.release.xcconfig"; sourceTree = ""; }; 31A007C042C580A003C9B6DB5AD1B534 /* Lexer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Lexer.swift; path = Sources/Lexer.swift; sourceTree = ""; }; 34B18F90761D829268B37DFBB1128B65 /* Filters+Numbers.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = "Filters+Numbers.swift"; sourceTree = ""; }; - 351D229C0FCFC7B3571671631111EE1C /* Pods_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Pods_Tests.framework; path = "Pods-Tests.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; + 351D229C0FCFC7B3571671631111EE1C /* Pods_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 3B1C96CDE10E0238E81B06BD4DF23DAE /* Stencil-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Stencil-umbrella.h"; sourceTree = ""; }; 3D9976A9FB02F6316003996E10007AEE /* FilterTag.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = FilterTag.swift; path = Sources/FilterTag.swift; sourceTree = ""; }; 401E1E55A22F20E6B31811E8DB94C5F9 /* Environment.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Environment.swift; sourceTree = ""; }; 4309AA7478DD6B254C478AE5335748BA /* Pods-Tests-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-Tests-acknowledgements.plist"; sourceTree = ""; }; 4530D8B98FABC1BCB9F3A74C5406FD24 /* StencilSwiftKit.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = StencilSwiftKit.xcconfig; sourceTree = ""; }; - 49BCF2F8CB8DBEA0E51D00A9DE6AC7F5 /* Stencil.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Stencil.framework; path = Stencil.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 49BCF2F8CB8DBEA0E51D00A9DE6AC7F5 /* Stencil.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Stencil.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 4B8A4F98951CE676AEBB63C7A6E17EF2 /* Parameters.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Parameters.swift; sourceTree = ""; }; 4CD6F72648EF021002128ED600744C82 /* Context.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Context.swift; sourceTree = ""; }; 4E4F4075D4C0DB6A4267DDC45FE10B5C /* Filters.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Filters.swift; sourceTree = ""; }; - 4F35C03EE539651D8168B79F18A1DF5B /* Pods-Tests.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; path = "Pods-Tests.modulemap"; sourceTree = ""; }; + 4F35C03EE539651D8168B79F18A1DF5B /* Pods-Tests.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = "Pods-Tests.modulemap"; sourceTree = ""; }; 52E08CA96B2F20724148FF5361AD7206 /* Pods-Tests-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-Tests-umbrella.h"; sourceTree = ""; }; 5B85A6D36EC20031BC5814F8D8D514E8 /* PathKit.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = PathKit.swift; path = Sources/PathKit.swift; sourceTree = ""; }; 5D2B232B1969A09AA4B7E113FCA198A0 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -142,15 +142,15 @@ 6B6EDBFFC728EBE61A8D66E3FAE8B1D1 /* StencilSwiftKit-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "StencilSwiftKit-dummy.m"; sourceTree = ""; }; 6E3DE9DADD254D64C598089530A5932B /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 749318FE61E9EC318ED19250766267E2 /* Stencil-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Stencil-prefix.pch"; sourceTree = ""; }; - 7DB310C86ADAE310E9DF111FDD487FAF /* StencilSwiftKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = StencilSwiftKit.framework; path = StencilSwiftKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 7DB310C86ADAE310E9DF111FDD487FAF /* StencilSwiftKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = StencilSwiftKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 8923816ECEE63BE56AD67F2A147EF787 /* Context.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Context.swift; path = Sources/Context.swift; sourceTree = ""; }; 8B280832776CDAB7CF811E63AFE7F5E0 /* CallMacroNodes.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = CallMacroNodes.swift; sourceTree = ""; }; 8CA49A25561E541E61395E8C64512F22 /* PathKit-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "PathKit-dummy.m"; sourceTree = ""; }; 8CCB7B571DD30214319D05B2A2D01268 /* ForTag.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ForTag.swift; path = Sources/ForTag.swift; sourceTree = ""; }; 8FFA7DA1538F3CB30DA2B5074B573E52 /* Tokenizer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Tokenizer.swift; path = Sources/Tokenizer.swift; sourceTree = ""; }; - 919EAEDB009B1AA70C305AC91847AC41 /* PathKit.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; path = PathKit.modulemap; sourceTree = ""; }; + 919EAEDB009B1AA70C305AC91847AC41 /* PathKit.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = PathKit.modulemap; sourceTree = ""; }; 93A3BA06E90B797B9126411EF449E61E /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; + 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; 9A68FA9661EC6B4BA5415DDD474F7F00 /* Stencil.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Stencil.framework; sourceTree = BUILT_PRODUCTS_DIR; }; A5E20637D178539A5F5705320E6AAD3F /* Include.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Include.swift; path = Sources/Include.swift; sourceTree = ""; }; AD2E4F06D913344218A8F176415A4221 /* SetNode.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = SetNode.swift; sourceTree = ""; }; @@ -162,13 +162,13 @@ C0ABA9994C05CE2F400945671B7038BA /* Pods-Tests-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-Tests-dummy.m"; sourceTree = ""; }; C1E8657D8A2E60CA5179FDE94F283B2A /* PathKit.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = PathKit.xcconfig; sourceTree = ""; }; C62389B5756FDBA46714335EE5B2079D /* PathKit-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "PathKit-umbrella.h"; sourceTree = ""; }; - C68D522B00371B910EC16028EBD47384 /* PathKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = PathKit.framework; path = PathKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + C68D522B00371B910EC16028EBD47384 /* PathKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = PathKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; C74DCC10F6CC9FB70BEF27A2183A5B4F /* Filters.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Filters.swift; path = Sources/Filters.swift; sourceTree = ""; }; D12438B80ED47AD60857542BE0113ED7 /* Expression.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Expression.swift; path = Sources/Expression.swift; sourceTree = ""; }; D3D3B20225448481424FF16450B947D1 /* SwiftIdentifier.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = SwiftIdentifier.swift; sourceTree = ""; }; D5846CC8D36C9B97B51ACC82399D6A12 /* PathKit-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "PathKit-prefix.pch"; sourceTree = ""; }; - D6C2D28B3980163C3F38852C8437E5C2 /* Stencil.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; path = Stencil.modulemap; sourceTree = ""; }; - D7A2C924EBCC2FAAA7DBC39E8F154F1F /* StencilSwiftKit.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; path = StencilSwiftKit.modulemap; sourceTree = ""; }; + D6C2D28B3980163C3F38852C8437E5C2 /* Stencil.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = Stencil.modulemap; sourceTree = ""; }; + D7A2C924EBCC2FAAA7DBC39E8F154F1F /* StencilSwiftKit.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = StencilSwiftKit.modulemap; sourceTree = ""; }; D887BD539929925B9535E5136F861F20 /* IfTag.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IfTag.swift; path = Sources/IfTag.swift; sourceTree = ""; }; /* End PBXFileReference section */ @@ -253,7 +253,6 @@ 04D09F4207FB5C0B31BFD7A9CDB1C049 /* StencilSwiftTemplate.swift */, D3D3B20225448481424FF16450B947D1 /* SwiftIdentifier.swift */, ); - name = Sources; path = Sources; sourceTree = ""; }; @@ -322,7 +321,10 @@ B499EA03E3E7FF8D31B3BE631B1240D0 /* Products */, 000722C3134BAC39CFC2600254B1E03E /* Targets Support Files */, ); + indentWidth = 2; sourceTree = ""; + tabWidth = 2; + usesTabs = 0; }; B499EA03E3E7FF8D31B3BE631B1240D0 /* Products */ = { isa = PBXGroup; @@ -359,7 +361,6 @@ 17E001094F65D072A6D5E4A0C7F419BD /* Variable.swift */, 472C634E13CB5E53C65AA1985F35C13D /* Support Files */, ); - name = Stencil; path = Stencil; sourceTree = ""; }; @@ -369,7 +370,6 @@ 5B85A6D36EC20031BC5814F8D8D514E8 /* PathKit.swift */, 693A6FD601295700FF3115312779D86A /* Support Files */, ); - name = PathKit; path = PathKit; sourceTree = ""; }; diff --git a/Sources/Environment.swift b/Sources/Environment.swift index bc345338..6fcbe726 100644 --- a/Sources/Environment.swift +++ b/Sources/Environment.swift @@ -12,7 +12,7 @@ public extension Extension { registerTag("macro", parser: MacroNode.parse) registerTag("call", parser: CallNode.parse) registerTag("map", parser: MapNode.parse) - registerFilter("swiftIdentifier", filter: Filters.Strings.stringToSwiftIdentifier) + registerFilter("swiftIdentifier", filter: Filters.Strings.swiftIdentifier) registerFilter("lowerFirstWord", filter: Filters.Strings.lowerFirstWord) registerFilter("snakeToCamelCase", filter: Filters.Strings.snakeToCamelCase) registerFilter("camelToSnakeCase", filter: Filters.Strings.camelToSnakeCase) diff --git a/Sources/Filters+Strings.swift b/Sources/Filters+Strings.swift index 199c5c9f..7cf5a189 100644 --- a/Sources/Filters+Strings.swift +++ b/Sources/Filters+Strings.swift @@ -28,9 +28,9 @@ extension Filters { "right", "set", "Type", "unowned", "weak", "willSet" ] - static func stringToSwiftIdentifier(value: Any?) throws -> Any? { + static func swiftIdentifier(_ value: Any?) throws -> Any? { guard let value = value as? String else { throw Filters.Error.invalidInputType } - return swiftIdentifier(from: value, replaceWithUnderscores: true) + return StencilSwiftKit.swiftIdentifier(from: value, replaceWithUnderscores: true) } /* - If the string starts with only one uppercase letter, lowercase that first letter From ff17c5bf745e21c1cfd0fa6f54edf5c7d0491192 Mon Sep 17 00:00:00 2001 From: David Jennes Date: Fri, 26 May 2017 20:25:49 +0200 Subject: [PATCH 2/2] Changelog entry --- CHANGELOG.md | 3 +++ Documentation/MigrationGuide.md | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 579dc2ed..cd7aa0c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,9 @@ Due to the removal of legacy code, there are a few breaking changes in this new * Refactored the `snakeToCamelCase` filter to now accept an (optional) boolean parameter to control the `noPrefix` behaviour. [David Jennes](https://github.com/djbe) [#41](https://github.com/SwiftGen/StencilSwiftKit/pull/41) +* Rename the `stringToSwiftIdentifier` function to `swiftIdentifier` to better match the other method names. + [David Jennes](https://github.com/djbe) + [#46](https://github.com/SwiftGen/StencilSwiftKit/pull/46) ### New Features diff --git a/Documentation/MigrationGuide.md b/Documentation/MigrationGuide.md index 890bd635..f85bce31 100644 --- a/Documentation/MigrationGuide.md +++ b/Documentation/MigrationGuide.md @@ -19,3 +19,7 @@ We've removed the following deprecated `typealias`es: * `ParametersError`: use `Parameters.Error` instead. * `NumFilters`: use `Filters.Numbers` instead. * `StringFilters`: use `Filters.Strings` instead. + +The following functions have been renamed: + +* `stringToSwiftIdentifier` renamed to `swiftIdentifier`.