diff options
author | Squibid <me@zacharyscheiman.com> | 2023-04-30 19:49:01 -0400 |
---|---|---|
committer | Squibid <me@zacharyscheiman.com> | 2024-07-25 10:25:36 -0400 |
commit | 3d20ae8d2ac131aa2e2d2064c91ae31c800d8ea9 (patch) | |
tree | 2241db5067ce8e708c0bcd32e1769b4242a713ea /lua | |
parent | 5b7b7f610f515e55c72a86bc8f49855652c0f339 (diff) | |
download | dep-3d20ae8d2ac131aa2e2d2064c91ae31c800d8ea9.tar.gz dep-3d20ae8d2ac131aa2e2d2064c91ae31c800d8ea9.tar.bz2 dep-3d20ae8d2ac131aa2e2d2064c91ae31c800d8ea9.zip |
pin the correct repo to the top of the plugin list
Diffstat (limited to '')
-rw-r--r-- | lua/dep.lua | 27 | ||||
-rw-r--r-- | lua/dep/package.lua | 15 |
2 files changed, 6 insertions, 36 deletions
diff --git a/lua/dep.lua b/lua/dep.lua index dccd17b..20be24f 100644 --- a/lua/dep.lua +++ b/lua/dep.lua @@ -127,27 +127,6 @@ local function register_recursive(list, overrides) error(string.format("%s (spec=%s)", err, vim.inspect(list[i]))) end end - - if list.modules then - for i = 1, #list.modules do - local name, module = "<unnamed module>", list.modules[i] - - if type(module) == "string" then - if list.modules.prefix then - module = list.modules.prefix .. module - end - - name, module = module, require(module) - end - - name = module.name or name - - local ok, err = pcall(register_recursive, module, overrides) - if not ok then - error(string.format("%s <- %s", err, name)) - end - end - end end local function sort_dependencies() @@ -851,6 +830,12 @@ return setmetatable({ bench("load", function() root = register("squibid/dep") register_recursive(config) + if config["load"] and type(config["load"]) == "function" then + local ok, ret = pcall(config["load"]()) + if ok and type(ret) == "table" then + register_recursive(ok) + end + end sort_dependencies() ensure_acyclic() end) diff --git a/lua/dep/package.lua b/lua/dep/package.lua index 513df8d..e76238d 100644 --- a/lua/dep/package.lua +++ b/lua/dep/package.lua @@ -168,7 +168,6 @@ local PackageStore = setmetatable({ assert(type(specs) == "table", "package list must be a table") assert(specs.pin == nil or type(specs.pin) == "boolean", "package list pin must be a boolean") assert(specs.disable == nil or type(specs.disable) == "boolean", "package list disable must be a boolean") - assert(specs.modules == nil or type(specs.modules) == "table", "package list module list must be a table") scope = scope or {} scope = { @@ -181,20 +180,6 @@ local PackageStore = setmetatable({ for i = 1, #specs do self:add_spec(specs[i], scope) end - - -- recursively add referenced spec list modules - if specs.modules then - local prefix = specs.modules.prefix or "" - for i = 1, #specs.modules do - local name = specs.modules[i] - assert(type(name) == "string", "package list inner module name must be a string") - name = prefix .. name - - local module = require(name) - assert(type(module) == "table", "package list inner module did not return a spec list table") - self:add_specs(module, scope) - end - end end, --- Ensures there are no circular dependencies in this package store. |