Improve overview of modified pages
This commit is contained in:
parent
6a2d63462e
commit
d1c418af3e
@ -76,6 +76,11 @@ final class FileSystem {
|
|||||||
*/
|
*/
|
||||||
private var imageTasks: [String : ImageOutput] = [:]
|
private var imageTasks: [String : ImageOutput] = [:]
|
||||||
|
|
||||||
|
/**
|
||||||
|
The paths to all pages which were changed
|
||||||
|
*/
|
||||||
|
private var generatedPages: Set<String> = []
|
||||||
|
|
||||||
init(in input: URL, to output: URL) {
|
init(in input: URL, to output: URL) {
|
||||||
self.input = input
|
self.input = input
|
||||||
self.output = output
|
self.output = output
|
||||||
@ -474,6 +479,21 @@ final class FileSystem {
|
|||||||
pagePaths[id]
|
pagePaths[id]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func generated(page: String) {
|
||||||
|
generatedPages.insert(page)
|
||||||
|
}
|
||||||
|
|
||||||
|
func printGeneratedPages() {
|
||||||
|
guard !generatedPages.isEmpty else {
|
||||||
|
print("No pages modified")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
print("\(generatedPages.count) pages modified")
|
||||||
|
for page in generatedPages.sorted() {
|
||||||
|
print(" " + page)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// MARK: Writing files
|
// MARK: Writing files
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ struct IndexPageGenerator {
|
|||||||
guard factory.page.generate(content, to: pageUrl) else {
|
guard factory.page.generate(content, to: pageUrl) else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.add(info: "Page generated", source: path)
|
files.generated(page: path)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func makeHeader(page: Element, metadata: Element.LocalizedMetadata, language: String) -> String {
|
private func makeHeader(page: Element, metadata: Element.LocalizedMetadata, language: String) -> String {
|
||||||
|
@ -29,7 +29,7 @@ struct OverviewPageGenerator {
|
|||||||
guard factory.page.generate(content, to: url) else {
|
guard factory.page.generate(content, to: url) else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.add(info: "Page generated", source: path)
|
files.generated(page: path)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func makeContent(section: Element, language: String) -> String {
|
private func makeContent(section: Element, language: String) -> String {
|
||||||
|
@ -57,7 +57,7 @@ struct PageGenerator {
|
|||||||
guard factory.page.generate(content, to: url) else {
|
guard factory.page.generate(content, to: url) else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.add(info: "Page generated", source: path)
|
files.generated(page: path)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func makeContent(page: Element, language: String, path: String) -> (content: String, includesCode: Bool)? {
|
private func makeContent(page: Element, language: String, path: String) -> (content: String, includesCode: Bool)? {
|
||||||
|
@ -22,11 +22,11 @@ do {
|
|||||||
private let siteGenerator = try SiteGenerator()
|
private let siteGenerator = try SiteGenerator()
|
||||||
try siteGenerator.generate(site: siteData)
|
try siteGenerator.generate(site: siteData)
|
||||||
|
|
||||||
print("Pages generated\n")
|
files.printGeneratedPages()
|
||||||
files.createImages()
|
|
||||||
files.printEmptyPages()
|
files.printEmptyPages()
|
||||||
files.printDraftPages()
|
files.printDraftPages()
|
||||||
|
|
||||||
|
files.createImages()
|
||||||
print("Images generated")
|
print("Images generated")
|
||||||
files.copyRequiredFiles()
|
files.copyRequiredFiles()
|
||||||
print("Required files copied")
|
|
||||||
files.writeHashes()
|
files.writeHashes()
|
||||||
|
Loading…
Reference in New Issue
Block a user