Skip to content

Commit

Permalink
ci: do not mess with runtimepath
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLeoP committed Jul 29, 2024
1 parent a1cae80 commit f6b44c3
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tests/init.lua
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
local M = {}

---@param root string?
---@return string
function M.root(root)
local f = debug.getinfo(1, "S").source:sub(2)
return vim.fn.fnamemodify(f, ":p:h:h") .. "/" .. (root or "")
f = vim.fn.fnamemodify(f, ":p:h:h")
if root then f = f .. "/" .. root end
return f
end

---@param plugin string
function M.load(plugin)
local name = plugin:match(".*/(.*)")
local package_root = M.root(".tests/site/pack/deps/start/")
if not vim.loop.fs_stat(package_root .. name) then
if not vim.uv.fs_stat(package_root .. name) then
print("Installing " .. plugin)
vim.fn.mkdir(package_root, "p")
vim.fn.system({
Expand All @@ -23,7 +27,6 @@ function M.load(plugin)
end

function M.setup()
vim.cmd([[set runtimepath=$VIMRUNTIME]])
vim.opt.runtimepath:append(M.root())
vim.opt.packpath = { M.root(".tests/site") }
M.load("nvim-lua/plenary.nvim")
Expand Down

0 comments on commit f6b44c3

Please sign in to comment.