commit ded2dbd3fefc27905e02587de2d1dbac141378aa
parent 298596c681ac786ce07e80d4bc134f6db38bd8fc
Author: Hugo Soucy <hugo@soucy.cc>
Date: Mon, 9 Apr 2018 08:10:01 -0400
Put exec function in a seperate file.
Diffstat:
2 files changed, 22 insertions(+), 14 deletions(-)
diff --git a/ferron.lua b/ferron.lua
@@ -12,6 +12,8 @@ if Ferron.devmode == true then
inspect = require "inspect"
end
+inspect = require "inspect"
+
-- Ferron's Modules
local site = require "ferron.site"
local content = require "ferron.content"
@@ -21,22 +23,10 @@ local feed = require "ferron.feed"
local link = require "ferron.link"
local tag = require "ferron.tag"
local static = require "ferron.static"
-
-local exec = function(...)
- for argkey, argval in pairs({...}) do
- if type(argval) == "table" then
- for funckey, funcval in ipairs(argval) do
- if type(funcval) == "function" then
- funcval()
- end
- end
- end
- end
-end
+local exec = require "ferron.utilities.exec"
Ferron.init = {
site.setsite,
- content.getarchetypes,
content.makecontent
}
@@ -50,4 +40,8 @@ Ferron.build = {
static.move
}
-exec(Ferron.init, Ferron.build)
+if arg[1] == "--set" and arg[2] == "archetype" then
+ return content.setarchetype(site.setsite())
+else
+ return exec(Ferron.init, Ferron.build)
+end
diff --git a/ferron/utilities/exec.lua b/ferron/utilities/exec.lua
@@ -0,0 +1,14 @@
+--
+local exec = function(...)
+ for argkey, argval in pairs({...}) do
+ if type(argval) == "table" then
+ for funckey, funcval in ipairs(argval) do
+ if type(funcval) == "function" then
+ funcval()
+ end
+ end
+ end
+ end
+end
+
+return exec