Skip to content

Commit 265ca48

Browse files
committed
Remove old static site generator
1 parent 3271cc9 commit 265ca48

File tree

11 files changed

+228
-3573
lines changed

11 files changed

+228
-3573
lines changed

Cargo.lock

Lines changed: 172 additions & 2885 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,3 @@
11
[workspace]
2-
members = ["front_matter", "serve"]
3-
4-
[workspace.package]
5-
edition = "2024"
6-
7-
[workspace.dependencies]
8-
blog = { path = "." }
9-
chrono = "=0.4.40"
10-
color-eyre = "=0.6.3"
11-
comrak = "=0.37.0"
12-
eyre = "=0.6.12"
13-
front_matter = { path = "front_matter" }
14-
insta = "=1.42.2"
15-
rayon = "=1.10.0"
16-
regex = "=1.11.1"
17-
sass-rs = "=0.2.2"
18-
serde_json = "=1.0.140"
19-
serde = "=1.0.219"
20-
tera = "=1.20.0"
21-
tokio = "=1.44.1"
22-
toml = "=0.8.20"
23-
warpy = "=0.3.68"
24-
25-
[package]
26-
name = "blog"
27-
version = "0.1.0"
28-
edition.workspace = true
29-
authors = ["The Rust Project Developers"]
30-
31-
[dependencies]
32-
chrono.workspace = true
33-
color-eyre.workspace = true
34-
comrak = { workspace = true, features = ["bon"] }
35-
eyre.workspace = true
36-
front_matter.workspace = true
37-
rayon.workspace = true
38-
regex.workspace = true
39-
sass-rs.workspace = true
40-
serde_json.workspace = true
41-
serde = { workspace = true, features = ["derive"] }
42-
tera.workspace = true
43-
toml.workspace = true
44-
45-
[dev-dependencies]
46-
insta = { workspace = true, features = ["filters", "glob"] }
2+
resolver = "3"
3+
members = ["front_matter", "snapshot"]

front_matter/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[package]
22
name = "front_matter"
33
version = "0.1.0"
4-
edition.workspace = true
4+
edition = "2024"
55

66
[dependencies]
7-
eyre.workspace = true
8-
serde = { workspace = true, features = ["derive"] }
9-
toml.workspace = true
7+
eyre = "=0.6.12"
8+
serde = { version = "=1.0.219", features = ["derive"] }
9+
toml = "=0.8.20"

serve/Cargo.toml

Lines changed: 0 additions & 9 deletions
This file was deleted.

serve/src/main.rs

Lines changed: 0 additions & 18 deletions
This file was deleted.

snapshot/Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[package]
2+
name = "snapshot"
3+
version = "0.1.0"
4+
edition = "2024"
5+
6+
[dev-dependencies]
7+
insta = { version = "=1.42.2", features = ["filters", "glob"] }

snapshot/src/lib.rs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#[test]
2+
fn snapshot() {
3+
std::env::set_current_dir(concat!(env!("CARGO_MANIFEST_DIR"), "/..")).unwrap();
4+
let _ = std::fs::remove_dir_all("public");
5+
let status = std::process::Command::new("zola")
6+
.arg("build")
7+
.status()
8+
.unwrap();
9+
assert!(status.success(), "failed to build site");
10+
11+
let timestamped_files = ["releases.json", "feed.xml"];
12+
let inexplicably_non_deterministic_files = ["images/2023-08-rust-survey-2022/experiences.png"];
13+
insta::glob!("../..", "public/**/*", |path| {
14+
if path.is_dir() {
15+
return;
16+
}
17+
let path = path.display().to_string();
18+
if timestamped_files
19+
.into_iter()
20+
.chain(inexplicably_non_deterministic_files)
21+
.any(|f| path.ends_with(f))
22+
{
23+
// Skip troublesome files, e.g. they might contain timestamps.
24+
// If possible, they are tested separately below.
25+
return;
26+
}
27+
let content = std::fs::read(path).unwrap();
28+
// insta can't deal with non-utf8 strings?
29+
let content = String::from_utf8_lossy(&content).into_owned();
30+
insta::assert_snapshot!(content);
31+
});
32+
33+
// test files with timestamps filtered
34+
insta::with_settings!({filters => vec![
35+
(r"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\+\d{2}:\d{2}", "(filtered timestamp)"),
36+
]}, {
37+
for file in timestamped_files {
38+
let content = std::fs::read(format!("public/{file}")).unwrap();
39+
let content = String::from_utf8_lossy(&content).into_owned();
40+
insta::assert_snapshot!(content);
41+
}
42+
});
43+
}

src/bin/blog.rs

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/blogs.rs

Lines changed: 0 additions & 161 deletions
This file was deleted.

0 commit comments

Comments
 (0)