How can I install lua rocks from a manifest file?
Asked Answered
T

2

8

I come from a python background and I'm hoping to do something semantically equivalent to pip install -r requirements.txt to install a list of Python packages at the right version.

Is this achievable with luarocks? If not, is there a way to hack this together on the command line?

Tacit answered 25/1, 2016 at 19:40 Comment(0)
A
3

The system in Lua is a little different. There is a rockspec manifest file associated with every package. You can list your package dependencies here in this file and you can install then using

"luarocks install name.rockspec".

For more details, visit Luarocks

More on Rockspec format here

Instruction for creating a package/rock here

Abroms answered 10/3, 2016 at 5:7 Comment(1)
Similar to requirements.txt, that would install all dependencies for rock "name". But unlike requirements.txt, it also installs rock "name".Compossible
Z
1

In case you just want to install a list of dependencies from a file without worrying about Rockspec, you can also just use this three lines that read a file with the exact same format of a requirements.txt file for pip (package==version):

while read -r line ; do
    luarocks install $(echo $line | awk -F '==' '{print $1, $2}') 
done < lua_requirements.txt
Zashin answered 16/5, 2022 at 7:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.