forked from bakaq/bakage
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
67 lines (55 loc) · 1.6 KB
/
justfile
File metadata and controls
67 lines (55 loc) · 1.6 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
BUILD_NAME := "bakage.pl"
# Auto build bakage on changes
watch-dev:
watchexec -w scripts -w src just build
# Shows all the tasks
default:
@just --list
[private]
ensure-build-directory:
mkdir -p build
# Builds the bakage.pl file
build: codegen-scripts
cat ./src/shebang.sh > "./build/{{BUILD_NAME}}"
cat ./src/bakage.pl >> "./build/{{BUILD_NAME}}"
printf "\n" >> "./build/{{BUILD_NAME}}"
cat ./src/validation.pl >> "./build/{{BUILD_NAME}}"
printf "\n" >> "./build/{{BUILD_NAME}}"
cat ./src/cli.pl >> "./build/{{BUILD_NAME}}"
printf "\n" >> "./build/{{BUILD_NAME}}"
cat ./build/scripts.pl >> "./build/{{BUILD_NAME}}"
chmod +x "./build/{{BUILD_NAME}}"
[private]
codegen-scripts: ensure-build-directory
#!/bin/sh
set -eu
touch ./build/scripts.pl
for file in scripts/*.sh; do
script_string=$(scryer-prolog -f -g "
use_module(library(pio)),
use_module(library(dcgs)),
phrase_from_file(seq(Script),\"${file}\"),
write_term(Script, [quoted(true),double_quotes(true)]),
halt.
")
script_name=$(basename -s .sh "${file}")
printf '%s\n' "script_string(\"${script_name}\", ${script_string})." >> ./build/scripts.pl
done
# Run all lints
lint: lint-sh
[private]
lint-sh:
shellcheck -s sh -S warning ./**/*.sh
# Runs all the checks made in CI
ci:
just lint-sh
just test
# Runs all the tests
test: build
just example/test
just tests/test
# Cleans everything that is generated during builds or tests
clean:
just example/clean
just tests/clean
rm -rf build