Compare commits
5 Commits
b7218c64c2
...
07df092fc6
Author | SHA1 | Date | |
---|---|---|---|
07df092fc6
|
|||
1623276cb0
|
|||
92cf3634c9
|
|||
84ee8414f7
|
|||
84ac4aef17
|
@ -57,6 +57,7 @@ function M.synctree(tree, cb)
|
||||
end
|
||||
|
||||
-- basically the main function of our program
|
||||
---@param opts speclist
|
||||
return function(opts)
|
||||
logger.pipe = logger:setup()
|
||||
bench:setup()
|
||||
|
@ -23,14 +23,13 @@ function modules:setup(speclist, overrides)
|
||||
|
||||
-- loop through all modules and initialize them
|
||||
for _, modpath in ipairs(speclist.modules) do
|
||||
local mod = module.new(
|
||||
nil,
|
||||
modpath,
|
||||
speclist.modules.prefix,
|
||||
overrides
|
||||
)
|
||||
local mod = module.new(nil, modpath, speclist.modules.prefix, overrides)
|
||||
if not mod then
|
||||
goto continue
|
||||
end
|
||||
|
||||
table.insert(o.modules, mod)
|
||||
::continue::
|
||||
end
|
||||
|
||||
return self
|
||||
|
@ -1,3 +1,4 @@
|
||||
local logger = require('dep.log')
|
||||
local spec_man = require("dep.spec")
|
||||
local packager = require("dep.package")
|
||||
|
||||
@ -6,6 +7,7 @@ local packager = require("dep.package")
|
||||
---@field desc string description of the module
|
||||
---@field path string path to the module
|
||||
---@field mod table the module
|
||||
---@field packages package[] all packages registed from the module
|
||||
local module = {}
|
||||
|
||||
--- Initialize a module
|
||||
@ -36,6 +38,7 @@ function module:new(modpath, prefix, overrides)
|
||||
o.name = modpath
|
||||
ok, o.mod = pcall(require, o.path)
|
||||
if not ok then
|
||||
logger:log("error", "failed to load module: %s", vim.inspect(o.mod))
|
||||
return false
|
||||
end
|
||||
end
|
||||
@ -49,9 +52,13 @@ function module:new(modpath, prefix, overrides)
|
||||
|
||||
ok, err = pcall(packager.register_speclist, o.mod, overrides)
|
||||
if not ok then
|
||||
error(string.format("%s <- %s", err, o.name))
|
||||
logger:log("error", "%s <- %s", err, o.name)
|
||||
return false
|
||||
end
|
||||
|
||||
-- ensure that the module contains the packages that it's created
|
||||
self.packages = err
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
@ -299,7 +299,7 @@ function package:ensureadded(force)
|
||||
self.lazied = true
|
||||
for _, load_cond in pairs(self.lazy_load) do
|
||||
-- configure the lazy loader for the user
|
||||
local l = require('lazy.utils'):new()
|
||||
local l = require('dep.lazy.utils'):new()
|
||||
if l == true then
|
||||
logger:log("lazy", "failed to get lazy utils")
|
||||
return false
|
||||
@ -452,8 +452,10 @@ end
|
||||
--- recurse over all packages and register them
|
||||
---@param speclist speclist table of specs
|
||||
---@param overrides spec? a package spec that is used to override options
|
||||
---@return package[] packages
|
||||
function package.register_speclist(speclist, overrides)
|
||||
overrides = overrides or {}
|
||||
local packages_from_speclist = {}
|
||||
|
||||
-- recurse the packages
|
||||
local over = overrides
|
||||
@ -468,8 +470,19 @@ function package.register_speclist(speclist, overrides)
|
||||
-- While a package can fail to load we just don't care, it will work itself
|
||||
-- out. The goal is to make sure every plugin that can load does load, not
|
||||
-- keep working plugins from loading because an unrelated one doesn't load.
|
||||
package:new(spec, over)
|
||||
local pkg = package:new(spec, over)
|
||||
if not pkg then
|
||||
goto continue
|
||||
end
|
||||
|
||||
-- we store all the packages in a table so that the caller may keep track of
|
||||
-- their packages, this is not required and therefore the return value may
|
||||
-- be discarded
|
||||
table.insert(packages_from_speclist, pkg)
|
||||
::continue::
|
||||
end
|
||||
|
||||
return packages_from_speclist
|
||||
end
|
||||
|
||||
--- reload the package
|
||||
|
@ -5,7 +5,9 @@ local logger = require("dep.log")
|
||||
---@field [integer] string list of all modules to load
|
||||
|
||||
---@class speclist
|
||||
---@field modules specmodules a list of modules
|
||||
---@field modules specmodules? a list of modules
|
||||
---@field base_dir string? the base directory for all plugins
|
||||
---@field sync ("new"|"always")? when to sync (defaults to new)
|
||||
---@field [integer] spec a spec
|
||||
|
||||
---@class spec
|
||||
|
Reference in New Issue
Block a user