-
Notifications
You must be signed in to change notification settings - Fork 0
/
justfile
248 lines (207 loc) · 7.55 KB
/
justfile
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
#!/usr/bin/env just --justfile
# ^ A shebang isn't required, but allows a justfile to be executed
# like a script, with `./justfile test`, for example.
# https://github.com/casey/just
# VARIABLES
application := "tfdoc"
# ALIASES
alias b := build
alias br := buildr
alias bra := buildra
alias cl := changelog
alias cliff := changelog
alias fmt := format
alias r := release
alias update := upgrade
alias t := test
alias tp := testp
# SHORTCUTS AND COMMANDS
# Builds and documents the project - Default; runs if nothing else is specified
@default: check
# Check if it builds at all
@check: format
cargo lcheck --color 'always'
# Only compiles the project
@build: format changelog
-git mit es
cargo nextest run
cargo lbuild --color 'always'
# Compile a release version of the project without moving the binaries
@buildr: format changelog
cargo lbuild --release --color 'always'
# Compile a release version of the project for Apple ARM64 without moving the binaries
@buildra: format changelog
cargo lbuild --release --color 'always' --target aarch64-apple-darwin
cargo strip --target aarch64-apple-darwin
# Cleans and builds again
@rebuild: format changelog
cargo clean
cargo lbuild --color 'always'
# Updates the CHANGELOG.md file
@changelog:
git-cliff --output {{invocation_directory()}}/CHANGELOG.md
# Cleans up the project directory
@clean:
cargo clean
-rm tree.txt > /dev/null 2>&1
-rm graph.png > /dev/null 2>&1
-rm debug.txt > /dev/null 2>&1
-rm trace.txt > /dev/null 2>&1
-rm bom.txt > /dev/null 2>&1
-rm tests.txt > /dev/null 2>&1
-rm tokei.txt > /dev/null 2>&1
-rm {{application}}.log > /dev/null 2>&1
# Documents the project, lints it, builds and installs the release version, and cleans up
@release: format changelog
cargo lbuild --release --color 'always'
-cp {{invocation_directory()}}/target/release/{{application}} /usr/local/bin/
# echo "Moving Fig and man files."
# -mv {{invocation_directory()}}/{{application}}.1 /usr/local/share/man/man1/
# -mv {{invocation_directory()}}/{{application}}.js ~/.fig/autocomplete/
cargo clean
# Documents the project, builds and installs the release version, and cleans up
@releasea: format changelog
cargo lbuild --release --color 'always' --target aarch64-apple-darwin
cargo strip --target aarch64-apple-darwin
cp {{invocation_directory()}}/target/aarch64-apple-darwin/release/{{application}} /usr/local/bin/
cargo clean
# Build the documentation
@doc:
cargo doc --no-deps
# Documents the project
@docs: format
cargo doc --no-deps
cargo depgraph | dot -Tpng > graph.png
cargo tree > tree.txt
cargo bom > bom.txt
cargo nextest list | tee tests.txt
tokei | tee tokei.txt
cargo outdated
# Documents the project and all dependencies
@doc-all: format
cargo doc
cargo depgraph | dot -Tpng > graph.png
cargo tree > tree.txt
cargo bom > bom.txt
cargo nextest list | tee tests.txt
tokei | tee tokei.txt
cargo outdated
# Formats the project source files
@format:
cargo fmt -- --emit=files
# Tests the project
@test:
cargo nextest run
# Tests the project with output
@testp:
cargo nextest run --no-capture
# Checks the project for inefficiencies and bloat
@inspect: format doc lint spell
cargo deny check
cargo geiger
cargo bloat
cargo pants
# Checks for potential code improvements
@lint:
cargo lclippy -- -W clippy::pedantic -W clippy::nursery -W clippy::unwrap_used
# Checks for potential code improvements and fixes what it can
@lintfix:
cargo lclippy --fix -- -W clippy::pedantic -W clippy::nursery -W clippy::unwrap_used
# Initialize directory for various services such as cargo deny
@init:
-cp ~/CloudStation/Source/_Templates/deny.toml {{invocation_directory()}}/deny.toml
-cp ~/CloudStation/Source/_Templates/main_template.rs {{invocation_directory()}}/src/main.rs
-cp ~/CloudStation/Source/_Templates/cliff.toml {{invocation_directory()}}/cliff.toml
-cargo add clap --features cargo color
-cargo add log
-cargo add env_logger
-echo "# {{application}}\n\n" > README.md
-git mit-install
-git mit-config lint enable subject-line-not-capitalized
-git mit-config lint enable subject-line-ends-with-period
-git mit-config lint enable not-conventional-commit
-git mit-config lint disable not-emoji-log
-git mit-config mit set es "Even Solberg" [email protected]
-git mit es
-git remote add {{application}} https://github.com/evensolberg/{{application}}
-git commit -m doc:Initial
-git tag Initial
-git cliff --init
-cp ~/CloudStation/Source/_Templates/cliff.toml {{invocation_directory()}}/
# Re-initialize the directory for various services -- stripped down version of init
@reinit:
git mit-install
git mit-config lint enable subject-line-not-capitalized
git mit-config lint enable subject-line-ends-with-period
git mit-config mit set es "Even Solberg" [email protected]
git mit es
git cliff --init
cp ~/CloudStation/Source/_Templates/cliff.toml {{invocation_directory()}}/
# Read the documentation
@read:
open file://{{invocation_directory()}}/target/doc/{{application}}/index.html
# Builds (if necessary) and runs the project
@run:
cargo lrun --color 'always'
# Build and run with a --help parameter
@runh:
cargo lrun --color 'always' -- --help
# Build and run with a --debug parameter
@rund:
cargo lrun --color 'always' -- --debug
# Build and run with a --debug parameter, tee to debug.txt
@rundt:
cargo lrun --color 'always' -- --debug | tee debug.txt
# Build and run with double --debug parameters
@rundd:
cargo lrun --color 'always' -- --debug --debug
# Build and run with double --debug parameters, tee to trace.txt
@runddt:
cargo lrun --color 'always' -- --debug --debug | tee trace.txt
# Spellcheck the documents except CHANGELOG
@spell:
typos --exclude CHANGELOG.md -c ~/CloudStation/Automation/_typos.toml
# Check for new versions of crates and upgrade accordingly
@upgrade:
cargo update
cargo upgrade --workspace
# Copy this settings files to the templates directory
@just:
-sed "s#{{application}}#{{application}}#" justfile > ~/CloudStation/Source/_Templates/justfile.template
-cp {{invocation_directory()}}/deny.toml ~/CloudStation/Source/_Templates/deny.toml
-cp {{invocation_directory()}}/cliff.toml ~/CloudStation/Source/_Templates/cliff.toml
# Check, but verbose
@checkv:
cargo lcheck --color 'always' --verbose
# Install the relevant cargo add-ons used in this file
@install:
-cargo install cargo-limit
-cargo install cargo-geiger
-cargo install cargo-depgraph
-cargo install cargo-audit
-cargo install cargo-bloat
-cargo install cargo-edit
-cargo install cargo-strip
-cargo install --locked cargo-outdated
-cargo install tokei
-cargo install cargo-semver --vers 1.0.0-alpha.3
-cargo install cargo-deny
-cargo install git-cliff
-cargo install cargo-nextest
-cargo install cargo-pants
-brew install PurpleBooth/repo/git-mit
-brew install graphviz
-cp ~/CloudStation/Source/_Templates/deny.toml {{invocation_directory()}}/deny.toml
# Testing actions
# Run the program with a bunch of parameters to test things
@runit:
-rm {{application}}.log
target/debug/{{application}} \
--pfc folder.jpg --pfc Front.jpg \
--pbc Back.jpg --pbc Back-Cover.jpg \
--psf Artwork --psf "." --psf ".." \
--pms 300 \
--pf cover-small.jpg --pb back-small.jpg \
-l {{application}}/debug.yaml \
music/01-13\ Surf\'s\ Up.flac \
-r