From fd9b3794cff2bf9b56d9588aaefbab9b24f84332 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 6 May 2024 12:37:55 +0200 Subject: [PATCH] Remove unused automation code --- tools/automator/src/args.rs | 1 - tools/automator/src/blog/mod.rs | 5 +-- tools/automator/src/blog/sponsors.rs | 58 ---------------------------- tools/automator/src/blog/util.rs | 5 --- tools/automator/src/run.rs | 5 --- 5 files changed, 1 insertion(+), 73 deletions(-) delete mode 100644 tools/automator/src/blog/sponsors.rs diff --git a/tools/automator/src/args.rs b/tools/automator/src/args.rs index 31ee0123c..9eb4d3a17 100644 --- a/tools/automator/src/args.rs +++ b/tools/automator/src/args.rs @@ -14,7 +14,6 @@ impl Args { #[derive(clap::Subcommand)] pub enum Blog { Release, - SponsorUpdate, } #[derive(clap::Parser)] diff --git a/tools/automator/src/blog/mod.rs b/tools/automator/src/blog/mod.rs index 5e8b60478..bc732c847 100644 --- a/tools/automator/src/blog/mod.rs +++ b/tools/automator/src/blog/mod.rs @@ -1,7 +1,4 @@ mod release; -mod sponsors; mod util; -pub use self::{ - release::create_release_announcement, sponsors::create_sponsor_update, -}; +pub use self::release::create_release_announcement; diff --git a/tools/automator/src/blog/sponsors.rs b/tools/automator/src/blog/sponsors.rs deleted file mode 100644 index 39cb1f6c1..000000000 --- a/tools/automator/src/blog/sponsors.rs +++ /dev/null @@ -1,58 +0,0 @@ -use std::fmt::Write; - -use tokio::{fs::File, io::AsyncWriteExt}; - -use super::util; - -pub async fn create_sponsor_update() -> anyhow::Result<()> { - let month = util::now_ym(); - let date = util::now_ymd(); - - let mut file = util::create_blog_post_file("sponsors", &month).await?; - generate_update(date, month, &mut file).await?; - - Ok(()) -} - -async fn generate_update( - date: String, - month: String, - file: &mut File, -) -> anyhow::Result<()> { - let mut buf = String::new(); - write!( - buf, - "\ -+++ -title = \"Sponsor Update - {month}\" -date = {date} - -# Uncomment to generate the HTML for the email newsletter. -# template = \"newsletter/email.html\" -+++ - -Hey folks! - -I just sent out the new sponsor update! Topics this month include: - -- **TASK: Summarize sponsor update.** - -If you want to receive monthly behind-the-scenes updates too, why not support Fornjot by [becoming a sponsor](https://github.com/sponsors/hannobraun)? You can start with as little as $2 a month. More substantial contributions are also welcome, of course 😁 - -I dedicate a substantial chunk of my week to working on Fornjot. Your contribution can help make that more sustainable. - - -### Not receiving these updates? - -I've been sending out an update every month since February 2022. If you are a sponsor and haven't received those updates, maybe you are not opted in? Update your sponsorship over at GitHub, and make sure you check `Receive email updates from hannobraun`. Also make sure to check the spam folder in your email client. - -If you still haven't received an update, [please contact me](mailto:hanno@braun-odw.eu). I'm happy to send you a copy directly. - -I'm sorry for any inconvenience! Unfortunately, GitHub gives me no control over, or insight into, who is receiving those updates. -" - )?; - - file.write_all(buf.as_bytes()).await?; - - Ok(()) -} diff --git a/tools/automator/src/blog/util.rs b/tools/automator/src/blog/util.rs index a9beee4a5..aa0b00218 100644 --- a/tools/automator/src/blog/util.rs +++ b/tools/automator/src/blog/util.rs @@ -4,11 +4,6 @@ use anyhow::Context; use chrono::{Datelike, Utc}; use tokio::fs::{self, File}; -pub fn now_ym() -> String { - let now = Utc::now(); - format!("{}-{:02}", now.year(), now.month()) -} - pub fn now_ymd() -> String { let now = Utc::now(); format!("{}-{:02}-{:02}", now.year(), now.month(), now.day()) diff --git a/tools/automator/src/run.rs b/tools/automator/src/run.rs index cf111768b..3a0036b9f 100644 --- a/tools/automator/src/run.rs +++ b/tools/automator/src/run.rs @@ -26,11 +26,6 @@ pub async fn run() -> anyhow::Result<()> { .await .context("Failed to create release announcement")?; } - Args::Blog(Blog::SponsorUpdate) => { - blog::create_sponsor_update() - .await - .context("Failed to create sponsor update")?; - } Args::Sponsors(args) => { let min_dollars = 8; let sponsors = Sponsors::query(&octocrab)