mirror of
https://github.com/lazuscripts/locator.git
synced 2024-11-19 10:54:24 +00:00
locator allows registry fns in root config
This commit is contained in:
parent
6c39c1cbd1
commit
0d566bf103
@ -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]
|
||||||
|
Loading…
Reference in New Issue
Block a user