From 0d566bf103f386cde4124e12b46b990566407e9c Mon Sep 17 00:00:00 2001 From: Paul Liverman III Date: Sun, 11 Feb 2018 17:23:48 -0800 Subject: [PATCH] locator allows registry fns in root config --- init.moon | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/init.moon b/init.moon index ff7e8d0..a9ed3c5 100644 --- a/init.moon +++ b/init.moon @@ -57,11 +57,15 @@ make_migrations = (app_migrations={}) -> -- sub-applications can define custom functions in a `locator_config` file in -- their root directory. These functions are aggregated by name and called in --- the order defined by the paths in the root locator_config --- note: the root locator_config cannot define any of these +-- the order defined by the paths in the root locator_config (with the root +-- being called first) registry = setmetatable {}, { __index: (t, name) -> registered_functions = {} + + if config[name] + insert registered_functions, config[name] + for item in *config ok, register = pcall -> require "#{item.path}.locator_config" if ok and register[name]