ferron

Ferron is a fast and simple static website generator made with Lua.
Log | Files | Refs | Submodules | README | LICENSE

commit 4dc4626e8214ee1b0e55991062a88dac5cc6b498
parent 4ec991cb302774c56ae29fcce2884c33b758b929
Author: Hugo Soucy <hugo@soucy.cc>
Date:   Mon, 15 Oct 2018 22:16:30 -0400

Finish a basic plugin system

Diffstat:
Mcornelius | 2+-
Mferron/plugin.lua | 11+++--------
2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/cornelius b/cornelius @@ -25,7 +25,7 @@ elseif arg[1] == "create" then os.execute("lua -l ferron.setpaths ferron.lua --set content") elseif arg[1] == "start" then os.execute("lua -l ferron.setpaths ferron.lua --make site") -elseif arg[1] == "-p" and type(arg[2]) == "string" and arg[2] ~= "" then +elseif arg[1] == "plugin" and type(arg[2]) == "string" and arg[2] ~= "" then os.execute("lua -l ferron.setpaths ferron.lua --run " .. arg[2]) else print("Hi, I'm Cornelius Ferron, the eminence of the great horn of the static site generator... or if you prefer, the CLI.") diff --git a/ferron/plugin.lua b/ferron/plugin.lua @@ -1,18 +1,13 @@ --[[ Plugin Module ]]-- - --- Required Packages -inspect = require "inspect" - --- Module Declaration local plugin = {} function plugin.run(site, plugname) - print(inspect(site.path), plugname) - os.execute("pwd") + local path = require "path" + local plugin = require(site.config.sites .. path.basename(site.path) .. "/plugins/" .. plugname) - os.execute("lua " .. site.path .. "/plugins/" .. plugname .. "/" .. plugname .. ".lua") + return plugin.init(site) end return plugin