Before starting, ensure the following tools are installed and available in your system PATH:
lua
in your PATH (or project
root when using luaver).luarocks
in your PATH (or
project root when using luaver).muddler
(or ensure you know the path to the JAR if running directly).You can verify each with:
lua -v
luarocks --version
muddler --version # or: java -jar /your/path/to/muddle-1.1.0-all.jar --version
From the project root:
luarocks init --lua-versions "5.1"
Use the set_paths.lua
helper to run src/
code directly:
From the project root:
./lua -l set_paths src/path/to/your/script
From the project root:
./luarocks install --tree=lua_modules busted
./lua_modules/bin/busted tests
Note:
mudlet-package-dev-1.rockspec
defines runtime dependencies. Only pure-Lua, runtime dependencies should be listed in the .rockspec. Install dev dependencies like busted manually into your preferred scope, like shown above.
From the project root:
(cd muddler && \
../scripts/compose_build_context.sh && \
muddler)
The built package is located at:
muddler/build/muddler_luarocks_starter.mpackage
The compose_build_context.sh
script sets up the build context in the existing
muddler/
folder:
.rockspec
into a clean lua_modules
directory inside the build
context. This ensures runtime-only dependencies are packaged, while e.g.
tests run against the broader set of development dependencies (which may
include binaries like busted
).src
contentsResulting structure after the build completes:
├── muddler
│ ├── build # build directory (owned by muddler)
│ ├── .gitignore
│ ├── .output # build related metadata (owned by muddler)
│ ├── mfile
│ ├── README.md
│ └── src
│ ├── (...)
│ ├── resources
│ │ └── lua
│ │ ├── lua_modules # deps from mudlet-package-dev-1.rockspec
│ │ └── scripts # src contents
│ │ ├── boot.lua
│ │ └── test
│ │ ├── TestableClass_spec.lua
│ │ └── TestableClass.lua
│ ├── (...)
Note:
The.output
file is a build output metadata file generated by muddler. It records the name and path of the most recent package build and is used by the helper script to detect changes and trigger automatic (re)installation.
To enable automatic (re)installation in Mudlet for a given profile during development:
integration/auto_install_helper.lua
into a script in
the profile. Place this script after the muddler package folder in the
profile scripts list.auto_install_helper.lua
for environment-specific
setup.This automates package updates when rebuilding locally. Every time the package is rebuilt, Mudlet will detect the change and (re)install the latest version into the profile. ```