Skip to content

Commit 88f68c2

Browse files
Merge pull request rust-lang#7187 from andreacfromtheapp/feat-justfile
feat!: migrating from Makefile to Just
2 parents 2a83891 + 5273ee1 commit 88f68c2

File tree

3 files changed

+59
-30
lines changed

3 files changed

+59
-30
lines changed

README.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,21 @@ Use the included `new_contribs.sh` script:
187187

188188
## Building
189189

190-
To ensure consistency across development setups, we use a [Docker](https://www.docker.com) container-based
191-
workflow for building the website and email newsletter. Similarly, we use a `makefile` to ensure you have Docker installed on your system if
192-
you intend to build the website or email newsletter.
190+
To ensure consistency across development setups, we use a
191+
[Docker](https://www.docker.com) container-based workflow for building the
192+
website and email newsletter. Similarly, we use [Just](https://just.systems/) to
193+
ensure you have Docker installed on your system if you intend to build the
194+
website or email newsletter.
195+
196+
### Install Just
197+
198+
To install Just you have
199+
[many options](https://just.systems/man/en/packages.html); we recommend using
200+
Cargo:
201+
202+
```sh
203+
cargo install just
204+
```
193205

194206
### Building the website
195207

@@ -207,7 +219,7 @@ cd publishing
207219
- Run the Docker build and website local-host command:
208220

209221
```sh
210-
make website
222+
just website
211223
```
212224

213225
- View the website locally at default
@@ -237,7 +249,7 @@ cd publishing
237249
- Run the Docker build and website local-host command:
238250

239251
```sh
240-
make email
252+
just email
241253
```
242254

243255
- View the email newsletter formatting of specific posts at

publishing/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM python:3.8.16-slim
22

3-
# Must run from base `twir` directory... Makefile takes care of this.
3+
# Must run from base `twir` directory... justfile takes care of this.
44
WORKDIR /usr/twir
55

66
# Install deps and set locales
@@ -35,7 +35,7 @@ COPY plugins plugins
3535
COPY themes themes
3636
COPY pelicanconf.py pelicanconf.py
3737

38-
# make build && make generate-website && make host-website needs these scripts
38+
# just website && just email needs these scripts
3939
COPY publishing/*.sh .
4040
RUN chmod +x *.sh
4141

Lines changed: 40 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
#!/bin/sh
2-
1+
# This Week in Rust - Publishing Tools
32
# TODO: Make sure running from latest "main" branch commit
43

4+
# Show available recipes
5+
help:
6+
@just --list
7+
58
# Typical flows:
69
#
7-
# 1. `make website`
10+
# 1. `just website`
811
# 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
1013
# equivalent of running `pelican --delete-output-directory content`
1114
# from a properly instantantiated environment.
1215
#
@@ -16,62 +19,76 @@
1619
#
1720
# Output: `output-website/`
1821
#
19-
# 2. `make copy-website-contents`
22+
# 2. `just copy-website-contents`
2023
# This workflow will sync the `output-website/` directory from above, and sync
2124
# it with the directory passed to it. Used for syncing state with
2225
# this-week-in-rust.github.io repo.
2326
#
24-
# 3. `make email`
27+
# 3. `just email`
2528
# 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
2730
# equivalent of running `USE_EMAIL_THEME=1 pelican --delete-output-directory content`
2831
# from a properly instantantiated environment, and running
2932
# `juice --web-resources-images false /juice/in.html /juice/out.html` on the latest content post.
30-
#
33+
#
3134
# $ build clean generate-email optimize-email
3235
#
3336
# Output: `email/<NUMBER>-<YEAR>-<MONTH>-<DAY>-email.html`
3437
#
3538

39+
# Generate and host website locally
3640
website: generate-website host-website
41+
42+
# Copy website contents to this-week-in-rust.github.io repo
3743
copy-website-contents:
38-
@./copy_website_content_to_repo.sh
44+
./copy_website_content_to_repo.sh
45+
46+
# Generate and optimize email template
3947
email: generate-email optimize-email
4048

41-
build:
49+
# Build Docker image
50+
docker-build:
4251
cd .. && docker build -t twir -f publishing/Dockerfile . && cd -
4352

53+
# Clean website output directories
4454
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
4658
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/
4860

49-
generate-website: build clean-website
61+
# Generate website content
62+
generate-website: docker-build clean-website
5063
@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
5467
@echo "Finished generating website."
5568

69+
# Host website locally on port 8000
5670
host-website:
5771
@echo "Hosting website..."
58-
@docker run -it \
72+
docker run -it \
5973
-p 8000:8000 \
60-
-v $(shell pwd)/output-website:/usr/twir/output:ro \
74+
-v {{justfile_directory()}}/output-website:/usr/twir/output:ro \
6175
-it \
6276
twir:latest \
6377
bash run_server.sh
6478
@echo "Finished hosting website."
6579
@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'"
6781

68-
generate-email: build clean-email
82+
# Generate email content
83+
generate-email: docker-build clean-email
6984
@echo "Generating email..."
70-
@docker run -it \
85+
mkdir -p output-email-format
86+
docker run -it \
7187
-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 \
7389
twir:latest
7490

91+
# Optimize email HTML for delivery
7592
optimize-email:
7693
@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

Comments
 (0)