Merge pull request #496 from maghoff/next

Ensure root output directory exists explicitly.
This commit is contained in:
Vincent Prouillet 2018-10-22 22:32:02 +02:00 committed by GitHub
commit 2e84409c51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 2 deletions

View file

@ -565,6 +565,7 @@ impl Site {
} }
pub fn render_aliases(&self) -> Result<()> { pub fn render_aliases(&self) -> Result<()> {
ensure_directory_exists(&self.output_path)?;
for (_, page) in self.library.pages() { for (_, page) in self.library.pages() {
for alias in &page.meta.aliases { for alias in &page.meta.aliases {
let mut output_path = self.output_path.to_path_buf(); let mut output_path = self.output_path.to_path_buf();

View file

@ -19,7 +19,7 @@ fn can_parse_site() {
site.load().unwrap(); site.load().unwrap();
// Correct number of pages (sections are pages too) // Correct number of pages (sections are pages too)
assert_eq!(site.library.pages().len(), 15); assert_eq!(site.library.pages().len(), 16);
let posts_path = path.join("content").join("posts"); let posts_path = path.join("content").join("posts");
// Make sure the page with a url doesn't have any sections // Make sure the page with a url doesn't have any sections
@ -41,7 +41,7 @@ fn can_parse_site() {
let posts_section = site.library.get_section(&posts_path.join("_index.md")).unwrap(); let posts_section = site.library.get_section(&posts_path.join("_index.md")).unwrap();
assert_eq!(posts_section.subsections.len(), 1); assert_eq!(posts_section.subsections.len(), 1);
assert_eq!(posts_section.pages.len(), 7); assert_eq!(posts_section.pages.len(), 8);
assert_eq!(posts_section.ancestors, vec![*site.library.get_section_key(&index_section.file.path).unwrap()]); assert_eq!(posts_section.ancestors, vec![*site.library.get_section_key(&index_section.file.path).unwrap()]);
// Make sure we remove all the pwd + content from the sections // Make sure we remove all the pwd + content from the sections

View file

@ -0,0 +1,8 @@
+++
title = "Top level alias"
description = ""
date = 2017-01-01
aliases = ["top-level.html"]
+++
Simple page