fix derp in locator

This commit is contained in:
Paul Liverman III 2018-02-23 03:50:32 -08:00
parent 34c0f97429
commit e9d2d03d61

View File

@ -17,20 +17,20 @@ locate = (name, path) ->
print "locate ->" print "locate ->"
if path if path
print " try '#{path}.#{name}'" print " try '#{path}.#{name}'"
ok, value = pcall -> check_require "#{path}.#{name}" ok, value = check_require "#{path}.#{name}"
return value if ok return value if ok
print " try '#{name}'" print " try '#{name}'"
ok, value = pcall -> check_require name ok, value = check_require name
return value if ok return value if ok
for item in *config for item in *config
if path if path
print " try '#{item.path}.#{path}.#{name}'" print " try '#{item.path}.#{path}.#{name}'"
ok, value = pcall -> check_require "#{item.path}.#{path}.#{name}" ok, value = check_require "#{item.path}.#{path}.#{name}"
else else
print " try '#{item.path}.#{name}'" print " try '#{item.path}.#{name}'"
ok, value = pcall -> check_require "#{item.path}.#{name}" ok, value = check_require "#{item.path}.#{name}"
return value if ok return value if ok
if path if path
@ -54,7 +54,7 @@ autoload = (path, tab={}) ->
-- (legacy) see example config for how to specify to not include early migrations -- (legacy) see example config for how to specify to not include early migrations
make_migrations = (app_migrations={}) -> make_migrations = (app_migrations={}) ->
for item in *config for item in *config
ok, migrations = pcall -> check_require "#{item.path}.migrations" ok, migrations = check_require "#{item.path}.migrations"
if ok if ok
sorted = {} sorted = {}
for m in pairs migrations for m in pairs migrations
@ -86,7 +86,7 @@ registry = setmetatable {}, {
insert registered_functions, config[name] insert registered_functions, config[name]
for item in *config for item in *config
ok, register = pcall -> check_require "#{item.path}.locator_config" ok, register = check_require "#{item.path}.locator_config"
if ok and register[name] if ok and register[name]
insert registered_functions, register[name] insert registered_functions, register[name]