mirror of
https://github.com/zyllian/zyllian.github.io.git
synced 2025-05-09 10:06:42 -07:00
update dependencies
This commit is contained in:
parent
75360cee6d
commit
8e3bdc5a10
3 changed files with 412 additions and 387 deletions
684
Cargo.lock
generated
684
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
19
Cargo.toml
19
Cargo.toml
|
@ -8,20 +8,25 @@ anyhow = "1"
|
|||
extract-frontmatter = "4"
|
||||
fs_extra = "1.2"
|
||||
futures = { version = "0.3", optional = true }
|
||||
grass = { version = "0.12", default-features = false }
|
||||
grass = { version = "0.13", default-features = false }
|
||||
gray_matter = "0.2"
|
||||
handlebars = "4.1"
|
||||
hotwatch = { version = "0.4", optional = true }
|
||||
itertools = "0.10"
|
||||
lol_html = "0.3"
|
||||
minifier = { version = "0.2", features = ["html"] }
|
||||
hotwatch = { version = "0.5", optional = true }
|
||||
itertools = "0.11"
|
||||
lol_html = "1"
|
||||
minifier = { version = "0.3", features = ["html"] }
|
||||
percent-encoding = { version = "2", optional = true }
|
||||
pulldown-cmark = { version = "0.9", default-features = false, features = ["simd"] }
|
||||
pulldown-cmark = { version = "0.9", default-features = false, features = [
|
||||
"simd",
|
||||
] }
|
||||
rss = { version = "2", features = ["validation"] }
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_yaml = "0.9"
|
||||
time = { version = "0.3", features = ["serde-human-readable"] }
|
||||
tokio = { version = "1.10", features = ["macros", "rt-multi-thread"], optional = true }
|
||||
tokio = { version = "1.10", features = [
|
||||
"macros",
|
||||
"rt-multi-thread",
|
||||
], optional = true }
|
||||
url = { version = "2.2", features = ["serde"] }
|
||||
walkdir = "2"
|
||||
warp = { version = "0.3", optional = true }
|
||||
|
|
|
@ -9,7 +9,7 @@ use std::{
|
|||
|
||||
use anyhow::Context;
|
||||
use futures::SinkExt;
|
||||
use hotwatch::{Event, Hotwatch};
|
||||
use hotwatch::{EventKind, Hotwatch};
|
||||
use warp::{
|
||||
hyper::StatusCode,
|
||||
path::FullPath,
|
||||
|
@ -157,50 +157,64 @@ impl Site {
|
|||
.watch(site.site_path.clone(), move |event| {
|
||||
let peers = hw_peers.clone();
|
||||
|
||||
match (|| match event {
|
||||
Event::Write(path) => {
|
||||
if skip_path(&builder, &path) {
|
||||
Ok(false)
|
||||
} else {
|
||||
let rel = rel(&path, &builder.site.site_path)?;
|
||||
println!("CHANGED - {:?}", rel);
|
||||
create(&mut builder, &path, &rel, true)?;
|
||||
Ok::<_, anyhow::Error>(true)
|
||||
match (|| {
|
||||
let path = event
|
||||
.paths
|
||||
.first()
|
||||
.expect("Should always be at least one path");
|
||||
match event.kind {
|
||||
EventKind::Modify(_) => {
|
||||
if skip_path(&builder, path) {
|
||||
Ok(false)
|
||||
} else {
|
||||
let relp = rel(path, &builder.site.site_path)?;
|
||||
if event.paths.len() > 1 {
|
||||
let new = event.paths.last().expect("Can never fail");
|
||||
let new_rel = rel(new, &builder.site.site_path)?;
|
||||
println!("RENAMED - {:?} -> {:?}", relp, new_rel);
|
||||
create(&mut builder, new, &new_rel, false)?;
|
||||
remove(&mut builder, path, &relp)?;
|
||||
} else {
|
||||
println!("CHANGED - {:?}", relp);
|
||||
create(&mut builder, path, &relp, true)?;
|
||||
}
|
||||
Ok::<_, anyhow::Error>(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
Event::Create(path) => {
|
||||
if skip_path(&builder, &path) {
|
||||
Ok(false)
|
||||
} else {
|
||||
let rel = rel(&path, &builder.site.site_path)?;
|
||||
println!("CREATED - {:?}", rel);
|
||||
create(&mut builder, &path, &rel, true)?;
|
||||
Ok(true)
|
||||
EventKind::Create(_) => {
|
||||
if skip_path(&builder, path) {
|
||||
Ok(false)
|
||||
} else {
|
||||
let rel = rel(path, &builder.site.site_path)?;
|
||||
println!("CREATED - {:?}", rel);
|
||||
create(&mut builder, path, &rel, true)?;
|
||||
Ok(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
Event::Remove(path) => {
|
||||
if skip_path(&builder, &path) {
|
||||
Ok(false)
|
||||
} else {
|
||||
let rel = rel(&path, &builder.site.site_path)?;
|
||||
println!("REMOVED - {:?}", rel);
|
||||
remove(&mut builder, &path, &rel)?;
|
||||
Ok(true)
|
||||
EventKind::Remove(_) => {
|
||||
if skip_path(&builder, path) {
|
||||
Ok(false)
|
||||
} else {
|
||||
let rel = rel(path, &builder.site.site_path)?;
|
||||
println!("REMOVED - {:?}", rel);
|
||||
remove(&mut builder, path, &rel)?;
|
||||
Ok(true)
|
||||
}
|
||||
}
|
||||
// EventKind::(old, new) => {
|
||||
// if skip_path(&builder, &old) && skip_path(&builder, &new) {
|
||||
// Ok(false)
|
||||
// } else {
|
||||
// let old_rel = rel(&old, &builder.site.site_path)?;
|
||||
// let new_rel = rel(&new, &builder.site.site_path)?;
|
||||
// println!("RENAMED - {:?} -> {:?}", old_rel, new_rel);
|
||||
// create(&mut builder, &new, &new_rel, false)?;
|
||||
// remove(&mut builder, &old, &old_rel)?;
|
||||
// Ok(true)
|
||||
// }
|
||||
// }
|
||||
_ => Ok(false),
|
||||
}
|
||||
Event::Rename(old, new) => {
|
||||
if skip_path(&builder, &old) && skip_path(&builder, &new) {
|
||||
Ok(false)
|
||||
} else {
|
||||
let old_rel = rel(&old, &builder.site.site_path)?;
|
||||
let new_rel = rel(&new, &builder.site.site_path)?;
|
||||
println!("RENAMED - {:?} -> {:?}", old_rel, new_rel);
|
||||
create(&mut builder, &new, &new_rel, false)?;
|
||||
remove(&mut builder, &old, &old_rel)?;
|
||||
Ok(true)
|
||||
}
|
||||
}
|
||||
_ => Ok(false),
|
||||
})() {
|
||||
Ok(reload) => {
|
||||
if reload {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue