Implemented the "path" property for the Folder enumeration in the library target.

This commit is contained in:
2025-01-18 11:38:01 +01:00
parent 504b3be447
commit 720ad687fb
4 changed files with 62 additions and 9 deletions
@@ -1,10 +1,29 @@
enum Folder: String {
case app = "App/Sources"
case libraryPublic = "Library/Sources/Public"
case libraryInternal = "Library/Sources/Internal"
case testCasesPublic = "Test/Sources/Cases/Public"
case testCasesInternal = "Test/Sources/Cases/Internal"
case testHelpers = "Test/Sources/Helpers"
enum Folder {
case app
case libraryPublic
case libraryInternal
case testCasesPublic
case testCasesInternal
case testHelpers
}
// MARK: - Properties
extension Folder {
// MARK: Computed
var path: String {
switch self {
case .app: "App/Sources"
case .libraryPublic: "Library/Sources/Public"
case .libraryInternal: "Library/Sources/Internal"
case .testCasesPublic: "Test/Sources/Cases/Public"
case .testCasesInternal: "Test/Sources/Cases/Internal"
case .testHelpers: "Test/Sources/Helpers"
}
}
}
// MARK: - CaseIterable
@@ -15,7 +15,7 @@ public struct CreateFoldersTask {
// MARK: Functions
public func callAsFunction(at rootFolder: URL) async throws {
let folders = Folder.allCases.map { rootFolder.appendingPath($0.rawValue) }
let folders = Folder.allCases.map { rootFolder.appendingPath($0.path) }
for folder in folders {
try await fileService.createFolder(at: folder)