$ git clone git@github.com:blackwindforce/onarum.git
$ cd onarum
$ git submodule update --init
Note: onarum
CAN NOT use as a system executable due to luarocks
does not
support git submodule
, you MUST use onarum
under /bin
instead.
$ ./bin/onarum ./spec/fixtures/package.lua
Specify your module dependencies.
require('spec.fixtures.add')
Write your modules as usual.
return function(x)
return function(y)
return x + y
end
end
Preload your modules in bundle.
package = package or {}
package.loaded = package.loaded or {
_G = _G,
coroutine = coroutine,
debug = debug,
io = io,
math = math,
os = os,
package = package,
string = string,
table = table
}
package.preload = package.preload or {}
require = require or function(modname)
if package.loaded[modname] == nil then
assert(package.preload[modname], ("module '%s' not found"):format(modname))
local mod = package.preload[modname]()
package.loaded[modname] = mod == nil or mod
end
return package.loaded[modname]
end
package.preload['spec.fixtures.add'] = function()
return function(x)
return function(y)
return x + y
end
end
end
Use your modules as usual.
print(require('spec.fixtures.add')(1)(2) == 3)
$ luarocks install busted
$ luarocks install luacheck
$ luarocks install luacov
$ luarocks install luacov-console
$ make test