-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Justfile
80 lines (64 loc) · 2.62 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
all: build test
all-release: build-release test-release
check_types := "apt cmd defaults dns fs gem group hash homebrew http npm ping systemd tap tcp udp ufw user"
# compiles the specsheet binary
@build:
cargo build
# compiles the specsheet binary (in release mode)
@build-release:
cargo build --release --verbose
strip "${CARGO_TARGET_DIR:-target}/release/specsheet"
# runs unit tests
@test:
cargo test --workspace -- --quiet
# runs unit tests (in release mode)
@test-release:
cargo test --release --workspace --verbose
# lints the code
@clippy:
touch spec_analysis/src/lib.rs
touch spec_exec/src/lib.rs
cargo clippy
# generates a code coverage report using tarpaulin via docker
@coverage-docker:
docker run --security-opt seccomp=unconfined -v "${PWD}:/volume" xd009642/tarpaulin cargo tarpaulin --workspace --out Html
# updates dependency versions, and checks for outdated ones
@update-deps:
cargo update
command -v cargo-outdated >/dev/null || (echo "cargo-outdated not installed" && exit 1)
cargo outdated
# lists unused dependencies
@unused-deps:
command -v cargo-udeps >/dev/null || (echo "cargo-udeps not installed" && exit 1)
cargo +nightly udeps
# prints versions of the necessary build tools
@versions:
rustc --version
cargo --version
# builds the man pages
man:
#!/bin/sh
mkdir -p "${CARGO_TARGET_DIR:-target}/man"
pandoc --standalone -f markdown -t man man/specsheet.1.md > "${CARGO_TARGET_DIR:-target}/man/specsheet.1"
pandoc --standalone -f markdown -t man man/specsheet.5.md > "${CARGO_TARGET_DIR:-target}/man/specsheet.5"
for ct in {{ check_types }}; do
pandoc --standalone -f markdown -t man man/specsheet_$ct.5.md > "${CARGO_TARGET_DIR:-target}/man/specsheet_$ct.5"
done
# creates a distributable package
zip desc exe="specsheet":
#!/usr/bin/env perl
use Archive::Zip;
-e 'target/release/{{ exe }}' || die 'Release binary not built!';
-e 'target/man/specsheet.1' || die 'Man pages not built!';
my $zip = Archive::Zip->new();
$zip->addFile('completions/specsheet.bash');
$zip->addFile('completions/specsheet.zsh');
$zip->addFile('completions/specsheet.fish');
$zip->addFile('target/man/specsheet.1', 'man/specsheet.1');
$zip->addFile('target/man/specsheet.5', 'man/specsheet.5');
for (qw[{{ check_types }}]) {
$zip->addFile("target/man/specsheet_$_.5", "man/specsheet_$_.5");
}
$zip->addFile('target/release/{{ exe }}', 'bin/{{ exe }}');
$zip->writeToFileNamed('specsheet-{{ desc }}.zip') == AZ_OK || die 'Zip write error!';
system 'unzip -l "specsheet-{{ desc }}".zip'