Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Sourcery V2.0.3 #352

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Sources/CLI/Core/Assets/Assets.swift

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions Sources/SwiftyMocky/Mock.swifttemplate
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ class Helpers {
}
static func extractGenericsList(_ associatedTypes: [String]?) -> [String] {
return associatedTypes?.flatMap {
split($0, byFirstOccurenceOf: " where ").0.replacingOccurrences(of: " ", with: "").characters.split(separator: ":").map(String.init).first
split($0, byFirstOccurenceOf: " where ").0.replacingOccurrences(of: " ", with: "").split(separator: ":").map(String.init).first
}.map { "\($0)" } ?? []
}
static func extractGenericTypesModifier(_ associatedTypes: [String]?) -> String {
Expand All @@ -253,9 +253,9 @@ class Helpers {
guard let all = associatedTypes else { return "" }
let constraints = all.flatMap { t -> String? in
let splitted = split(t, byFirstOccurenceOf: " where ")
let constraint = splitted.0.replacingOccurrences(of: " ", with: "").characters.split(separator: ":").map(String.init)
let constraint = splitted.0.replacingOccurrences(of: " ", with: "").split(separator: ":").map(String.init)
guard constraint.count == 2 else { return nil }
let adopts = constraint[1].characters.split(separator: ",").map(String.init)
let adopts = constraint[1].split(separator: ",").map(String.init)
var mapped = adopts.map { "\(constraint[0]): \($0)" }
if !splitted.1.isEmpty {
mapped.append(splitted.1)
Expand Down Expand Up @@ -1146,7 +1146,7 @@ class MethodWrapper {
genPart.removeFirst()
genPart.removeLast()

let parts = genPart.replacingOccurrences(of: " ", with: "").characters.split(separator: ",").map(String.init)
let parts = genPart.replacingOccurrences(of: " ", with: "").split(separator: ",").map(String.init)
return parts.map { stripGenPart(part: $0) }
}

Expand All @@ -1161,7 +1161,7 @@ class MethodWrapper {
genPart.removeFirst()
genPart.removeLast()

let parts = genPart.replacingOccurrences(of: " ", with: "").characters.split(separator: ",").map(String.init)
let parts = genPart.replacingOccurrences(of: " ", with: "").split(separator: ",").map(String.init)
return parts.filter {
let components = $0.components(separatedBy: ":")
return (components.count == 2 || !filterSingle) && generics.contains(components[0])
Expand All @@ -1183,7 +1183,7 @@ class MethodWrapper {
}

private func stripGenPart(part: String) -> String {
return part.characters.split(separator: ":").map(String.init).first!
return part.split(separator: ":").map(String.init).first!
}

private func returnTypeStripped(_ method: SourceryRuntime.Method, type: Bool = false) -> String {
Expand Down
12 changes: 6 additions & 6 deletions Sources/SwiftyPrototype/Prototype.swifttemplate
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ class Helpers {
}
static func extractGenericsList(_ associatedTypes: [String]?) -> [String] {
return associatedTypes?.flatMap {
split($0, byFirstOccurenceOf: " where ").0.replacingOccurrences(of: " ", with: "").characters.split(separator: ":").map(String.init).first
split($0, byFirstOccurenceOf: " where ").0.replacingOccurrences(of: " ", with: "").split(separator: ":").map(String.init).first
}.map { "\($0)" } ?? []
}
static func extractGenericTypesModifier(_ associatedTypes: [String]?) -> String {
Expand All @@ -252,9 +252,9 @@ class Helpers {
guard let all = associatedTypes else { return "" }
let constraints = all.flatMap { t -> String? in
let splitted = split(t, byFirstOccurenceOf: " where ")
let constraint = splitted.0.replacingOccurrences(of: " ", with: "").characters.split(separator: ":").map(String.init)
let constraint = splitted.0.replacingOccurrences(of: " ", with: "").split(separator: ":").map(String.init)
guard constraint.count == 2 else { return nil }
let adopts = constraint[1].characters.split(separator: ",").map(String.init)
let adopts = constraint[1].split(separator: ",").map(String.init)
var mapped = adopts.map { "\(constraint[0]): \($0)" }
if !splitted.1.isEmpty {
mapped.append(splitted.1)
Expand Down Expand Up @@ -1145,7 +1145,7 @@ class MethodWrapper {
genPart.removeFirst()
genPart.removeLast()

let parts = genPart.replacingOccurrences(of: " ", with: "").characters.split(separator: ",").map(String.init)
let parts = genPart.replacingOccurrences(of: " ", with: "").split(separator: ",").map(String.init)
return parts.map { stripGenPart(part: $0) }
}

Expand All @@ -1160,7 +1160,7 @@ class MethodWrapper {
genPart.removeFirst()
genPart.removeLast()

let parts = genPart.replacingOccurrences(of: " ", with: "").characters.split(separator: ",").map(String.init)
let parts = genPart.replacingOccurrences(of: " ", with: "").split(separator: ",").map(String.init)
return parts.filter {
let components = $0.components(separatedBy: ":")
return (components.count == 2 || !filterSingle) && generics.contains(components[0])
Expand All @@ -1182,7 +1182,7 @@ class MethodWrapper {
}

private func stripGenPart(part: String) -> String {
return part.characters.split(separator: ":").map(String.init).first!
return part.split(separator: ":").map(String.init).first!
}

private func returnTypeStripped(_ method: SourceryRuntime.Method, type: Bool = false) -> String {
Expand Down
6 changes: 3 additions & 3 deletions Templates/Helpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Helpers {
}
static func extractGenericsList(_ associatedTypes: [String]?) -> [String] {
return associatedTypes?.flatMap {
split($0, byFirstOccurenceOf: " where ").0.replacingOccurrences(of: " ", with: "").characters.split(separator: ":").map(String.init).first
split($0, byFirstOccurenceOf: " where ").0.replacingOccurrences(of: " ", with: "").split(separator: ":").map(String.init).first
}.map { "\($0)" } ?? []
}
static func extractGenericTypesModifier(_ associatedTypes: [String]?) -> String {
Expand All @@ -48,9 +48,9 @@ class Helpers {
guard let all = associatedTypes else { return "" }
let constraints = all.flatMap { t -> String? in
let splitted = split(t, byFirstOccurenceOf: " where ")
let constraint = splitted.0.replacingOccurrences(of: " ", with: "").characters.split(separator: ":").map(String.init)
let constraint = splitted.0.replacingOccurrences(of: " ", with: "").split(separator: ":").map(String.init)
guard constraint.count == 2 else { return nil }
let adopts = constraint[1].characters.split(separator: ",").map(String.init)
let adopts = constraint[1].split(separator: ",").map(String.init)
var mapped = adopts.map { "\(constraint[0]): \($0)" }
if !splitted.1.isEmpty {
mapped.append(splitted.1)
Expand Down
6 changes: 3 additions & 3 deletions Templates/MethodWrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ class MethodWrapper {
genPart.removeFirst()
genPart.removeLast()

let parts = genPart.replacingOccurrences(of: " ", with: "").characters.split(separator: ",").map(String.init)
let parts = genPart.replacingOccurrences(of: " ", with: "").split(separator: ",").map(String.init)
return parts.map { stripGenPart(part: $0) }
}

Expand All @@ -656,7 +656,7 @@ class MethodWrapper {
genPart.removeFirst()
genPart.removeLast()

let parts = genPart.replacingOccurrences(of: " ", with: "").characters.split(separator: ",").map(String.init)
let parts = genPart.replacingOccurrences(of: " ", with: "").split(separator: ",").map(String.init)
return parts.filter {
let components = $0.components(separatedBy: ":")
return (components.count == 2 || !filterSingle) && generics.contains(components[0])
Expand All @@ -678,7 +678,7 @@ class MethodWrapper {
}

private func stripGenPart(part: String) -> String {
return part.characters.split(separator: ":").map(String.init).first!
return part.split(separator: ":").map(String.init).first!
}

private func returnTypeStripped(_ method: SourceryRuntime.Method, type: Bool = false) -> String {
Expand Down
Binary file modified bin/swiftymocky
Binary file not shown.