Lua application management in an npm
style. Goals are to (easily) maintain locally-scoped dependencies and automatically select the correct Lua version. Requires lenv
to be installed and on the path.
To install, copy lpm
, lpm.lua
, and lpm-utils.lua
to your favorite folder and add that folder to your path.
Install the version of Lua, the dependencies, and the dev dependencies listed in package.lua
. To omit dev dependencies, pass --production
. Installs all dependencies in ./lua_modules
.
lpm install [--production]
lpm i [--production]
Remove all installed dependencies by deleting ./lua_modules
.
lpm clean
lpm c
Execute commands in the project context.
lpm exec <command> [arguments]
lpm e <command> [arguments]
Run scripts defined in package.lua
in project context.
lpm run <script name> [arguments]
lpm r <script name> [arguments]
Alias for lpm run test
.
lpm test
lpm t
Show the version.
lpm version
lpm v
The package file (package.lua
) includes a specification for your package and instructions for lpm
:
-- The package's name
name = 'cool-test-project'
-- Version of Lua installed via `lenv` during package installation
lua = '5.3.2'
-- LuaRocks modules required by the package during runtime
dependencies = {
'lua == 5.3',
'chain == 1.0-1'
}
-- LuaRocks modules required for development of the package
-- These are omitted when installed with `--production`
dev_dependencies = {
'mach >= 4.4-1',
'busted >= 2.0.rc11-0'
}
-- Scripts that can be run with `lpm run`
scripts = {
test = 'busted',
demo = [[lua -e "require 'src.test'(print)"]]
}
Install and run automated tests for the sample project with:
./lpm i; ./lpm t