You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
593B

  1. use std::env;
  2. use std::path::PathBuf;
  3. use errors::Result;
  4. use site::Site;
  5. use console;
  6. pub fn build(
  7. config_file: &str,
  8. base_path: Option<&str>,
  9. base_url: Option<&str>,
  10. output_dir: &str,
  11. ) -> Result<()> {
  12. let bp = base_path.map(PathBuf::from).unwrap_or(env::current_dir().unwrap());
  13. let mut site = Site::new(bp, config_file)?;
  14. site.set_output_path(output_dir);
  15. if let Some(b) = base_url {
  16. site.set_base_url(b.to_string());
  17. }
  18. site.load()?;
  19. console::notify_site_size(&site);
  20. console::warn_about_ignored_pages(&site);
  21. site.build()
  22. }