blob: 429d8dd72eb7c45697e88f346777236566399d40 (
plain)
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
|
[tools]
lua = "5.4"
# `mise run deps` installs the rocks into ./.rocks (gitignored); `mise run check`
# puts that tree on package.path and runs the specs. Both pin --lua-version 5.4
# because a stray system luarocks may default to another Lua.
#
# lyaml is a C binding over libyaml and needs the system library present:
# `brew install libyaml` on macOS, `apt install libyaml-dev` on Debian. The
# YAML_DIR below points luarocks at Homebrew's prefix when brew is available and
# otherwise lets luarocks search the usual system paths.
[tasks.deps]
description = "Install the Lua rocks the extension and specs need into ./.rocks"
dir = "{{config_root}}"
run = """
set -e
if brew --prefix libyaml >/dev/null 2>&1; then
luarocks --lua-version 5.4 --tree .rocks install lyaml YAML_DIR="$(brew --prefix libyaml)"
else
luarocks --lua-version 5.4 --tree .rocks install lyaml
fi
luarocks --lua-version 5.4 --tree .rocks install toml2lua
luarocks --lua-version 5.4 --tree .rocks install luv
luarocks --lua-version 5.4 --tree .rocks install dkjson
"""
[tasks.check]
description = "Run the specs against ./.rocks"
dir = "{{config_root}}"
run = """
set -e
# Without the tree the specs still pass, but every case that needs a rock skips
# itself; install once rather than reporting a green run that tested less.
[ -d .rocks ] || mise run deps
eval "$(luarocks --lua-version 5.4 --tree .rocks path)"
lua spec/run.lua
"""
|