mirror of
https://github.com/folke/lazy.nvim.git
synced 2025-04-11 18:02:32 +00:00
Merge 7e18ced2e6
into 6c3bda4aca
This commit is contained in:
commit
d24e3b271b
1 changed files with 32 additions and 8 deletions
|
@ -247,17 +247,39 @@ end
|
||||||
---@param plugin LazyPlugin
|
---@param plugin LazyPlugin
|
||||||
function M.find_rockspec(plugin)
|
function M.find_rockspec(plugin)
|
||||||
local rockspec_file ---@type string?
|
local rockspec_file ---@type string?
|
||||||
|
|
||||||
|
local check_file = function(path, name)
|
||||||
|
-- match package-(scm|git|dev)-[REV].rockspec
|
||||||
|
for _, suffix in ipairs({ "scm", "git", "dev" }) do
|
||||||
|
pattern = suffix .. "%-%d+%.rockspec$"
|
||||||
|
if name:find(pattern) then
|
||||||
|
return path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
Util.ls(plugin.dir, function(path, name, t)
|
Util.ls(plugin.dir, function(path, name, t)
|
||||||
if t == "file" then
|
if t == "directory" and (name == "rockspec" or name == "rockspecs") then
|
||||||
for _, suffix in ipairs({ "scm", "git", "dev" }) do
|
Util.ls(path, function(path, name, t)
|
||||||
suffix = suffix .. "-1.rockspec"
|
if t == "file" then
|
||||||
if name:sub(-#suffix) == suffix then
|
rockspec_file = check_file(path, name)
|
||||||
rockspec_file = path
|
if rockspec_file ~= nil then
|
||||||
return false
|
return false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
end)
|
||||||
|
if rockspec_file ~= nil then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if t == "file" then
|
||||||
|
rockspec_file = check_file(path, name)
|
||||||
|
if rockspec_file ~= nil then
|
||||||
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
return rockspec_file
|
return rockspec_file
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -311,11 +333,13 @@ function M.get(plugin)
|
||||||
-- has a complex build process
|
-- has a complex build process
|
||||||
or not M.is_simple_build(rockspec)
|
or not M.is_simple_build(rockspec)
|
||||||
|
|
||||||
|
rockspec_file = rockspec_file:sub(#plugin.dir+2)
|
||||||
|
|
||||||
if not use then
|
if not use then
|
||||||
-- community specs only
|
-- community specs only
|
||||||
return #specs > 0
|
return #specs > 0
|
||||||
and {
|
and {
|
||||||
file = vim.fn.fnamemodify(rockspec_file, ":t"),
|
file = rockspec_file,
|
||||||
spec = {
|
spec = {
|
||||||
plugin.name,
|
plugin.name,
|
||||||
specs = specs,
|
specs = specs,
|
||||||
|
@ -331,7 +355,7 @@ function M.get(plugin)
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
file = vim.fn.fnamemodify(rockspec_file, ":t"),
|
file = rockspec_file,
|
||||||
spec = {
|
spec = {
|
||||||
plugin.name,
|
plugin.name,
|
||||||
build = "rockspec",
|
build = "rockspec",
|
||||||
|
|
Loading…
Add table
Reference in a new issue