Skip to content

Commit 5114639

Browse files
fviernausschuberth
authored andcommitted
refactor(cocoapods): Factor out Podspec.toVcsInfo()
Prepare for an upcoming change. Signed-off-by: Frank Viernau <[email protected]>
1 parent 82018d9 commit 5114639

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

plugins/package-managers/cocoapods/src/main/kotlin/PodDependencyHandler.kt

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,7 @@ internal class PodDependencyHandler : DependencyHandler<Lockfile.Pod> {
9494

9595
val podspec = getPodspec(dependency.name, dependency.version)
9696

97-
val vcs = podspec?.source?.git?.let { url ->
98-
VcsInfo(
99-
type = VcsType.GIT,
100-
url = url,
101-
revision = podspec.source.tag.orEmpty()
102-
)
103-
}.orEmpty()
97+
val vcs = podspec?.toVcsInfo().orEmpty()
10498

10599
return Package(
106100
id = id,
@@ -198,3 +192,12 @@ internal class PodDependencyHandler : DependencyHandler<Lockfile.Pod> {
198192
return propertiesA == propertiesB
199193
}
200194
}
195+
196+
private fun Podspec.toVcsInfo(): VcsInfo? =
197+
source?.git?.let { url ->
198+
VcsInfo(
199+
type = VcsType.GIT,
200+
url = url,
201+
revision = source.tag.orEmpty()
202+
)
203+
}

0 commit comments

Comments
 (0)