Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
pablopunk committed Jan 24, 2024
1 parent 28cd99b commit ea4d3df
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 3 deletions.
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
MINIMAL_INIT := ./scripts/minimal_init.vim
DOC_GEN_SCRIPT := ./scripts/docs.lua
PLUGIN_DIR := lua/


test:
nvim --headless --noplugin -u ${MINIMAL_INIT} \
-c "PlenaryBustedDirectory lua/ { minimal_init = '${MINIMAL_INIT}' }"
-c "PlenaryBustedDirectory ${PLUGIN_DIR} { minimal_init = '${MINIMAL_INIT}' }"

docs:
nvim --headless --noplugin -u ${MINIMAL_INIT} \
-c "luafile ${DOC_GEN_SCRIPT}" -c 'qa'
33 changes: 33 additions & 0 deletions scripts/docs.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
local docgen = require "docgen"

local docs = {}

docs.test = function()
-- Filepaths that should generate docs
local input_files = {
"./lua/unclutter/init.lua",
"./lua/unclutter/config.lua",
}

-- Maybe sort them that depends what you want and need
table.sort(input_files, function(a, b)
return #a < #b
end)

-- Output file
local output_file = "./doc/unclutter.txt"
local output_file_handle = io.open(output_file, "w")
assert(output_file_handle, "Could not open " .. output_file)

for _, input_file in ipairs(input_files) do
docgen.write(input_file, output_file_handle)
end

output_file_handle:write " vim:tw=78:ts=8:ft=help:norl:\n"
output_file_handle:close()
vim.cmd [[checktime]]
end

docs.test()

return docs
11 changes: 9 additions & 2 deletions scripts/minimal_init.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
let plenary_path = stdpath('data') . '/lazy/plenary.nvim/'
execute 'set rtp+=' . plenary_path
let plugins_path = stdpath('data') . '/lazy'

set rtp+=.
" for tests
execute 'set rtp+=' . plugins_path . '/plenary.nvim/'
" for docs generation
execute 'set rtp+=' . plugins_path . '/tree-sitter-lua/'


runtime! plugin/plenary.vim
runtime! plugin/unclutter.lua
runtime! plugin/ts_lua.lua

0 comments on commit ea4d3df

Please sign in to comment.