Skip to content

Commit

Permalink
use a predefined DepCtrl initialization function instead of having th…
Browse files Browse the repository at this point in the history
…e 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)
  • Loading branch information
line0 committed Jul 26, 2015
1 parent b0ca761 commit 2d149f7
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions modules/DependencyControl.moon
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class DependencyControl

{@requiredModules, moduleName:@moduleName, configFile:configFile, virtual:@virtual, :name,
description:@description, url:@url, feed:@feed, unmanaged:@unmanaged, :namespace,
author:@author, :version, configFile:@configFile, initFunc:@initFunc,
author:@author, :version, configFile:@configFile,
:readGlobalScriptVars, :saveRecordToConfig} = args

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

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

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

Expand Down Expand Up @@ -512,10 +513,10 @@ rec = DependencyControl{
moduleName: "l0.DependencyControl",
feed: "https://raw.githubusercontent.com/TypesettingTools/DependencyControl/master/DependencyControl.json",
{
{"DM.DownloadManager", version: "0.2.1", initFunc: "attachDepctrl"},
{"BM.BadMutex", version: "0.1.2", initFunc: "attachDepctrl"},
{"PT.PreciseTimer", version: "0.1.4", initFunc: "attachDepctrl"},
{"requireffi.requireffi", version: "0.1.0", initFunc: "attachDepctrl"},
{"DM.DownloadManager", version: "0.2.1"},
{"BM.BadMutex", version: "0.1.2"},
{"PT.PreciseTimer", version: "0.1.4"},
{"requireffi.requireffi", version: "0.1.0"},
}
}
DependencyControl.__class.version = rec
Expand Down

0 comments on commit 2d149f7

Please sign in to comment.