From 784cf34341d3d07eaece3cd6d5d4877b2e94628c Mon Sep 17 00:00:00 2001
From: Dariusz Rybicki <dariusz@elixxir.io>
Date: Thu, 21 Jul 2022 18:54:17 +0100
Subject: [PATCH] Add version getter functors

---
 Sources/ElixxirDAppsSDK/GetGitVersion.swift   | 22 +++++++++++++++++++
 Sources/ElixxirDAppsSDK/GetVersion.swift      | 22 +++++++++++++++++++
 .../Legacy/GitVersionProvider.swift           | 19 ----------------
 .../Legacy/VersionProvider.swift              | 19 ----------------
 4 files changed, 44 insertions(+), 38 deletions(-)
 create mode 100644 Sources/ElixxirDAppsSDK/GetGitVersion.swift
 create mode 100644 Sources/ElixxirDAppsSDK/GetVersion.swift
 delete mode 100644 Sources/ElixxirDAppsSDK/Legacy/GitVersionProvider.swift
 delete mode 100644 Sources/ElixxirDAppsSDK/Legacy/VersionProvider.swift

diff --git a/Sources/ElixxirDAppsSDK/GetGitVersion.swift b/Sources/ElixxirDAppsSDK/GetGitVersion.swift
new file mode 100644
index 00000000..9eafe8b9
--- /dev/null
+++ b/Sources/ElixxirDAppsSDK/GetGitVersion.swift
@@ -0,0 +1,22 @@
+import Bindings
+import XCTestDynamicOverlay
+
+public struct GetGitVersion {
+  public var run: () -> String
+
+  public func callAsFunction() -> String {
+    run()
+  }
+}
+
+extension GetGitVersion {
+  public static let live = GetGitVersion(
+    run: BindingsGetGitVersion
+  )
+}
+
+extension GetGitVersion {
+  public static let unimplemented = GetGitVersion(
+    run: XCTUnimplemented("\(Self.self)")
+  )
+}
diff --git a/Sources/ElixxirDAppsSDK/GetVersion.swift b/Sources/ElixxirDAppsSDK/GetVersion.swift
new file mode 100644
index 00000000..eee1535c
--- /dev/null
+++ b/Sources/ElixxirDAppsSDK/GetVersion.swift
@@ -0,0 +1,22 @@
+import Bindings
+import XCTestDynamicOverlay
+
+public struct GetVersion {
+  public var run: () -> String
+
+  public func callAsFunction() -> String {
+    run()
+  }
+}
+
+extension GetVersion {
+  public static let live = GetVersion(
+    run: BindingsGetVersion
+  )
+}
+
+extension GetVersion {
+  public static let unimplemented = GetVersion(
+    run: XCTUnimplemented("\(Self.self)")
+  )
+}
diff --git a/Sources/ElixxirDAppsSDK/Legacy/GitVersionProvider.swift b/Sources/ElixxirDAppsSDK/Legacy/GitVersionProvider.swift
deleted file mode 100644
index 29ef07a3..00000000
--- a/Sources/ElixxirDAppsSDK/Legacy/GitVersionProvider.swift
+++ /dev/null
@@ -1,19 +0,0 @@
-import Bindings
-
-public struct GitVersionProvider {
-  public var get: () -> String
-
-  public func callAsFunction() -> String {
-    get()
-  }
-}
-
-extension GitVersionProvider {
-  public static let live = GitVersionProvider(get: BindingsGetGitVersion)
-}
-
-#if DEBUG
-extension GitVersionProvider {
-  public static let failing = GitVersionProvider { fatalError("Not implemented") }
-}
-#endif
diff --git a/Sources/ElixxirDAppsSDK/Legacy/VersionProvider.swift b/Sources/ElixxirDAppsSDK/Legacy/VersionProvider.swift
deleted file mode 100644
index bec9b293..00000000
--- a/Sources/ElixxirDAppsSDK/Legacy/VersionProvider.swift
+++ /dev/null
@@ -1,19 +0,0 @@
-import Bindings
-
-public struct VersionProvider {
-  public var get: () -> String
-
-  public func callAsFunction() -> String {
-    get()
-  }
-}
-
-extension VersionProvider {
-  public static let live = VersionProvider(get: BindingsGetVersion)
-}
-
-#if DEBUG
-extension VersionProvider {
-  public static let failing = VersionProvider { fatalError("Not implemented") }
-}
-#endif
-- 
GitLab