I'm working on my first lua package, and I am deeply confused as to what to name my rockspec(s) and where to put them. Every popular lua package I look at seems to deal with rockspecs differently. This is very different from, say, Ruby, where every gem just has a single gemspec
. Here are some examples:
- lua-cliargs: a single rockspec in the project root, (e.g.
lua_cliargs-3.0-1.rockspec
) - ldoc: a single rockspec in the project root, named with
scm
instead of a version number (e.g.ldoc-scm-2.rockspec
) - lua-MessagePack: multiple, version-named rockspecs stored in a top-level
rockspec/
directory (e.g.lua-messagepack-0.1.0-1.rockspec
, ...lua-messagepack-0.3.4-1.rockspec
), followed by some with an extra lua version inserted before the package version (e.g.lua-messagepack-lua53-0.3.6-1.rockspec
). Sometimes there are two rockspecs for the same package version, one containing lua53 and one not. - luafilesystem: multiple, version-named rockspecs stored in a top-level
/rockspec
directory (e.g.luafilesystem-1.3.0-1.rockspec
, ...luafilesystem-1.6.1-1.rockspec
), followed by some that havecvs
instead of a package version number inserted before the package version (e.g.luafilesystem-cvs-1.rockspec
,luafilesystem-cvs-2.rockspec
). - lpeg: no rockspec at all
- luasocket: one rockspec in the root containing
scm
instead of a package number (e.g.luasocket-scm-0.rockspec
), and a/rockspec
directory containing a single rockspec with a package number (e.g.luasocket-3.0rc2-1.rockspec
)
Now, this question explains why one would have a "working" rockspec file and a separate directory full of release-versioned rockspecs, but I still have several questions:
- What are rockspec revisions for? The luarocks wiki says that package releases should be tagged in git with the version number, and the example it gives does not include the rockspec revision. If my rockspec is in VCS, and I tag a particular commit, then doesn't that effectively fix the rockspec(s) included in that commit and therefore version? A later revision to the rockspec couldn't possibly be in the tagged commit.
- How can
lpeg
be listed on luarocks but lack arockspec
? - The luarocks wiki says that
scm
should be used in lieu of a package version number if you want your rockspec to refer to HEAD. But sinceHEAD
is continually changing, and the rockspec has to list all of the files, it would seem that one would need to continually increment therevision
number of thescm
rockspec to keep up with any added or deleted files. One could get around this by not using a revision number at all forscm
rockspecs, and yet the ones I see have low revision numbers (e.g.ldoc-scm-2.rockspec
). Is this a mistake? - Are any of the above examples considered a best practice?