-
Notifications
You must be signed in to change notification settings - Fork 62
Expand file tree
/
Copy pathinit.lua
More file actions
40 lines (33 loc) · 1.26 KB
/
Copy pathinit.lua
File metadata and controls
40 lines (33 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
---Initialize neovim to use lua modules from luarocks and prepare correct search paths for
---modules, neovim plugins and load busted frameworks.
local function build_path(modules, extensions)
local path = ""
for _, module_path in ipairs(modules) do
for _, lua_path_extension in ipairs(extensions) do
path = path .. module_path .. lua_path_extension .. ";"
end
end
return path
end
local plugins_folder = "tests/plugins/*/lua"
local luarocks_cmd = "luarocks config --scope project"
-- Project path
local modules = { "lua" }
-- External plugins - dependencies
for plugin_path in vim.fn.glob(plugins_folder):gmatch("[^\r\n]+") do
table.insert(modules, plugin_path)
end
-- Lua modules path
table.insert(modules, vim.fn.trim(vim.fn.system(luarocks_cmd .. " deploy_lua_dir")))
local lua_path_extensions = { "/?.lua", "/?/init.lua" }
package.path = build_path(modules, lua_path_extensions) .. package.path
local cmodules = {
vim.fn.trim(vim.fn.system(luarocks_cmd .. " deploy_lib_dir")),
}
local lua_lib_extensions = { "/?.so", "/?/init.so" }
package.cpath = build_path(cmodules, lua_lib_extensions) .. package.cpath
-- Initialize required plugins which needs it
require("diffview").setup()
-- Run busted -
require("busted.runner")({ standalone = false })
os.exit(0)