From 7945716d1a997b7fb4cbfee10ff11042539dbe67 Mon Sep 17 00:00:00 2001 From: Christian Jansen Date: Tue, 9 Dec 2025 15:14:24 -0500 Subject: [PATCH 1/4] Update justfile --- publishing/justfile | 59 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 46 insertions(+), 13 deletions(-) diff --git a/publishing/justfile b/publishing/justfile index 030228194..dd19eb971 100644 --- a/publishing/justfile +++ b/publishing/justfile @@ -36,19 +36,21 @@ help: # Output: `email/----email.html` # +default-container-engine := "docker" + # Generate and host website locally -website: generate-website host-website +website container-engine=default-container-engine: (generate-website container-engine) (host-website container-engine) # Copy website contents to this-week-in-rust.github.io repo copy-website-contents: ./copy_website_content_to_repo.sh # Generate and optimize email template -email: generate-email optimize-email +email container-engine=default-container-engine: (generate-email container-engine) optimize-email -# Build Docker image -docker-build: - cd .. && docker build -t twir -f publishing/Dockerfile . && cd - +# Build container engine image (Docker by default) +container-build container-engine=default-container-engine: + cd .. && {{container-engine}} build -t twir -f publishing/Dockerfile . && cd - # Clean website output directories clean-website: @@ -59,17 +61,18 @@ clean-email: rm -rf output/ output-email-format/ email/ juice/ # Generate website content -generate-website: docker-build clean-website +generate-website container-engine=default-container-engine: (container-build container-engine) clean-website @echo "Generating website..." - docker run -it \ + mkdir -p output-website + {{container-engine}} run -it \ -v {{justfile_directory()}}/output-website:/usr/twir/output \ twir:latest @echo "Finished generating website." # Host website locally on port 8000 -host-website: +host-website container-engine=default-container-engine: @echo "Hosting website..." - docker run -it \ + {{container-engine}} run -it \ -p 8000:8000 \ -v {{justfile_directory()}}/output-website:/usr/twir/output:ro \ -it \ @@ -80,15 +83,45 @@ host-website: @echo "To sync contents with your local 'this-week-in-rust.github.io' repo, run 'just copy-website-contents'" # Generate email content -generate-email: docker-build clean-email +generate-email container-engine=default-container-engine: (container-build container-engine) clean-email @echo "Generating email..." mkdir -p output-email-format - docker run -it \ + {{container-engine}} run -it \ -e USE_EMAIL_THEME=1 \ -v {{justfile_directory()}}/output-email-format:/usr/twir/output \ twir:latest # Optimize email HTML for delivery optimize-email: - @echo "Generating optimized email..." - OUTPUT_PREFIX=output-email-format ./create_optimized_email.sh + #!/bin/bash + + echo "Generating optimized email..." + + OUTPUT_PREFIX="output-email-format" + + source utils.sh + + LOCAL_EMAIL_PREFIX="email/${LATEST_ISSUE_NUMBER}-${LATEST_YEAR}-${LATEST_MONTH}-${LATEST_DAY}" + echo "Creating email for ${LATEST_ISSUE_NUMBER}-${LATEST_YEAR}-${LATEST_MONTH}-${LATEST_DAY}" + + # Prepare email directory + mkdir -p email + rm -f ${LOCAL_EMAIL_PREFIX}-in.html + cp ${LATEST_ISSUE_FULL_PATH} ${LOCAL_EMAIL_PREFIX}-in.html + + podman run \ + -v $(pwd)/email:/usr/twir/email \ + -e LOCAL_EMAIL_PREFIX=${LOCAL_EMAIL_PREFIX} \ + twir:latest \ + bash create_html_friendly_page.sh + + rm ${LOCAL_EMAIL_PREFIX}-in.html + + printf "\n\n${CYAN_FONT}*****${PURPLE_FONT}*****${CYAN_FONT}*****${PURPLE_FONT}*****${NC}" + printf "\n${CYAN_FONT}*****${PURPLE_FONT}*****${CYAN_FONT}*****${PURPLE_FONT}*****${NC}" + printf "\n${CYAN_FONT}*****${PURPLE_FONT}*****${CYAN_FONT}*****${PURPLE_FONT}*****${NC}" + printf "\n📧 HEY TWiR PUBLISHER..." + printf "\nLatest email template found at: ${YELLOW_FONT}'$(pwd)/${LOCAL_EMAIL_PREFIX}-email.html'${NC}" + printf "\n${CYAN_FONT}*****${PURPLE_FONT}*****${CYAN_FONT}*****${PURPLE_FONT}*****${NC}" + printf "\n${CYAN_FONT}*****${PURPLE_FONT}*****${CYAN_FONT}*****${PURPLE_FONT}*****${NC}" + printf "\n${CYAN_FONT}*****${PURPLE_FONT}*****${CYAN_FONT}*****${PURPLE_FONT}*****${NC}\n\n" From 3541d5225c766063aeb5e13f6ef642d9b801e4e7 Mon Sep 17 00:00:00 2001 From: Christian Jansen Date: Tue, 9 Dec 2025 15:46:02 -0500 Subject: [PATCH 2/4] Added script attribute Added the unstable `script` attribute to the `optimize-email` recipe. This should allow compatibility with WSL environments where shebang recipes struggle due to `noexec` directories. --- publishing/justfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/publishing/justfile b/publishing/justfile index dd19eb971..2c6ebb9d8 100644 --- a/publishing/justfile +++ b/publishing/justfile @@ -36,6 +36,8 @@ help: # Output: `email/----email.html` # +set unstable + default-container-engine := "docker" # Generate and host website locally @@ -92,11 +94,9 @@ generate-email container-engine=default-container-engine: (container-build conta twir:latest # Optimize email HTML for delivery +[script("bash")] optimize-email: - #!/bin/bash - echo "Generating optimized email..." - OUTPUT_PREFIX="output-email-format" source utils.sh From 1b3c8000035b3f7bf96e0f0dd098ca9108c66999 Mon Sep 17 00:00:00 2001 From: Christian Jansen Date: Tue, 9 Dec 2025 15:51:23 -0500 Subject: [PATCH 3/4] Removed optimize email script Removed the script to generate the optimized email (`create_optimized_email.sh`) since it got inlined into the `justfile` --- publishing/create_optimized_email.sh | 28 ---------------------------- 1 file changed, 28 deletions(-) delete mode 100755 publishing/create_optimized_email.sh diff --git a/publishing/create_optimized_email.sh b/publishing/create_optimized_email.sh deleted file mode 100755 index 12a346fca..000000000 --- a/publishing/create_optimized_email.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -source utils.sh - -LOCAL_EMAIL_PREFIX="email/${LATEST_ISSUE_NUMBER}-${LATEST_YEAR}-${LATEST_MONTH}-${LATEST_DAY}" -echo "Creating email for ${LATEST_ISSUE_NUMBER}-${LATEST_YEAR}-${LATEST_MONTH}-${LATEST_DAY}" - -# Prepare email directory -mkdir -p email -rm -f ${LOCAL_EMAIL_PREFIX}-in.html -cp ${LATEST_ISSUE_FULL_PATH} ${LOCAL_EMAIL_PREFIX}-in.html - -docker run \ - -v $(pwd)/email:/usr/twir/email \ - -e LOCAL_EMAIL_PREFIX=${LOCAL_EMAIL_PREFIX} \ - twir:latest \ - bash create_html_friendly_page.sh - -rm ${LOCAL_EMAIL_PREFIX}-in.html - -printf "\n\n${CYAN_FONT}*****${PURPLE_FONT}*****${CYAN_FONT}*****${PURPLE_FONT}*****${NC}" -printf "\n${CYAN_FONT}*****${PURPLE_FONT}*****${CYAN_FONT}*****${PURPLE_FONT}*****${NC}" -printf "\n${CYAN_FONT}*****${PURPLE_FONT}*****${CYAN_FONT}*****${PURPLE_FONT}*****${NC}" -printf "\n📧 HEY TWiR PUBLISHER..." -printf "\nLatest email template found at: ${YELLOW_FONT}'$(pwd)/${LOCAL_EMAIL_PREFIX}-email.html'${NC}" -printf "\n${CYAN_FONT}*****${PURPLE_FONT}*****${CYAN_FONT}*****${PURPLE_FONT}*****${NC}" -printf "\n${CYAN_FONT}*****${PURPLE_FONT}*****${CYAN_FONT}*****${PURPLE_FONT}*****${NC}" -printf "\n${CYAN_FONT}*****${PURPLE_FONT}*****${CYAN_FONT}*****${PURPLE_FONT}*****${NC}\n\n" From 573494e0398c2bcf514e620e3d85063563b5d26e Mon Sep 17 00:00:00 2001 From: Christian Jansen Date: Tue, 9 Dec 2025 16:01:29 -0500 Subject: [PATCH 4/4] Added parameter to optimize email recipe --- publishing/justfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/publishing/justfile b/publishing/justfile index 2c6ebb9d8..3dd490ddb 100644 --- a/publishing/justfile +++ b/publishing/justfile @@ -48,7 +48,7 @@ copy-website-contents: ./copy_website_content_to_repo.sh # Generate and optimize email template -email container-engine=default-container-engine: (generate-email container-engine) optimize-email +email container-engine=default-container-engine: (generate-email container-engine) (optimize-email container-engine) # Build container engine image (Docker by default) container-build container-engine=default-container-engine: @@ -95,7 +95,7 @@ generate-email container-engine=default-container-engine: (container-build conta # Optimize email HTML for delivery [script("bash")] -optimize-email: +optimize-email container-engine=default-container-engine: echo "Generating optimized email..." OUTPUT_PREFIX="output-email-format" @@ -109,7 +109,7 @@ optimize-email: rm -f ${LOCAL_EMAIL_PREFIX}-in.html cp ${LATEST_ISSUE_FULL_PATH} ${LOCAL_EMAIL_PREFIX}-in.html - podman run \ + {{container-engine}} run \ -v $(pwd)/email:/usr/twir/email \ -e LOCAL_EMAIL_PREFIX=${LOCAL_EMAIL_PREFIX} \ twir:latest \