feat(rocks): use hererocks to install luarocks when luarocks is not found

This commit is contained in:
Folke Lemaitre 2024-06-25 07:55:30 +02:00
parent dea1f687fe
commit d87da76679
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
5 changed files with 58 additions and 2 deletions

View file

@ -33,7 +33,9 @@ function M:load_pkgs()
if not Config.options.pkg.enabled then
return
end
local have_rockspec = false
for _, pkg in ipairs(Pkg.get()) do
have_rockspec = have_rockspec or pkg.source == "rockspec"
local meta, fragment = self:add(pkg.spec)
if meta and fragment then
meta._.pkg = pkg
@ -46,6 +48,12 @@ function M:load_pkgs()
self.pkgs[pkg.dir] = fragment.id
end
end
if have_rockspec then
local hererocks = Pkg.hererocks()
if hererocks then
self:add(hererocks)
end
end
end
--- Remove a plugin and all its fragments.