| @@ -8,7 +8,6 @@ use std::{ |
| use chrono::{DateTime, SecondsFormat, Utc}; |
| use sha2::{Digest, Sha256}; |
| |
| -use flate2::{Compression, write::GzEncoder}; |
| use indicatif::{MultiProgress, ProgressBar, ProgressStyle}; |
| use miette::{IntoDiagnostic, Result}; |
| use pulldown_cmark::{Event, Options, Parser, Tag, TagEnd, html}; |
| @@ -19,7 +18,7 @@ use tokio::task::JoinSet; |
| use tracing::warn; |
| |
| use crate::{ |
| - builders::LogEvent, changelog::ChangelogExtractor, config::AbbayeConfig, |
| + builders::LogEvent, changelog::ChangelogExtractor, config::AbbayeConfig, utils, |
| version_extractors::VersionInfo, |
| }; |
| |
| @@ -28,6 +27,8 @@ pub const TEMPLATE_VERSION_INDEX: &str = include_str!("templates/version_index.h |
| pub const SITE_CSS: &str = include_str!("templates/site.css"); |
| const ATOM_FEED_FILENAME: &str = "releases.atom"; |
| |
| +const SPINNER_CHARS: &str = "β β β Ήβ Έβ Όβ ΄β ¦β §β β "; |
| + |
| // ββ Types βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ |
| |
| /// A version entry as passed to Tera templates. |
| @@ -238,7 +239,7 @@ pub async fn build_site(config: AbbayeConfig) -> Result<()> { |
| pb.set_style( |
| ProgressStyle::with_template("{spinner:.bold} {prefix} {msg}") |
| .expect("valid template") |
| - .tick_chars("β β β Ήβ Έβ Όβ ΄β ¦β §β β "), |
| + .tick_chars(SPINNER_CHARS), |
| ); |
| pb.set_prefix(colored_prefix); |
| pb.set_message("startingβ¦"); |
| @@ -272,7 +273,7 @@ pub async fn build_site(config: AbbayeConfig) -> Result<()> { |
| child_pb.set_style( |
| ProgressStyle::with_template(" {spinner:.bold} {prefix} {msg}") |
| .expect("valid template") |
| - .tick_chars("β β β Ήβ Έβ Όβ ΄β ¦β §β β "), |
| + .tick_chars(SPINNER_CHARS), |
| ); |
| child_pb.set_prefix(format!("{child_color}[{label}]{RESET}")); |
| child_pb.set_message("startingβ¦"); |
| @@ -461,7 +462,7 @@ pub async fn build_site(config: AbbayeConfig) -> Result<()> { |
| let tarball = version_dir.join("docs.tar.gz"); |
| let docs_dir_c = docs_dir.clone(); |
| let tarball_c = tarball.clone(); |
| - tokio::task::spawn_blocking(move || archive_dir(&docs_dir_c, &tarball_c)) |
| + tokio::task::spawn_blocking(move || utils::archive_dir(&docs_dir_c, &tarball_c)) |
| .await |
| .into_diagnostic()??; |
| |
| @@ -726,27 +727,6 @@ fn copy_dir_recursive( |
| }) |
| } |
| |
| -/// Pack `src` directory into a `.tar.gz` archive at `dest`. |
| -/// |
| -/// The top-level entry inside the archive is named after the source directory. |
| -fn archive_dir(src: &Path, dest: &Path) -> Result<()> { |
| - let dir_name = src |
| - .file_name() |
| - .map(|n| n.to_string_lossy().into_owned()) |
| - .unwrap_or_else(|| "docs".to_owned()); |
| - |
| - let file = std::fs::File::create(dest).into_diagnostic()?; |
| - let enc = GzEncoder::new(file, Compression::default()); |
| - let mut archive = tar::Builder::new(enc); |
| - archive.append_dir_all(&dir_name, src).into_diagnostic()?; |
| - archive |
| - .into_inner() |
| - .into_diagnostic()? |
| - .finish() |
| - .into_diagnostic()?; |
| - Ok(()) |
| -} |
| - |
| /// Compare two version strings, preferring semver ordering and falling back |
| /// to lexicographic comparison for non-semver strings (e.g. git describe output). |
| fn strip_v(s: &str) -> &str { |