UNPKG

2.05 kBJavaScriptView Raw
1// Generated by LiveScript 1.4.0
2var async, EventEmitter, path, ServiceInstaller, AppInstaller;
3async = require('async');
4EventEmitter = require('events').EventEmitter;
5path = require('path');
6ServiceInstaller = require('./service-installer');
7AppInstaller = (function(superclass){
8 var prototype = extend$((import$(AppInstaller, superclass).displayName = 'AppInstaller', AppInstaller), superclass).prototype, constructor = AppInstaller;
9 function AppInstaller(appConfig){
10 this.appConfig = appConfig;
11 }
12 prototype.startInstallation = function(){
13 var installers, res$, i$, ref$, len$, serviceName, x$, installer, this$ = this;
14 res$ = [];
15 for (i$ = 0, len$ = (ref$ = Object.keys(this.appConfig.services)).length; i$ < len$; ++i$) {
16 serviceName = ref$[i$];
17 x$ = new ServiceInstaller(serviceName, {
18 root: path.join(process.cwd(), this.appConfig.services[serviceName].location)
19 });
20 x$.on('start', fn$);
21 x$.on('output', fn1$);
22 x$.on('finished', fn2$);
23 res$.push(x$);
24 }
25 installers = res$;
26 return async.parallel((function(){
27 var i$, ref$, len$, results$ = [];
28 for (i$ = 0, len$ = (ref$ = installers).length; i$ < len$; ++i$) {
29 installer = ref$[i$];
30 results$.push(installer.start);
31 }
32 return results$;
33 }()), function(err){
34 return this$.emit('installation-complete');
35 });
36 function fn$(name){
37 return this$.emit('start', name);
38 }
39 function fn1$(data){
40 return this$.emit('output', data);
41 }
42 function fn2$(name){
43 return this$.emit('finished', name);
44 }
45 };
46 return AppInstaller;
47}(EventEmitter));
48module.exports = AppInstaller;
49function extend$(sub, sup){
50 function fun(){} fun.prototype = (sub.superclass = sup).prototype;
51 (sub.prototype = new fun).constructor = sub;
52 if (typeof sup.extended == 'function') sup.extended(sub);
53 return sub;
54}
55function import$(obj, src){
56 var own = {}.hasOwnProperty;
57 for (var key in src) if (own.call(src, key)) obj[key] = src[key];
58 return obj;
59}
\No newline at end of file