From 6b3220048bef393f47d40e99c06175243e90b5e7 Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Mon, 16 Aug 2021 02:18:29 -0700 Subject: [PATCH 01/11] LDoc: add script to build versioned docs --- .ldoc/build_versioned_docs.sh | 98 +++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100755 .ldoc/build_versioned_docs.sh diff --git a/.ldoc/build_versioned_docs.sh b/.ldoc/build_versioned_docs.sh new file mode 100755 index 0000000..728103f --- /dev/null +++ b/.ldoc/build_versioned_docs.sh @@ -0,0 +1,98 @@ +#!/usr/bin/env bash + +# place this file in mod ".ldoc" directory + + +d_config="$(dirname $(readlink -f $0))" + +cd "${d_config}/.." + +d_root="$(pwd)" +d_export="${d_export:-${d_root}/docs/reference}" + +cmd_ldoc="${d_root}/../ldoc/ldoc.lua" +if test -f "${cmd_ldoc}"; then + if test ! -x "${cmd_ldoc}"; then + chmod +x "${cmd_ldoc}" + fi +else + cmd_ldoc="ldoc" +fi + +# clean old files +rm -rf "${d_export}" + +# store current branch +main_branch="$(git branch --show-current)" + +html_out="\n\n\n\n\n\n\n" + +cd "${d_root}" +git checkout ${main_branch} + +echo -e "${html_out}" > "${d_export}/index.html" + +echo -e "\nDone!" From 06e4408b91cb585ca20dec4708d3b8319afbb0fb Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Mon, 16 Aug 2021 02:23:30 -0700 Subject: [PATCH 02/11] Change workflow to build versioned docs on gh-pages --- .github/workflows/reference.yml | 20 +++++++++----------- README.md | 2 +- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/.github/workflows/reference.yml b/.github/workflows/reference.yml index cd61ab9..ac55ce8 100644 --- a/.github/workflows/reference.yml +++ b/.github/workflows/reference.yml @@ -1,31 +1,29 @@ -name: Build Reference +name: Build Reference on: push: - branches: - - master + tags: + - 'v[0-9]*' jobs: build: - name: Build + name: Build Reference runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v2 - name: Setup Lua uses: leafo/gh-actions-lua@v8 with: luaVersion: 5.4 - name: Setup Lua Rocks uses: leafo/gh-actions-luarocks@v4 - - name: Setup LDoc dependencies + - name: Setup dependencies run: luarocks install --only-deps https://raw.githubusercontent.com/lunarmodules/LDoc/master/ldoc-scm-3.rockspec - name: Setup LDoc - run: git clone --single-branch --branch=custom https://github.com/AntumDeluge/ldoc.git .ldoc/ldoc && chmod +x .ldoc/ldoc/ldoc.lua - - name: Generate docs - run: chmod +x .ldoc/gendoc.sh && ./.ldoc/gendoc.sh + run: git clone --single-branch --branch=custom https://github.com/AntumDeluge/LDoc.git ldoc + - name: Checkout & Build Docs + run: git clone https://github.com/AntumMT/mod-cleaner.git cleaner && cd cleaner && chmod +x .ldoc/build_versioned_docs.sh && ./.ldoc/build_versioned_docs.sh - name: Deploy uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: docs/ + publish_dir: cleaner/docs/ diff --git a/README.md b/README.md index 9900b9b..fc2276a 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ cleaner.unsafe - [![ContentDB](https://content.minetest.net/packages/AntumDeluge/cleaner/shields/title/)][ContentDB] - [Forum](https://forum.minetest.net/viewtopic.php?t=18381) - [Git repo](https://github.com/AntumMT/mod-cleaner) -- [Reference](https://antummt.github.io/mod-cleaner/reference) +- [Reference](https://antummt.github.io/mod-cleaner/reference/latest/) - [Changelog](changelog.txt) - [TODO](TODO.txt) From b261dda15c72270a16aab5e960b2704a177d1a0c Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Mon, 16 Aug 2021 02:29:13 -0700 Subject: [PATCH 03/11] LDoc: update gendoc script to add version info --- .ldoc/gendoc.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.ldoc/gendoc.sh b/.ldoc/gendoc.sh index 6339dea..75ef2c3 100755 --- a/.ldoc/gendoc.sh +++ b/.ldoc/gendoc.sh @@ -10,7 +10,6 @@ cd "${d_ldoc}/.." d_root="$(pwd)" d_export="${d_export:-${d_root}/docs/reference}" -d_data="${d_export}/data" cmd_ldoc="${d_ldoc}/ldoc/ldoc.lua" if test ! -x "${cmd_ldoc}"; then @@ -20,8 +19,11 @@ fi # clean old files rm -rf "${d_export}" +vinfo="v$(grep "^version = " "${d_root}/mod.conf" | head -1 | sed -e 's/version = //')" +d_data="${d_export}/${vinfo}/data" + # generate new doc files -"${cmd_ldoc}" --UNSAFE_NO_SANDBOX --multimodule -c "${f_config}" -d "${d_export}" "${d_root}"; retval=$? +"${cmd_ldoc}" --UNSAFE_NO_SANDBOX --multimodule -c "${f_config}" -d "${d_export}/${vinfo}" "${d_root}"; retval=$? # check exit status if test ${retval} -ne 0; then @@ -29,6 +31,11 @@ if test ${retval} -ne 0; then exit ${retval} fi +# show version info +for html in $(find "${d_export}/${vinfo}" -type f -name "*.html"); do + sed -i -e "s|^

[cC]leaner

$|

Cleaner (${vinfo})

|" "${html}" +done + # copy textures to data directory echo -e "\ncopying textures ..." mkdir -p "${d_data}" From 9ca550703b68579bc66cca633bedeec088a7c4b3 Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Mon, 10 Jan 2022 14:21:48 -0800 Subject: [PATCH 04/11] Fix undeclared global... https://github.com/AntumMT/mod-cleaner/issues/2 --- chat.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chat.lua b/chat.lua index 4a22126..4baf3ac 100644 --- a/chat.lua +++ b/chat.lua @@ -137,7 +137,7 @@ local function format_params(cmd) local param_count local all_params = {} if def.params then - for k, v in ipairs(def.params) do + for _, p in ipairs(def.params) do table.insert(all_params, p) end end From 93fa96d6c231d90e8de5dbdbdcf6bcfabfa31ac5 Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Sat, 18 Jan 2025 02:18:34 -0800 Subject: [PATCH 05/11] Add FIXME note --- chat.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/chat.lua b/chat.lua index 4baf3ac..3f7cf43 100644 --- a/chat.lua +++ b/chat.lua @@ -135,6 +135,7 @@ local function format_params(cmd) local def = get_cmd_def(cmd) local param_count + -- FIXME: unused? local all_params = {} if def.params then for _, p in ipairs(def.params) do From 7d47f8ff5d9722b7a501ef2845f48f683a71c99a Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Sat, 18 Jan 2025 02:27:49 -0800 Subject: [PATCH 06/11] Update for name change to Luanti --- .ldoc/config.ld | 4 ++-- README.md | 16 ++++++++-------- changelog.txt | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.ldoc/config.ld b/.ldoc/config.ld index cf24500..10e46db 100644 --- a/.ldoc/config.ld +++ b/.ldoc/config.ld @@ -13,12 +13,12 @@ end project = "Cleaner" -title = "Cleaner mod for Minetest" +title = "Cleaner mod for Luanti" format = "markdown" not_luadoc=true boilerplate = false icon = "textures/cleaner_pencil.png" -favicon = "https://www.minetest.net/media/icon.svg" +favicon = "https://www.luanti.org/media/icon.svg" file = { "settings.lua", diff --git a/README.md b/README.md index fc2276a..70253ef 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -## Cleaner mod for Minetest +## Cleaner mod for Luanti ### Description: -A [Minetest][] mod that can be used to remove/replace unknown entities, nodes, & items. Originally forked from [PilzAdam's ***clean*** mod][f.pilzadam]. +A [Luanti (Minetest)][Luanti] mod that can be used to remove/replace unknown entities, nodes, & items. Originally forked from [PilzAdam's ***clean*** mod][f.pilzadam]. ![screenshot](screenshot.png) @@ -13,7 +13,7 @@ A [Minetest][] mod that can be used to remove/replace unknown entities, nodes, & ### Requirements: -- Minetest minimum version: 5.0 +- Luanti minimum version: 5.0 - Depends: none ### Usage: @@ -73,14 +73,14 @@ cleaner.unsafe ### Links: -- [![ContentDB](https://content.minetest.net/packages/AntumDeluge/cleaner/shields/title/)][ContentDB] -- [Forum](https://forum.minetest.net/viewtopic.php?t=18381) +- [![ContentDB](https://content.luanti.org/packages/AntumDeluge/cleaner/shields/title/)][ContentDB] +- [Forum](https://forum.luanti.org/viewtopic.php?t=18381) - [Git repo](https://github.com/AntumMT/mod-cleaner) - [Reference](https://antummt.github.io/mod-cleaner/reference/latest/) - [Changelog](changelog.txt) - [TODO](TODO.txt) -[Minetest]: http://www.minetest.net/ -[f.pilzadam]: https://forum.minetest.net/viewtopic.php?t=2777 -[ContentDB]: https://content.minetest.net/packages/AntumDeluge/cleaner/ +[Luanti]: https://luanti.org/ +[f.pilzadam]: https://forum.luanti.org/viewtopic.php?t=2777 +[ContentDB]: https://content.luanti.org/packages/AntumDeluge/cleaner/ diff --git a/changelog.txt b/changelog.txt index ebbb7b4..53114ba 100644 --- a/changelog.txt +++ b/changelog.txt @@ -26,7 +26,7 @@ v1.2 v1.1 ---- - uses "register_lbm" with "run_at_every_load" instead of "register_abm" to save resources - - suggested by bell07 ( https://forum.minetest.net/viewtopic.php?p=325519#p325519 ) + - suggested by bell07 ( https://forum.luanti.org/viewtopic.php?p=325519#p325519 ) v1.0 ---- From 0d42a1bdd8792f7a10a724a24948fb1057154b45 Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Sat, 18 Jan 2025 02:28:17 -0800 Subject: [PATCH 07/11] Update ContentDB config for move to Codeberg --- .cdb.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.cdb.json b/.cdb.json index 41b45b9..ada3089 100644 --- a/.cdb.json +++ b/.cdb.json @@ -5,7 +5,7 @@ "license": "MIT", "media_license": "CC0-1.0", "tags": ["world_tools"], - "repo": "https://github.com/AntumMT/mod-cleaner", - "issue_tracker": "https://github.com/AntumMT/mod-cleaner/issues", + "repo": "https://codeberg.org/AntumLuanti/mod-cleaner", + "issue_tracker": "https://codeberg.org/AntumLuanti/mod-cleaner/issues", "forums": 18381 } From ecf52012201dc77a1d094b54ed0f53af0f2834dd Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Sat, 18 Jan 2025 02:31:16 -0800 Subject: [PATCH 08/11] Update version & changelog --- changelog.txt | 5 +++++ mod.conf | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index 53114ba..14adc71 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,9 @@ +2025-01-18 +---------- +- fix undeclared global + + v1.2.1 ---- - use sounds mod for sounds diff --git a/mod.conf b/mod.conf index 858fb6d..03b84d4 100644 --- a/mod.conf +++ b/mod.conf @@ -1,6 +1,6 @@ name = cleaner description = A mod that can be used to remove/replace unknown entities, nodes, & items. -version = 1.2.1 +version = 2025-01-18 license = MIT author = PilzAdam, Jordan Irwin (AntumDeluge) min_minetest_version = 5.0 From f35e2f1808f784698f80b3181912414820058fba Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Sat, 18 Jan 2025 02:47:43 -0800 Subject: [PATCH 09/11] Add nil check after reading world data file Closes: https://github.com/AntumMT/mod-cleaner/issues/3 --- changelog.txt | 1 + misc_functions.lua | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index 14adc71..7b7aedd 100644 --- a/changelog.txt +++ b/changelog.txt @@ -7,6 +7,7 @@ v1.2.1 ---- - use sounds mod for sounds +- added nil check after reading world data file v1.2 diff --git a/misc_functions.lua b/misc_functions.lua index 67460b1..27c8654 100644 --- a/misc_functions.lua +++ b/misc_functions.lua @@ -28,8 +28,13 @@ local function get_world_data() local wdata = {} local buffer = io.open(world_file, "r") if buffer then - wdata = core.parse_json(buffer:read("*a")) + local err + wdata, err = core.parse_json(buffer:read("*a"), nil, true) buffer:close() + if wdata == nil then + cleaner.log("warning", "reading world data file failed: " .. world_file) + wdata = {} + end end local rem_types = {"entities", "nodes", "ores",} From 209008b88d5e14940ad939f1fe925d573f2b0ff0 Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Sat, 18 Jan 2025 02:57:41 -0800 Subject: [PATCH 10/11] Update changelog --- changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.txt b/changelog.txt index 7b7aedd..0214081 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ 2025-01-18 ---------- - fix undeclared global +- added nil check after reading world data file v1.2.1 From c72b710c567af659235d7e8d224066dd431a201e Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Sat, 18 Jan 2025 03:03:20 -0800 Subject: [PATCH 11/11] Allow running reference workflow manually --- .github/workflows/reference.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/reference.yml b/.github/workflows/reference.yml index ac55ce8..29dec4c 100644 --- a/.github/workflows/reference.yml +++ b/.github/workflows/reference.yml @@ -4,6 +4,7 @@ on: push: tags: - 'v[0-9]*' + workflow_dispatch: jobs: build: