Improved the implementation for the CreateFolderTask task in the library target.

This commit is contained in:
2025-01-18 04:25:01 +01:00
parent 9ee7592902
commit 026251ad6d
3 changed files with 34 additions and 25 deletions
@@ -0,0 +1,12 @@
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"
}
// MARK: - CaseIterable
extension Folder: CaseIterable {}
@@ -15,7 +15,7 @@ public struct CreateFoldersTask {
// MARK: Functions
public func callAsFunction(at rootFolder: URL) async throws {
let folders = Self.foldersToCreate.map { rootFolder.appendingPath($0) }
let folders = Folder.allCases.map { rootFolder.appendingPath($0.rawValue) }
for folder in folders {
try await fileService.createFolder(at: folder)
@@ -23,18 +23,3 @@ public struct CreateFoldersTask {
}
}
// MARK: - Helpers
extension CreateFoldersTask {
// MARK: Constants
static let foldersToCreate: [String] = [
"Sources/App",
"Sources/AppInfrastructure",
"Tests/App/Cases",
"Tests/App/Sources"
]
}