-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathModuleConfig.cfc
38 lines (31 loc) · 1.29 KB
/
ModuleConfig.cfc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
component {
this.cfmapping = 'cfformat';
this.autoMapModels = false;
function configure() {
settings = {
downloadURL: 'https://github.com/jcberquist/cftokens/releases/download/{version}/',
executable: ''
};
}
function onLoad() {
var cftokens = new cftokens(wirebox);
var fullModulePath = modulePath.replace('\', '/', 'all') & (modulePath.endswith('/') ? '' : '/');
var cftokensVersion = deserializeJSON(fileRead(fullModulePath & 'box.json')).cftokens;
var binFolder = fullModulePath & 'bin/#cftokensVersion#/';
var executable = settings.executable.len() ? settings.executable : cftokens.getExecutable();
var executableName = executable.find('_') ? 'cftokens' : 'cftokens.exe';
cftokens.ensureExecutableExists(
binFolder & executableName,
settings.downloadURL.replace('{version}', cftokensVersion) & executable
);
binder
.map('cfformatutils@commandbox-cfformat')
.to('#moduleMapping#.models.CFFormatUtils')
.asSingleton();
binder
.map('cfformat@commandbox-cfformat')
.to('#moduleMapping#.models.CFFormat')
.asSingleton()
.initWith(binFolder, fullModulePath);
}
}