| 
1 |  | -#!/bin/sh  | 
2 |  | - | 
 | 1 | +# This Week in Rust - Publishing Tools  | 
3 | 2 | # TODO: Make sure running from latest "main" branch commit  | 
4 | 3 | 
 
  | 
 | 4 | +# Show available recipes  | 
 | 5 | +help:  | 
 | 6 | +	@just --list  | 
 | 7 | + | 
5 | 8 | # Typical flows:  | 
6 | 9 | #  | 
7 |  | -# 1. `make website`  | 
 | 10 | +# 1. `just website`  | 
8 | 11 | # 	 The first workflow will generate the desired website, landing  | 
9 |  | -#    the end contents in the local "output-website/" directory. This is the   | 
 | 12 | +#    the end contents in the local "output-website/" directory. This is the  | 
10 | 13 | #    equivalent of running `pelican --delete-output-directory content`  | 
11 | 14 | #    from a properly instantantiated environment.  | 
12 | 15 | #  | 
 | 
16 | 19 | #  | 
17 | 20 | #    Output: `output-website/`  | 
18 | 21 | #  | 
19 |  | -# 2. `make copy-website-contents`  | 
 | 22 | +# 2. `just copy-website-contents`  | 
20 | 23 | #    This workflow will sync the `output-website/` directory from above, and sync  | 
21 | 24 | #    it with the directory passed to it. Used for syncing state with  | 
22 | 25 | #    this-week-in-rust.github.io repo.  | 
23 | 26 | #  | 
24 |  | -# 3. `make email`  | 
 | 27 | +# 3. `just email`  | 
25 | 28 | #    This workflow will generate the desired email template, landing  | 
26 |  | -#    the end contents in the local "email/" directory. This is the   | 
 | 29 | +#    the end contents in the local "email/" directory. This is the  | 
27 | 30 | #    equivalent of running `USE_EMAIL_THEME=1 pelican --delete-output-directory content`  | 
28 | 31 | #    from a properly instantantiated environment, and running  | 
29 | 32 | #    `juice --web-resources-images false /juice/in.html /juice/out.html` on the latest content post.  | 
30 |  | -#   | 
 | 33 | +#  | 
31 | 34 | #    $ build clean generate-email optimize-email  | 
32 | 35 | #  | 
33 | 36 | #	 Output: `email/<NUMBER>-<YEAR>-<MONTH>-<DAY>-email.html`  | 
34 | 37 | #  | 
35 | 38 | 
 
  | 
 | 39 | +# Generate and host website locally  | 
36 | 40 | website: generate-website host-website  | 
 | 41 | + | 
 | 42 | +# Copy website contents to this-week-in-rust.github.io repo  | 
37 | 43 | copy-website-contents:  | 
38 |  | -	@./copy_website_content_to_repo.sh  | 
 | 44 | +	./copy_website_content_to_repo.sh  | 
 | 45 | + | 
 | 46 | +# Generate and optimize email template  | 
39 | 47 | email: generate-email optimize-email  | 
40 | 48 | 
 
  | 
41 |  | -build:  | 
 | 49 | +# Build Docker image  | 
 | 50 | +docker-build:  | 
42 | 51 | 	cd .. && docker build -t twir -f publishing/Dockerfile . && cd -  | 
43 | 52 | 
 
  | 
 | 53 | +# Clean website output directories  | 
44 | 54 | clean-website:  | 
45 |  | -	@rm -rf output/ && rm -rf output-website/ && rm -rf juice/  | 
 | 55 | +	rm -rf output/ output-website/ juice/  | 
 | 56 | + | 
 | 57 | +# Clean email output directories  | 
46 | 58 | clean-email:  | 
47 |  | -	@rm -rf output/ && rm -rf output-email-format/ && rm -rf email/ && rm -rf juice/  | 
 | 59 | +	rm -rf output/ output-email-format/ email/ juice/  | 
48 | 60 | 
 
  | 
49 |  | -generate-website: build clean-website  | 
 | 61 | +# Generate website content  | 
 | 62 | +generate-website: docker-build clean-website  | 
50 | 63 | 	@echo "Generating website..."  | 
51 |  | -	@docker run -it \  | 
52 |  | -		-v $(shell pwd)/output-website:/usr/twir/output \  | 
53 |  | -		twir:latest   | 
 | 64 | +	docker run -it \  | 
 | 65 | +		-v {{justfile_directory()}}/output-website:/usr/twir/output \  | 
 | 66 | +		twir:latest  | 
54 | 67 | 	@echo "Finished generating website."  | 
55 | 68 | 
 
  | 
 | 69 | +# Host website locally on port 8000  | 
56 | 70 | host-website:  | 
57 | 71 | 	@echo "Hosting website..."  | 
58 |  | -	@docker run -it \  | 
 | 72 | +	docker run -it \  | 
59 | 73 | 		-p 8000:8000 \  | 
60 |  | -	 	-v $(shell pwd)/output-website:/usr/twir/output:ro \  | 
 | 74 | +	 	-v {{justfile_directory()}}/output-website:/usr/twir/output:ro \  | 
61 | 75 | 		-it \  | 
62 | 76 | 		twir:latest \  | 
63 | 77 | 		bash run_server.sh  | 
64 | 78 | 	@echo "Finished hosting website."  | 
65 | 79 | 	@echo ""  | 
66 |  | -	@echo "To sync contents with your local 'this-week-in-rust.github.io' repo, run \033[1;33m'make copy-website-contents'\033[0m"  | 
 | 80 | +	@echo "To sync contents with your local 'this-week-in-rust.github.io' repo, run 'just copy-website-contents'"  | 
67 | 81 | 
 
  | 
68 |  | -generate-email: build clean-email  | 
 | 82 | +# Generate email content  | 
 | 83 | +generate-email: docker-build clean-email  | 
69 | 84 | 	@echo "Generating email..."  | 
70 |  | -	@docker run -it \  | 
 | 85 | +	mkdir -p output-email-format  | 
 | 86 | +	docker run -it \  | 
71 | 87 | 		-e USE_EMAIL_THEME=1 \  | 
72 |  | -		-v $(shell pwd)/output-email-format:/usr/twir/output \  | 
 | 88 | +		-v {{justfile_directory()}}/output-email-format:/usr/twir/output \  | 
73 | 89 | 		twir:latest  | 
74 | 90 | 
 
  | 
 | 91 | +# Optimize email HTML for delivery  | 
75 | 92 | optimize-email:  | 
76 | 93 | 	@echo "Generating optimized email..."  | 
77 |  | -	@OUTPUT_PREFIX=output-email-format ./create_optimized_email.sh  | 
 | 94 | +	OUTPUT_PREFIX=output-email-format ./create_optimized_email.sh  | 
0 commit comments