In NodeJS/NPM, you can create a package.json
and run npm install
to install all your dependencies in a folder within your project: ./node_modules
. (A project can be an app or another module/package.)
Ruby also has a "bundler" system (using a .bundle file) that keeps track of gems specific to a dir (ie project).
Does LuaRocks have similar conventions? Or is it recommeneded to install everything to /usr
or $HOME
?
So far I've been able to get similiar functionality, but I have to create a custom LuaRocks config file and specify --tree=my_local_lua_rocks_dir
every time I want to install a rock. Granted, I can always create a bash script. The point is that it seems I'm going against a convention.
It is possible to install rocks into a directory under the current directory, using the
--tree
flag:And then you have to configure your
package.path
andpackage.cpath
variables in Lua (settable viaLUA_PATH
andLUA_CPATH
environment variables) so it finds the modules installed inside it. There are several ways to do this conveniently: this tutorial explains how to do it, with more examples.