ferron

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

commit 5ab891ef3eb42cbfe001036fa3ea61408c5c2433
parent 2c51b835e04b0db1416f80348afb1470a2dde2a3
Author: Hugo Soucy <hugo.soucy@equisoft.com>
Date:   Wed, 15 May 2019 08:27:01 -0400

Merge branch 'master' of github.com:hs0ucy/Ferron

Diffstat:
Mcornelius | 26++++++++++++++++++++++++++
Mferron/init.lua | 2+-
Mferron/page.lua | 2+-
Msites/.gitignore | 4++--
Rsites/ferron-ssg.tld/archetypes/.gitignore -> sites/ferron-ssgtld/archetypes/.gitignore | 0
Rsites/ferron-ssg.tld/archetypes/doc.json -> sites/ferron-ssgtld/archetypes/doc.json | 0
Rsites/ferron-ssg.tld/archetypes/doc.md -> sites/ferron-ssgtld/archetypes/doc.md | 0
Rsites/ferron-ssg.tld/config.lua -> sites/ferron-ssgtld/config.lua | 0
Rsites/ferron-ssg.tld/content/index.json -> sites/ferron-ssgtld/content/index.json | 0
Rsites/ferron-ssg.tld/content/index.md -> sites/ferron-ssgtld/content/index.md | 0
Rsites/ferron-ssg.tld/data/.gitignore -> sites/ferron-ssgtld/data/.gitignore | 0
Rsites/ferron-ssg.tld/public_html/.gitignore -> sites/ferron-ssgtld/public_html/.gitignore | 0
Rsites/ferron-ssg.tld/static/css/style.css -> sites/ferron-ssgtld/static/css/style.css | 0
Rsites/ferron-ssg.tld/templates/default-index.mustache -> sites/ferron-ssgtld/templates/default-index.mustache | 0
Rsites/ferron-ssg.tld/templates/default.mustache -> sites/ferron-ssgtld/templates/default.mustache | 0
Rsites/ferron-ssg.tld/templates/feed/atom.mustache -> sites/ferron-ssgtld/templates/feed/atom.mustache | 0
Rsites/ferron-ssg.tld/templates/feed/rss2.mustache -> sites/ferron-ssgtld/templates/feed/rss2.mustache | 0
Rsites/ferron-ssg.tld/templates/partials/footer.mustache -> sites/ferron-ssgtld/templates/partials/footer.mustache | 0
Rsites/ferron-ssg.tld/templates/partials/head.mustache -> sites/ferron-ssgtld/templates/partials/head.mustache | 0
19 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/cornelius b/cornelius @@ -5,6 +5,19 @@ local config = require 'ferron.config' +local function getdirfiles(dir) + local p = io.popen('find "'..dir..'" -type f') + local dirtree = {} + + for file in p:lines() do + if entry ~= '.' and entry ~= '..' then + table.insert(dirtree, file) + end + end + + return dirtree +end + if arg[1] == 'install' and tonumber(_VERSION:match('%d+%.%d+')) >= config.dependencies.lua then -- First, check if luarocks is present in the env. if pcall(require, 'luarocks.loader') then @@ -12,6 +25,19 @@ if arg[1] == 'install' and tonumber(_VERSION:match('%d+%.%d+')) >= config.depend for i, dependency in ipairs(config.dependencies.modules) do os.execute ('luarocks install --tree lua_modules ' .. dependency) end + + -- After looks for other dependencies in site's config file + for i, file in pairs(getdirfiles('sites')) do + if file:find('config.lua') then + local configfile, error = loadfile(file) + + if configfile().dependencies then + for _, dependency in ipairs(configfile().dependencies.modules) do + os.execute ('luarocks install --tree lua_modules ' .. dependency) + end + end + end + end else print('Ferron needs Luarocks for installing his dependencies.') print('Please install it on your system https://luarocks.org/.') diff --git a/ferron/init.lua b/ferron/init.lua @@ -35,7 +35,7 @@ Ferron = { }, build = { - page.init, + page.iterator, link.makeshorts, link.makerewritemap, static.init, diff --git a/ferron/page.lua b/ferron/page.lua @@ -116,7 +116,7 @@ function page.render(pagesource) return print(metaTable.date .. ' - ' .. metaTable.title) end -function page.init() +function page.iterator() local contentpath = tableutils.from(fileutils.getdirtree(fileutils.isDirectory(Ferron.site.content))) local singlepages = tableutils.filter(fileutils.isNotIndex, contentpath) local indexpages = tableutils.filter(fileutils.isIndex, contentpath) diff --git a/sites/.gitignore b/sites/.gitignore @@ -2,5 +2,5 @@ * # Except those files !.gitignore -!/ferron-ssg.tld -!/ferron-ssg.tld/**/* +!/ferron-ssgtld +!/ferron-ssgtld/**/* diff --git a/sites/ferron-ssg.tld/archetypes/.gitignore b/sites/ferron-ssgtld/archetypes/.gitignore diff --git a/sites/ferron-ssg.tld/archetypes/doc.json b/sites/ferron-ssgtld/archetypes/doc.json diff --git a/sites/ferron-ssg.tld/archetypes/doc.md b/sites/ferron-ssgtld/archetypes/doc.md diff --git a/sites/ferron-ssg.tld/config.lua b/sites/ferron-ssgtld/config.lua diff --git a/sites/ferron-ssg.tld/content/index.json b/sites/ferron-ssgtld/content/index.json diff --git a/sites/ferron-ssg.tld/content/index.md b/sites/ferron-ssgtld/content/index.md diff --git a/sites/ferron-ssg.tld/data/.gitignore b/sites/ferron-ssgtld/data/.gitignore diff --git a/sites/ferron-ssg.tld/public_html/.gitignore b/sites/ferron-ssgtld/public_html/.gitignore diff --git a/sites/ferron-ssg.tld/static/css/style.css b/sites/ferron-ssgtld/static/css/style.css diff --git a/sites/ferron-ssg.tld/templates/default-index.mustache b/sites/ferron-ssgtld/templates/default-index.mustache diff --git a/sites/ferron-ssg.tld/templates/default.mustache b/sites/ferron-ssgtld/templates/default.mustache diff --git a/sites/ferron-ssg.tld/templates/feed/atom.mustache b/sites/ferron-ssgtld/templates/feed/atom.mustache diff --git a/sites/ferron-ssg.tld/templates/feed/rss2.mustache b/sites/ferron-ssgtld/templates/feed/rss2.mustache diff --git a/sites/ferron-ssg.tld/templates/partials/footer.mustache b/sites/ferron-ssgtld/templates/partials/footer.mustache diff --git a/sites/ferron-ssg.tld/templates/partials/head.mustache b/sites/ferron-ssgtld/templates/partials/head.mustache