diff --git a/WebsiteGenerator/Files/Configuration.swift b/WebsiteGenerator/Files/Configuration.swift index d83cec2..1fcc037 100644 --- a/WebsiteGenerator/Files/Configuration.swift +++ b/WebsiteGenerator/Files/Configuration.swift @@ -5,4 +5,16 @@ struct Configuration { let pageImageWidth: Int let minifyCSSandJS: Bool + + let contentPath: String + + let outputPath: String + + var contentDirectory: URL { + .init(fileURLWithPath: contentPath) + } + + var outputDirectory: URL { + .init(fileURLWithPath: outputPath) + } } diff --git a/WebsiteGenerator/main.swift b/WebsiteGenerator/main.swift index 913fc7d..0fe362a 100644 --- a/WebsiteGenerator/main.swift +++ b/WebsiteGenerator/main.swift @@ -1,29 +1,29 @@ import Foundation -private let contentDirectory = URL(fileURLWithPath: "/Users/ch/Projects/MakerSpace") -private let outputDirectory = URL(fileURLWithPath: "/Users/ch/Projects/MakerSpace/Site") let configuration = Configuration( - pageImageWidth: 748, - minifyCSSandJS: true) + pageImageWidth: <#T##Int#>, + minifyCSSandJS: <#T##Bool#>, + contentPath: <#T##String#>, + outputPath: <#T##String#>) let log = ValidationLog() -let files = FileSystem(in: contentDirectory, to: outputDirectory) +let files = FileSystem( + in: configuration.contentDirectory, + to: configuration.outputDirectory) -private let siteData: Element do { - guard let element = try Element(atRoot: contentDirectory) else { + guard let siteData = try Element(atRoot: configuration.contentDirectory) else { exit(0) } - siteData = element + + let siteGenerator = try SiteGenerator() + try siteGenerator.generate(site: siteData) } catch { print(error) exit(0) } -private let siteGenerator = try SiteGenerator() -try siteGenerator.generate(site: siteData) - files.printGeneratedPages() files.printEmptyPages() files.printDraftPages()