Improved the implementation for the CreateFolderTask task in the library target.
This commit is contained in:
@@ -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"
|
||||
]
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user