colibri/Sources/Library/Tasks/CreateFoldersTask.swift

39 lines
1.2 KiB
Swift

import Foundation
public struct CreateFoldersTask {
// MARK: Properties
private let fileService: FileServicing
// MARK: Initialisers
public init(fileService: FileServicing) {
self.fileService = fileService
}
// 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)
}
}
// MARK: - String+Constants
private extension String {
static let folderApp = "Sources/App"
static let folderAppInfrastructure = "Sources/AppInfrastructure"
static let folderAppTestCases = "Tests/App/Cases"
static let folderAppTestSources = "Tests/App/Sources"
}