Skip to content

Commit b421998

Browse files
committed
add a Justfile, move some scripts to that file
Definitely nicer than having a bunch of scripts lying around.
1 parent 598ca0f commit b421998

File tree

6 files changed

+31
-35
lines changed

6 files changed

+31
-35
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ jobs:
2525
run: cargo clippy --all-features --all-targets
2626
- name: Lint (rustfmt)
2727
run: cargo xfmt --check
28-
- name: Install cargo readme
28+
- name: Install cargo readme and just
2929
uses: taiki-e/install-action@8484225d9734e230a8bf38421a4ffec1cc249372 # v2
3030
with:
31-
tool: cargo-readme
32-
- name: Run cargo readme
33-
run: ./scripts/regenerate-readmes.sh
31+
tool: cargo-readme,just
32+
- name: Generate readmes
33+
run: just generate-readmes
3434
- name: Check for differences
3535
run: git diff --exit-code
3636

.github/workflows/docs.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
1515
- uses: dtolnay/rust-toolchain@stable
16-
- name: Build rustdocs
17-
run: ./scripts/build-docs.sh
16+
- uses: taiki-e/install-action@just
17+
- name: Build rustdoc
18+
run: just rustdoc
1819
- name: Organize
1920
run: |
2021
rm -rf target/gh-pages

Justfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Print a help message.
2+
help:
3+
just --list
4+
5+
# Build docs for crates and direct dependencies
6+
rustdoc:
7+
@cargo tree --depth 1 -e normal --prefix none --workspace \
8+
| gawk '{ gsub(" v", "@", $0); printf("%s\n", $1); }' \
9+
| xargs printf -- '-p %s\n' \
10+
| RUSTC_BOOTSTRAP=1 RUSTDOCFLAGS='--cfg=doc_cfg' xargs cargo doc --no-deps --lib --all-features
11+
12+
# Generate README.md files from README.tpl and lib.rs files
13+
generate-readmes:
14+
#!/usr/bin/env bash
15+
set -eo pipefail
16+
17+
git ls-files | grep README.tpl$ | while read -r readme; do
18+
echo "Generating README for $readme"
19+
dir=$(dirname "$readme")
20+
cargo readme --project-root "$dir" > "$dir/README.md.tmp"
21+
gawk -f "scripts/fix-readmes.awk" "$dir/README.md.tmp" > "$dir/README.md"
22+
rm "$dir/README.md.tmp"
23+
done

README.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ license](LICENSE-MIT).
1717
README.md is generated from README.tpl by cargo readme. To regenerate:
1818
1919
cargo install cargo-readme
20-
./scripts/regenerate-readmes.sh
20+
just generate-readmes
2121
-->

scripts/build-docs.sh

Lines changed: 0 additions & 12 deletions
This file was deleted.

scripts/regenerate-readmes.sh

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)