lunarmodules / luacov

LuaCov is a simple coverage analyzer for Lua code.
http://lunarmodules.github.io/luacov/
MIT License
300 stars 68 forks source link

fix(html): add html reporter to rockspec #103

Closed Aire-One closed 1 year ago

Aire-One commented 1 year ago

Hello :wave:

Following my message in #98, here are the necessary changes to make the Html reporter work with the Luarocks package.

It adds a new optional dependency on datafile. Because it's optional (only required by the Html reporter), I haven't pushed it to the rockspec's dependencies table.

Alternatively, we could have included the file's content as long strings in the reporter.html.* module. Since the static files are larges, I think it's better to manage them as regular files in the repository and access them with datafile.

Fixes #98

Aire-One commented 1 year ago

Thank you, @Tieske, for the merge!

I can see you removed the mention that the HTML Reporter depends on datafile. Should we consider as a good practice to change the local datafile = require("datafile") line to something like

local datafile_available, datafile = pcall(require, 'datafile')
if not datafile_available then
  -- print a message to inforn the user they need to install datafile, then exit the program
end
Tieske commented 1 year ago

@Aire-One you're right, it is omitted. My intent was to add it to the rockspec as a dependency, but I see that I missed that.

Tieske commented 1 year ago

see #108