-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow overriding luarocks config (#334)
- Loading branch information
Showing
3 changed files
with
34 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,10 +2,9 @@ | |
-- | ||
-- Copyright (C) 2023 Neorocks Org. | ||
-- | ||
-- Version: 0.1.0 | ||
-- License: GPLv3 | ||
-- Created: 05 Jul 2023 | ||
-- Updated: 27 Aug 2023 | ||
-- Updated: 15 May 2024 | ||
-- Homepage: https://github.com/nvim-neorocks/rocks.nvim | ||
-- Maintainers: NTBBloodbath <[email protected]>, Vhyrro <[email protected]>, mrcjkb <[email protected]> | ||
-- | ||
|
@@ -103,23 +102,35 @@ if #config.debug_info.unrecognized_configs > 0 then | |
) | ||
end | ||
|
||
local luarocks_config_path = vim.fs.joinpath(config.rocks_path, "luarocks-config.lua") | ||
fs.write_file( | ||
luarocks_config_path, | ||
"w+", | ||
([==[ | ||
lua_version = 5.1 | ||
if opts.luarocks_config then | ||
-- luarocks_config override | ||
if vim.uv.fs_stat(opts.luarocks_config) then | ||
---@diagnostic disable-next-line: inject-field | ||
config.luarocks_config = ("%s"):format(opts.luarocks_config) | ||
else | ||
vim.notify("rocks.nvim: luarocks_config does not exist!", vim.log.levels.ERROR) | ||
opts.luarocks_config = nil | ||
end | ||
end | ||
if not opts.luarocks_config then | ||
local luarocks_config_path = vim.fs.joinpath(config.rocks_path, "luarocks-config.lua") | ||
fs.write_file( | ||
luarocks_config_path, | ||
"w+", | ||
([==[ | ||
lua_version = "5.1" | ||
rocks_trees = { | ||
{ | ||
name = "rocks.nvim", | ||
root = "%s", | ||
}, | ||
} | ||
]==]):format(config.rocks_path) | ||
) | ||
) | ||
|
||
---@diagnostic disable-next-line: inject-field | ||
config.luarocks_config = ('"%s"'):format(luarocks_config_path) | ||
---@diagnostic disable-next-line: inject-field | ||
config.luarocks_config = ("%s"):format(luarocks_config_path) | ||
end | ||
|
||
return config | ||
|
||
|