ferron

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

commit 414ba74a7c7a3088ed153b2fd3c9b0ca839165a7
parent 2700f029e3efccec63822841dd10e21ef7dc3cce
Author: Hugo Soucy <hugo.soucy@savoirfairelinux.com>
Date:   Fri,  2 Feb 2018 11:16:38 -0500

Remove parenthesis from require calls

Diffstat:
Mferron.lua | 32++++++++++++++++----------------
Mferron/archetype.lua | 8++++----
Mferron/feed.lua | 8++++----
Mferron/list.lua | 15++++++++-------
Mferron/page.lua | 12++++++------
Mferron/site.lua | 15++++++++-------
Mferron/static.lua | 17++++++++++++-----
Mferron/utilities/file-utils.lua | 2+-
Mferron/utilities/template-utils.lua | 4++--
9 files changed, 61 insertions(+), 52 deletions(-)

diff --git a/ferron.lua b/ferron.lua @@ -5,16 +5,14 @@ -- Init the main module Ferron = {} -local Ferron = Ferron - --- Ferron submodules -local config = require("config") -local site = require("ferron.site") -local archetype = require("ferron.archetype") -local page = require("ferron.page") -local list = require("ferron.list") -local feed = require("ferron.feed") -local static = require("ferron.static") +-- Ferron's Modules +local config = require "config" +local site = require "ferron.site" +local archetype = require "ferron.archetype" +local page = require "ferron.page" +local list = require "ferron.list" +local feed = require "ferron.feed" +local static = require "ferron.static" local exec = function(...) for argkey, argval in pairs({...}) do @@ -28,27 +26,29 @@ local exec = function(...) end end -inspect = require("inspect") - Ferron.config = config Ferron.site = {} Ferron.archetypes = {} Ferron.devmode = (arg[1] == "--dev" and true or false) -Ferron.initfunctions = { +if Ferron.devmode == true then + inspect = require "inspect" +end + +Ferron.init = { site.getsites, site.setsite, archetype.getarchetypes, archetype.createcontent } -Ferron.buildfunctions = { +Ferron.build = { page.makepage, list.makelist, feed.makefeed, static.move } -exec(Ferron.initfunctions, Ferron.buildfunctions) +exec(Ferron.init, Ferron.build) -return Ferron +--return Ferron diff --git a/ferron/archetype.lua b/ferron/archetype.lua @@ -1,8 +1,8 @@ -- -local path = require("path") -local fileutils = require("ferron.utilities.file-utils") -local tableutils = require("ferron.utilities.table-utils") -local templateutils = require("ferron.utilities.template-utils") +local path = require "path" +local fileutils = require "ferron.utilities.file-utils" +local tableutils = require "ferron.utilities.table-utils" +local templateutils = require "ferron.utilities.template-utils" local archetype = {} function archetype.getarchetypes() diff --git a/ferron/feed.lua b/ferron/feed.lua @@ -1,8 +1,8 @@ -- -local path = require("path") -local fileutils = require("ferron.utilities.file-utils") -local tableutils = require("ferron.utilities.table-utils") -local templateutils = require("ferron.utilities.template-utils") +local path = require "path" +local fileutils = require "ferron.utilities.file-utils" +local tableutils = require "ferron.utilities.table-utils" +local templateutils = require "ferron.utilities.template-utils" local feed = {} function feed.makefeed() diff --git a/ferron/list.lua b/ferron/list.lua @@ -1,11 +1,12 @@ -- -local json = require("dkjson") -local markdown = require("markdown") -local path = require("path") -local fileutils = require("ferron.utilities.file-utils") -local tableutils = require("ferron.utilities.table-utils") -local templateutils = require("ferron.utilities.template-utils") -local static = require("ferron.static") +local json = require "dkjson" +local markdown = require "markdown" +local path = require "path" +local fileutils = require "ferron.utilities.file-utils" +local tableutils = require "ferron.utilities.table-utils" +local templateutils = require "ferron.utilities.template-utils" +local static = require "ferron.static" + local list = {} local function sortentries(entries_tb, list_mt) diff --git a/ferron/page.lua b/ferron/page.lua @@ -1,10 +1,10 @@ -- -local json = require("dkjson") -local markdown = require("markdown") -local path = require("path") -local fileutils = require("ferron.utilities.file-utils") -local tableutils = require("ferron.utilities.table-utils") -local templateutils = require("ferron.utilities.template-utils") +local json = require "dkjson" +local markdown = require "markdown" +local path = require "path" +local fileutils = require "ferron.utilities.file-utils" +local tableutils = require "ferron.utilities.table-utils" +local templateutils = require "ferron.utilities.template-utils" local page = {} function page.makepage() diff --git a/ferron/site.lua b/ferron/site.lua @@ -1,8 +1,9 @@ -local path = require("path") -local tableutils = require("ferron.utilities.table-utils") -local fileutils = require("ferron.utilities.file-utils") +local path = require "path" +local tableutils = require "ferron.utilities.table-utils" +local fileutils = require "ferron.utilities.file-utils" local site = {} + local sites_tb = {} local sites_list = {} @@ -31,7 +32,7 @@ end function site.setsite() -- Site chooser: Which site do you want to build? - local answer + local whichsite = nil repeat io.write("Welcome to Ferron! Which site do you want to build? \n") @@ -43,10 +44,10 @@ function site.setsite() io.write("Please enter the number... \n") io.flush() - answer=io.read() - until (tableutils.haskey(sites_list, tonumber(answer))) == true + whichsite=io.read() + until (tableutils.haskey(sites_list, tonumber(whichsite))) == true - Ferron.site = sites_tb[sites_list[tonumber(answer)]] + Ferron.site = sites_tb[sites_list[tonumber(whichsite)]] Ferron.site.config.SITE.BASEURL = (Ferron.devmode == true and Ferron.site.config.SITE.URLDEV or Ferron.site.config.SITE.URL) Ferron.site.config.SITE.PREFETCHLIST = {} diff --git a/ferron/static.lua b/ferron/static.lua @@ -1,8 +1,15 @@ -local lfs = require("lfs") -local mimetypes = require('mimetypes') -local path = require("path") -local fileutils = require("ferron.utilities.file-utils") -local tableutils = require("ferron.utilities.table-utils") +--[[ + Static Module +]]-- + +-- Required Packages +local lfs = require "lfs" +local mimetypes = require 'mimetypes' +local path = require "path" +local fileutils = require "ferron.utilities.file-utils" +local tableutils = require "ferron.utilities.table-utils" + +-- Module Declaration local static = {} function static.dispatch(file) diff --git a/ferron/utilities/file-utils.lua b/ferron/utilities/file-utils.lua @@ -1,5 +1,5 @@ -- -local lfs = require("lfs") +local lfs = require "lfs" local fileutils = {} -- loadlocalconfig diff --git a/ferron/utilities/template-utils.lua b/ferron/utilities/template-utils.lua @@ -1,6 +1,6 @@ -- -local lustache = require("lustache") -local fileutils = require("ferron.utilities.file-utils") +local lustache = require "lustache" +local fileutils = require "ferron.utilities.file-utils" local templateutils = {}