locator allows registry fns in root config

This commit is contained in:
Paul Liverman III 2018-02-11 17:23:48 -08:00
parent 6c39c1cbd1
commit 0d566bf103

View File

@ -57,11 +57,15 @@ make_migrations = (app_migrations={}) ->
-- sub-applications can define custom functions in a `locator_config` file in -- sub-applications can define custom functions in a `locator_config` file in
-- their root directory. These functions are aggregated by name and called in -- their root directory. These functions are aggregated by name and called in
-- the order defined by the paths in the root locator_config -- the order defined by the paths in the root locator_config (with the root
-- note: the root locator_config cannot define any of these -- being called first)
registry = setmetatable {}, { registry = setmetatable {}, {
__index: (t, name) -> __index: (t, name) ->
registered_functions = {} registered_functions = {}
if config[name]
insert registered_functions, config[name]
for item in *config for item in *config
ok, register = pcall -> require "#{item.path}.locator_config" ok, register = pcall -> require "#{item.path}.locator_config"
if ok and register[name] if ok and register[name]