Skip to content

Commit 2d149f7

Browse files
committed
use a predefined DepCtrl initialization function instead of having the requiring script specify it.
The change in @819b9c201eda5fa8127256065e8b5d8ce3e6d89c required the initialization function to be specified in the dependency list of a script. In addition to being inconvenient, this would break updating functionality when run in a different context (such as the DepCtrl toolbox)
1 parent b0ca761 commit 2d149f7

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

modules/DependencyControl.moon

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class DependencyControl
8686

8787
{@requiredModules, moduleName:@moduleName, configFile:configFile, virtual:@virtual, :name,
8888
description:@description, url:@url, feed:@feed, unmanaged:@unmanaged, :namespace,
89-
author:@author, :version, configFile:@configFile, initFunc:@initFunc,
89+
author:@author, :version, configFile:@configFile,
9090
:readGlobalScriptVars, :saveRecordToConfig} = args
9191

9292
-- also support name key (as used in configuration) for required modules
@@ -338,7 +338,8 @@ class DependencyControl
338338
._ref, LOADED_MODULES[moduleName] = res, res
339339

340340
-- run initialization function if one was specified
341-
res[mdl.initFunc] @@ if mdl.initFunc
341+
if "table" == type(res) and "function" == type res.__depCtrlInit
342+
res.__depCtrlInit @@
342343

343344
return mdl._ref -- having this in the with block breaks moonscript
344345

@@ -512,10 +513,10 @@ rec = DependencyControl{
512513
moduleName: "l0.DependencyControl",
513514
feed: "https://raw.githubusercontent.com/TypesettingTools/DependencyControl/master/DependencyControl.json",
514515
{
515-
{"DM.DownloadManager", version: "0.2.1", initFunc: "attachDepctrl"},
516-
{"BM.BadMutex", version: "0.1.2", initFunc: "attachDepctrl"},
517-
{"PT.PreciseTimer", version: "0.1.4", initFunc: "attachDepctrl"},
518-
{"requireffi.requireffi", version: "0.1.0", initFunc: "attachDepctrl"},
516+
{"DM.DownloadManager", version: "0.2.1"},
517+
{"BM.BadMutex", version: "0.1.2"},
518+
{"PT.PreciseTimer", version: "0.1.4"},
519+
{"requireffi.requireffi", version: "0.1.0"},
519520
}
520521
}
521522
DependencyControl.__class.version = rec

0 commit comments

Comments
 (0)