Add paths to configuration
This commit is contained in:
parent
cfb68f5237
commit
28623d1209
@ -5,4 +5,16 @@ struct Configuration {
|
|||||||
let pageImageWidth: Int
|
let pageImageWidth: Int
|
||||||
|
|
||||||
let minifyCSSandJS: Bool
|
let minifyCSSandJS: Bool
|
||||||
|
|
||||||
|
let contentPath: String
|
||||||
|
|
||||||
|
let outputPath: String
|
||||||
|
|
||||||
|
var contentDirectory: URL {
|
||||||
|
.init(fileURLWithPath: contentPath)
|
||||||
|
}
|
||||||
|
|
||||||
|
var outputDirectory: URL {
|
||||||
|
.init(fileURLWithPath: outputPath)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,29 +1,29 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
private let contentDirectory = URL(fileURLWithPath: "/Users/ch/Projects/MakerSpace")
|
|
||||||
private let outputDirectory = URL(fileURLWithPath: "/Users/ch/Projects/MakerSpace/Site")
|
|
||||||
|
|
||||||
let configuration = Configuration(
|
let configuration = Configuration(
|
||||||
pageImageWidth: 748,
|
pageImageWidth: <#T##Int#>,
|
||||||
minifyCSSandJS: true)
|
minifyCSSandJS: <#T##Bool#>,
|
||||||
|
contentPath: <#T##String#>,
|
||||||
|
outputPath: <#T##String#>)
|
||||||
|
|
||||||
let log = ValidationLog()
|
let log = ValidationLog()
|
||||||
let files = FileSystem(in: contentDirectory, to: outputDirectory)
|
let files = FileSystem(
|
||||||
|
in: configuration.contentDirectory,
|
||||||
|
to: configuration.outputDirectory)
|
||||||
|
|
||||||
private let siteData: Element
|
|
||||||
do {
|
do {
|
||||||
guard let element = try Element(atRoot: contentDirectory) else {
|
guard let siteData = try Element(atRoot: configuration.contentDirectory) else {
|
||||||
exit(0)
|
exit(0)
|
||||||
}
|
}
|
||||||
siteData = element
|
|
||||||
|
let siteGenerator = try SiteGenerator()
|
||||||
|
try siteGenerator.generate(site: siteData)
|
||||||
} catch {
|
} catch {
|
||||||
print(error)
|
print(error)
|
||||||
exit(0)
|
exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
private let siteGenerator = try SiteGenerator()
|
|
||||||
try siteGenerator.generate(site: siteData)
|
|
||||||
|
|
||||||
files.printGeneratedPages()
|
files.printGeneratedPages()
|
||||||
files.printEmptyPages()
|
files.printEmptyPages()
|
||||||
files.printDraftPages()
|
files.printDraftPages()
|
||||||
|
Loading…
Reference in New Issue
Block a user