forked from adamthesax/node-wixtoolset
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
56 lines (49 loc) · 1.41 KB
/
index.js
File metadata and controls
56 lines (49 loc) · 1.41 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
var path = require('path');
var child_process = require('child_process');
function wixBinWrapper(exe, requiredArgs) {
return function(/* arguments */) {
var args = [], opts = {};
for (var i = 0; i < arguments.length; i++) {
if (typeof arguments[i] === 'string') {
args.push(arguments[i]);
} else if (typeof arguments[i] === 'object' && i === arguments.length-1) {
opts = arguments[i];
} else {
throw new Error("Wrong arguments for this command");
}
}
return new Promise(function(resolve, reject) {
var cmd = path.resolve(__dirname, 'wix-bin', exe);
for (var key in opts) {
args.unshift('-' + key + ' ' + opts[key]);
}
if (process.platform != "win32") {
args.unshift(cmd);
cmd = 'wine';
}
var child = child_process.spawn(cmd, args);
child.on('error', function(err) {
reject(err);
});
child.on('close', function() {
resolve();
});
});
}
}
module.exports = {
candle: wixBinWrapper('candle.exe'),
dark: wixBinWrapper('dark.exe'),
heat: wixBinWrapper('heat.exe'),
insignia: wixBinWrapper('insignia.exe'),
light: wixBinWrapper('light.exe'),
lit: wixBinWrapper('lit.exe'),
lux: wixBinWrapper('lux.exe'),
melt: wixBinWrapper('melt.exe'),
nit: wixBinWrapper('nit.exe'),
pyro: wixBinWrapper('pyro.exe'),
retina: wixBinWrapper('retina.exe'),
shine: wixBinWrapper('shine.exe'),
smoke: wixBinWrapper('smoke.exe'),
torch: wixBinWrapper('torch.exe'),
}