Improved upon the implementation of the "callAsFunction(at: )" function for the CreateFoldersTask task in the library target.
This commit is contained in:
@@ -15,19 +15,30 @@ public struct CreateFoldersTask {
|
||||
// MARK: Functions
|
||||
|
||||
public func callAsFunction(at rootFolder: URL) async throws {
|
||||
let folderApp = rootFolder.appendingPath(.folderApp)
|
||||
let folderAppInfrastructure = rootFolder.appendingPath(.folderAppInfrastructure)
|
||||
let folderAppTestCases = rootFolder.appendingPath(.folderAppTestCases)
|
||||
let folderAppTestSources = rootFolder.appendingPath(.folderAppTestSources)
|
||||
|
||||
try await fileService.createFolder(at: folderApp)
|
||||
try await fileService.createFolder(at: folderAppInfrastructure)
|
||||
try await fileService.createFolder(at: folderAppTestCases)
|
||||
try await fileService.createFolder(at: folderAppTestSources)
|
||||
let folders = Self.foldersToCreate.map { rootFolder.appendingPath($0) }
|
||||
|
||||
for folder in folders {
|
||||
try await fileService.createFolder(at: folder)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - Helpers
|
||||
|
||||
extension CreateFoldersTask {
|
||||
|
||||
// MARK: Constants
|
||||
|
||||
static let foldersToCreate: [String] = [
|
||||
.folderApp,
|
||||
.folderAppInfrastructure,
|
||||
.folderAppTestCases,
|
||||
.folderAppTestSources
|
||||
]
|
||||
|
||||
}
|
||||
|
||||
// MARK: - String+Constants
|
||||
|
||||
private extension String {
|
||||
|
||||
Reference in New Issue
Block a user