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
|
|
|
|
2017-05-12 14:10:21 +00:00
|
|
|
use console;
|
2016-12-06 08:27:03 +00:00
|
|
|
|
2017-12-29 18:25:06 +00:00
|
|
|
pub fn build(config_file: &str, base_url: Option<&str>, output_dir: &str) -> Result<()> {
|
2017-03-25 04:18:15 +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
|
|
|
}
|
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
|
|
|
}
|