mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-05-13 08:12:54 -07:00
harden bootstrap version load and clean plugin on uninstall
- Use pcall for version.lua in bootstrap.lua so missing version module does not crash plugin startup - Remove plugin/subminer from app-data dirs in uninstall-linux and uninstall-macos targets - Add Lua compat test asserting bootstrap uses defensive pcall for version load - Add release-workflow test asserting uninstall targets clean bundled plugin dirs - Delete completed planning document
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
local MODULE_PATHS = {
|
||||
"plugin/subminer/bootstrap.lua",
|
||||
"plugin/subminer/hover.lua",
|
||||
"plugin/subminer/environment.lua",
|
||||
"plugin/subminer/version.lua",
|
||||
@@ -49,6 +50,12 @@ local function assert_loadfile_ok(path)
|
||||
assert_true(chunk ~= nil, "loadfile failed for " .. path .. ": " .. tostring(err))
|
||||
end
|
||||
|
||||
local function assert_bootstrap_uses_defensive_version_load()
|
||||
local source = read_file("plugin/subminer/bootstrap.lua")
|
||||
assert_true(not source:find('require%("version"%)'), "bootstrap.lua must not hard-require version.lua")
|
||||
assert_true(source:find('pcall%(require, "version"%)') ~= nil, "bootstrap.lua must load version.lua with pcall")
|
||||
end
|
||||
|
||||
local function normalize_execute_result(ok, why, code)
|
||||
if type(ok) == "number" then
|
||||
return ok == 0, ok
|
||||
@@ -129,6 +136,7 @@ for _, path in ipairs(MODULE_PATHS) do
|
||||
assert_no_legacy_incompatible_continue(path)
|
||||
assert_loadfile_ok(path)
|
||||
end
|
||||
assert_bootstrap_uses_defensive_version_load()
|
||||
|
||||
local parser = find_legacy_parser()
|
||||
if parser then
|
||||
|
||||
Reference in New Issue
Block a user