Skip to main content

Using Rockamalg

Enapter Rockamalg allows you to amalgamate Lua files with dependencies into single Lua script. When you upload your blueprint, Enapter Cloud internally uses rockamalg to amalgamate Lua files.

You can use it too! If you already use tools like lua-amalg and use luarocks to manage dependencies, rockamalg helps you to simplify amalgamation process.

The commands below show how to pass this tutorial, but amalgamate Lua script using rockamalg tool instead of modifying manifest.yml.

Amalgamate Directory​

To amalgamate Lua directory src into a single file ucm.lua:

docker run --rm -it -v $(pwd):/app enapter/rockamalg amalg -o ucm.lua src

Amalgamate Lua Script With Dependencies​

Dependencies is a file with names of Luarocks packages. They are described in luarocks format. It looks like:

lua-string ~> 1.2
beemovie == 1.0.1

To amalgamate Lua directory src with dependencies described in file named deps:

docker run --rm -it -v $(pwd):/app enapter/rockamalg amalg -o ucm.lua -d deps src

Using Existing Rockspec​

As you already now, you can use rockspec file to describe dependencies. To use it with rockamalg:

docker run --rm -it -v $(pwd):/app enapter/rockamalg amalg -o ucm.lua -r my-dev-1.rockspec src
Hardware diversity is welcome. Integrate any device into a unified energy network.
© 2024 Enapter
Developer toolkit
DocumentationReference