[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 """