From 7762778eb97b9bd9be3448b8f287607def2b9594 Mon Sep 17 00:00:00 2001 From: Tobias Schmitz Date: Mon, 2 Sep 2024 13:36:31 +0200 Subject: [PATCH] feat: use nvim -l to run lua build scripts --- .github/workflows/CI.yml | 22 ++++------------------ CONTRIBUTING.md | 9 --------- Makefile | 4 ++-- docgen/gen_doc.lua | 5 ++--- 4 files changed, 8 insertions(+), 32 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 15b838f9..04e6ae4b 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -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 @@ -37,6 +32,7 @@ jobs: file_pattern: lua/crates/config/types.lua commit_message: "chore: generate types" + - name: Generate docs run: make doc @@ -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 @@ -71,4 +58,3 @@ jobs: - name: Run tests run: make test timeout-minutes: 1 - diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fb6871d2..979b4e7e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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. diff --git a/Makefile b/Makefile index 97ed68e4..f891a656 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ .PHONY: types types: - ./scripts/gen_types.lua + nvim -l scripts/gen_types.lua .PHONY: test test: @@ -8,5 +8,5 @@ test: .PHONY: doc doc: - ./docgen/gen_doc.lua + nvim -l docgen/gen_doc.lua diff --git a/docgen/gen_doc.lua b/docgen/gen_doc.lua index 6c68e8f1..060c0e25 100755 --- a/docgen/gen_doc.lua +++ b/docgen/gen_doc.lua @@ -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" @@ -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 @@ -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