aboutsummaryrefslogtreecommitdiffstats
path: root/make-feed.lua
diff options
context:
space:
mode:
authorgarret <garret@airmail.cc>2022-11-28 23:45:19 +0000
committergarret <garret@airmail.cc>2022-11-28 23:47:01 +0000
commit183595cbe87b32938f2492877323eea07425ad45 (patch)
treeb348b23b464ee775bd4820113c6b9f15832d6de6 /make-feed.lua
parent22e37d6e6e2278764163fc53a989352a3ea77bfd (diff)
downloaddepctrl-feedmaker-183595cbe87b32938f2492877323eea07425ad45.tar.gz
depctrl-feedmaker-183595cbe87b32938f2492877323eea07425ad45.tar.bz2
depctrl-feedmaker-183595cbe87b32938f2492877323eea07425ad45.zip
make the fake require return the fake depctrl when requiring l0.DependencyControl
don't need the separate file or path fuckery any more may use path fuckery again in the future
Diffstat (limited to 'make-feed.lua')
-rwxr-xr-xmake-feed.lua48
1 files changed, 36 insertions, 12 deletions
diff --git a/make-feed.lua b/make-feed.lua
index 17c06c2..8f1e240 100755
--- a/make-feed.lua
+++ b/make-feed.lua
@@ -15,13 +15,6 @@ local args = parser:parse()
local config = loadfile(args.config)()
-local function script_path()
- local str = debug.getinfo(2, "S").source:sub(2)
- return str:match("(.*/)")
-end
-
-package.path = script_path() .. "?.lua;" .. package.path -- add the script dir to the lua path so scripts can access the fake depctrl
-
local function valid_namespace(name)
--[[ #### Rules for a valid namespace: ####
@@ -112,16 +105,47 @@ local function get_file_metadata(file)
return sha1, lastmodified
end
+local noop = function() end
+
+local function fake_depctrl(i)
+ __feedmaker_version = i
+ return {
+ checkVersion = noop,
+ getConfigFileName = noop,
+ getConfigHandler = noop,
+ getLogger = noop,
+ getVersionNumber = noop,
+ getVersionString = noop,
+ loadConfig = noop,
+ loadModule = noop,
+ moveFile = noop,
+ register = noop,
+ registerMacro = noop,
+ registerMacros = noop,
+ registerTests = noop,
+ requireModules = noop,
+ writeConfig = noop,
+ getUpdaterErrorMsg = noop,
+ getUpdaterLock = noop,
+ releaseUpdaterLock = noop,
+ update = noop,
+ }
+end
+
local function run_file(file, extension)
local runner
local old_require = require
_G.require = function(obj)
- local got, lib = pcall(old_require, obj)
- if got then
- return lib
+ if obj == "l0.DependencyControl" then
+ return fake_depctrl
else
- err(file .. " tried to require " .. obj .. " but couldn't. skipping and hoping it won't matter.")
- return {} --Some default value, hopefully it should be fine with it
+ local got, lib = pcall(old_require, obj)
+ if got then
+ return lib
+ else
+ err(file .. " tried to require " .. obj .. " but couldn't. skipping and hoping it won't matter.")
+ return {} --Some default value, hopefully it should be fine with it
+ end
end
end