lua-users home
lua-l archive

Re: How to include static files into luarock?

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Am 09.12.2016 um 08:42 schröbte p. shkadzko:
Hi All,
Hi!
I have a small script that reads and parses 2 text files. I wanted to
create a luarock which packs both the script and static resources to be
parsed. How should I organize my "build" section in rockspec file?
Currently I have the following:
 build = {
 type = "builtin",
 modules = {
 myscript = "src/lua-myscript.lua"
 },
 copy_directories = {"data"}
}
And the package dir sctructure:
lua-myscript-1.0/
 scr/
 lua-myascript.lua
 data/
 data1.txt
 data2.txt
I thought that "copy_directories" will do the work, but it didn't. The
module complains that it can't find the resources. Is there a predefined
path where luarocks installs all the "copy_directories" data? How should I
do it correctly?
The files will end up inside the rocks tree somewhere like `/usr/local/lib/luarocks/rocks-5.3/lua-myscript-1.0-1/data`. There is the [datafile][1] module which can figure out the details for you.
For the build section I'd use something like
 build = {
 type = "none",
 install = {
 bin = {
 myscript = "src/myscript.lua",
 }
 },
 copy_directories = { "data" }
 }
Best,
Pavel
HTH,
Philipp
 [1]: https://github.com/hishamhm/datafile/

AltStyle によって変換されたページ (->オリジナル) /