From b6d869c3f3ce9381f8717bcc72c66e5d2fcf516d Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Mon, 15 Aug 2016 13:53:01 +0100 Subject: [PATCH] docs: move all eolian init logic into doctree --- src/scripts/elua/apps/docgen/doctree.lua | 18 ++++++++++++++++-- src/scripts/elua/apps/gendoc.lua | 15 +++------------ 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/scripts/elua/apps/docgen/doctree.lua b/src/scripts/elua/apps/docgen/doctree.lua index 3c1967d535..08089223da 100644 --- a/src/scripts/elua/apps/docgen/doctree.lua +++ b/src/scripts/elua/apps/docgen/doctree.lua @@ -428,9 +428,23 @@ M.Event = Node:clone { M.scan_directory = function(dir) if not dir then - return eolian.system_directory_scan() + if not eolian.system_directory_scan() then + error("failed scanning system directory") + end + return + end + if not eolian.directory_scan(dir) then + error("failed scanning directory: " .. dir) + end +end + +M.parse = function() + if not eolian.all_eot_files_parse() then + error("failed parsing eo type files") + end + if not eolian.all_eo_files_parse() then + error("failed parsing eo files") end - return eolian.directory_scan(dir) end return M diff --git a/src/scripts/elua/apps/gendoc.lua b/src/scripts/elua/apps/gendoc.lua index 0329351904..01fbf03738 100644 --- a/src/scripts/elua/apps/gendoc.lua +++ b/src/scripts/elua/apps/gendoc.lua @@ -1092,22 +1092,13 @@ getopt.parse { dr = dutil.path_join(dr, dutil.nspace_to_path(rootns)) dutil.init(dr) if #args == 0 then - if not dtree.scan_directory() then - error("failed scanning system directory") - end + dtree.scan_directory() else for i, p in ipairs(args) do - if not dtree.scan_directory(p) then - error("failed scanning directory: " .. p) - end + dtree.scan_directory(p) end end - if not eolian.all_eot_files_parse() then - error("failed parsing eo type files") - end - if not eolian.all_eo_files_parse() then - error("failed parsing eo files") - end + dtree.parse() stats.init(not not opts["v"]) local wfeatures = { notes = not opts["disable-notes"],