Repository navigation
Expand file tree
/
Copy pathjustfile
More file actions
87 lines (73 loc) · 2.65 KB
/
Copy pathjustfile
File metadata and controls
87 lines (73 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
bin := "bin/pray"
# list available recipes
default:
@just --list
# build the binary
build:
go build -o {{bin}} ./cmd/pray
# run the cli, passing through args, e.g. `just run hail mary --for "Mam & Dad"`
# (positional-arguments passes each arg through untouched, quotes and all)
[positional-arguments]
run *args:
go run ./cmd/pray "$@"
# run tests
test:
go test ./... -v
# print every prayer and its metadata (id, title, lang, aliases, tags, body)
debug:
go run ./internal/prayers/cmd/debug
# run tests with coverage report
cover:
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
# format code
fmt:
gofmt -l -w .
# vet code
vet:
go vet ./...
# tidy go.mod/go.sum
tidy:
go mod tidy
# fmt, vet, and test
check: fmt vet test
# remove build artifacts
clean:
rm -rf bin coverage.out coverage.html
# install the binary to $GOPATH/bin
install:
go install ./cmd/pray
# render the opening screen's art from demo/our_lady_4.jpg into internal/rosary/art
# (needs imagemagick and chafa: brew install imagemagick chafa)
art:
scripts/opening-art.sh
# record the demo: demo/rosary.gif and demo/rosary.webm
#
# The tape drives the `pray` on PATH, so install first.
#
# The tape renders at 1808x1288 — about twice the size the README shows — because
# VHS rasterises at exactly the size it is given, with no supersampling. A small
# font there is genuinely low-resolution, and no amount of compression tuning
# afterwards puts the detail back. So: render big, then scale down with lanczos.
# The result is sharper than rendering small ever was.
#
# That leaves the webm at full size (it is small anyway, and a website can use
# the real resolution) and the gif at half, which is what the README embeds.
#
# stats_mode=full, NOT diff. diff weights colours by what changes between frames,
# and what changes most here is the near-black background — it spent the whole
# palette on greys, turned the cornflower beads grey and washed the gold out to
# cream. full looks at every frame whole, which keeps both.
#
# Needs vhs and ffmpeg (brew install vhs ffmpeg).
demo: install
vhs demo/rosary.tape
ffmpeg -y -i demo/rosary.gif \
-vf "scale=904:-1:flags=lanczos,palettegen=max_colors=128:stats_mode=full" \
-frames:v 1 -update 1 demo/.palette.png -loglevel error
ffmpeg -y -i demo/rosary.gif -i demo/.palette.png \
-filter_complex "scale=904:-1:flags=lanczos[x];[x][1:v]paletteuse=dither=none:diff_mode=rectangle[o]" \
-map "[o]" demo/.rosary-opt.gif -loglevel error
mv demo/.rosary-opt.gif demo/rosary.gif
rm -f demo/.palette.png
@ls -lh demo/rosary.gif demo/rosary.webm