Skip to content

Commit

Permalink
feat: use nvim -l to run lua build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
saecki committed Sep 2, 2024
1 parent c2f49c5 commit 7762778
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 32 deletions.
22 changes: 4 additions & 18 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,11 @@ jobs:
with:
ref: ${{ github.head_ref }}

- name: Install lua
uses: leafo/gh-actions-lua@v10
- name: Install neovim
uses: rhysd/action-setup-vim@v1
with:
luaVersion: "luajit-2.1.0-beta3"

- name: Install luarocks
uses: leafo/gh-actions-luarocks@v4
neovim: true

- name: Install inspect
run: luarocks install inspect

- name: Generate types
run: make types
Expand All @@ -37,6 +32,7 @@ jobs:
file_pattern: lua/crates/config/types.lua
commit_message: "chore: generate types"


- name: Generate docs
run: make doc

Expand All @@ -52,15 +48,6 @@ jobs:
with:
path: docgen/wiki

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install neovim
uses: rhysd/action-setup-vim@v1
with:
neovim: true

- name: Install plenary.nvim
uses: actions/checkout@v4
Expand All @@ -71,4 +58,3 @@ jobs:
- name: Run tests
run: make test
timeout-minutes: 1

9 changes: 0 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,6 @@ make test

## Writing Documentation

### Requirements
- [Luarocks](https://luarocks.org/)
- macos: `brew install luarocks`
- fedora: `dnf install luarocks`
- ubuntu: `apt install luarocks`
- arch: `pacman -S install luarocks`
- [Inspect](https://github.com/kikito/inspect.lua)
- `luarocks install inspect`

> [!IMPORTANT]
> Do not edit the `README.md`, `doc/crates.txt` or wiki files.\
> They are automatically generated.
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
.PHONY: types
types:
./scripts/gen_types.lua
nvim -l scripts/gen_types.lua

.PHONY: test
test:
nvim --headless --noplugin -u test/minimal.vim -c "lua require(\"plenary.test_harness\").test_directory_command('test {minimal_init = \"test/minimal.vim\"}')"

.PHONY: doc
doc:
./docgen/gen_doc.lua
nvim -l docgen/gen_doc.lua

5 changes: 2 additions & 3 deletions docgen/gen_doc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ _=[[
exec lua "$0" "$@"
]]

local inspect = require("inspect")
local config = require("lua.crates.config.init")
local highlight = require("lua.crates.highlight")
local version = "unstable"
Expand Down Expand Up @@ -313,7 +312,7 @@ local function gen_vimdoc_config(lines, path, schema)
table.insert(lines, "")
else
local t = s.type.emmylua_annotation
local d = s.default_text or inspect(s.default)
local d = s.default_text or vim.inspect(s.default)
table.insert(lines, string.format(" Type: `%s`, Default: `%s`", t, d))
table.insert(lines, "")
end
Expand Down Expand Up @@ -352,7 +351,7 @@ local function gen_def_config(lines, indent, path, schema)
gen_def_config(lines, indent, p, s.fields)
insert_indent("},")
else
local d = s.default_text or inspect(s.default)
local d = s.default_text or vim.inspect(s.default)
insert_indent(string.format("%s = %s,", name, d))
end
end
Expand Down

0 comments on commit 7762778

Please sign in to comment.