From: Alexandre Terrasa Date: Fri, 17 Feb 2017 02:10:09 +0000 (-0500) Subject: nitweb: load catalog at startup instead of first page display X-Git-Url: http://nitlanguage.org nitweb: load catalog at startup instead of first page display Signed-off-by: Alexandre Terrasa --- diff --git a/src/nitweb.nit b/src/nitweb.nit index 42e1df0..370e2a2 100644 --- a/src/nitweb.nit +++ b/src/nitweb.nit @@ -63,6 +63,7 @@ private class NitwebPhase do var config = build_config(toolcontext, mainmodule) config.model.nitdoc_md_processor = config.md_processor + config.build_catalog var app = new App diff --git a/src/web/api_catalog.nit b/src/web/api_catalog.nit index bd403ad..3a4bb19 100644 --- a/src/web/api_catalog.nit +++ b/src/web/api_catalog.nit @@ -20,7 +20,12 @@ import catalog redef class NitwebConfig # Catalog to pass to handlers. - var catalog: Catalog is lazy do + var catalog: Catalog is noinit + + # Build the catalog + # + # This method should be called at nitweb startup. + fun build_catalog do var catalog = new Catalog(modelbuilder) for mpackage in model.mpackages do catalog.deps.add_node(mpackage) @@ -36,7 +41,7 @@ redef class NitwebConfig catalog.git_info(mpackage) catalog.package_page(mpackage) end - return catalog + self.catalog = catalog end end