2017-03-14 12:25:45 +00:00
|
|
|
use std::env;
|
|
|
|
|
2017-07-01 07:47:41 +00:00
|
|
|
use errors::Result;
|
|
|
|
use site::Site;
|
2016-12-13 06:22:24 +00:00
|
|
|
|
2019-12-21 21:52:39 +00:00
|
|
|
use crate::console;
|
2016-12-06 08:27:03 +00:00
|
|
|
|
2019-08-24 20:23:08 +00:00
|
|
|
pub fn build(
|
|
|
|
config_file: &str,
|
|
|
|
base_url: Option<&str>,
|
|
|
|
output_dir: &str,
|
|
|
|
include_drafts: bool,
|
|
|
|
) -> Result<()> {
|
2019-04-20 10:50:34 +00:00
|
|
|
let mut site = Site::new(env::current_dir().unwrap(), config_file)?;
|
2017-12-29 18:25:06 +00:00
|
|
|
site.set_output_path(output_dir);
|
2017-10-05 01:56:13 +00:00
|
|
|
if let Some(b) = base_url {
|
2018-09-10 18:29:57 +00:00
|
|
|
site.set_base_url(b.to_string());
|
2017-10-05 01:56:13 +00:00
|
|
|
}
|
2019-08-24 20:23:08 +00:00
|
|
|
if include_drafts {
|
|
|
|
site.include_drafts();
|
|
|
|
}
|
2017-03-21 07:57:00 +00:00
|
|
|
site.load()?;
|
2017-05-12 14:10:21 +00:00
|
|
|
console::notify_site_size(&site);
|
|
|
|
console::warn_about_ignored_pages(&site);
|
2017-03-20 10:00:00 +00:00
|
|
|
site.build()
|
2016-12-13 09:05:59 +00:00
|
|
|
}
|