-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathCompositionRoot.ts
236 lines (228 loc) · 7.79 KB
/
CompositionRoot.ts
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
import ChildProcessGateway from 'gateway/ChildProcessGateway';
import EditorGateway from 'gateway/EditorGateway';
import EnvVar from 'process/EnvVar';
import FsGateway from 'gateway/FsGateway';
import HttpGateway from 'gateway/HttpGateway';
import OsGateway from 'gateway/OsGateway';
import ProcessGateway from 'gateway/ProcessGateway';
import ReporterGateway from 'gateway/ReporterGateway';
import AllConfigFiles from 'config/AllConfigFiles';
import AllJobs from 'job/AllJobs';
import BuildAgentSettings from 'config/BuildAgentSettings';
import Children from 'job/Children';
import Images from 'containerization/Images';
import CommandDecorators from 'terminal/CommandDecorators';
import CommandFactory from 'job/ComandFactory';
import Complain from 'command/Complain';
import Config from 'config/Config';
import ConfigFile from 'config/ConfigFile';
import CreateConfigFile from 'command/CreateConfigFile';
import DebugRepo from 'command/DebugRepo';
import Docker from 'containerization/Docker';
import Email from 'license/Email';
import EnterLicense from 'command/EnterLicense';
import EnterToken from 'command/EnterToken';
import EnvPath from 'common/EnvPath';
import ExitAllJobs from 'command/ExitAllJobs';
import ExitJob from 'command/ExitJob';
import FinalTerminal from 'terminal/FinalTerminal';
import FirstActivation from 'job/FirstActivation';
import GetLicense from 'command/GetLicense';
import Help from 'command/Help';
import JobFactory from 'job/JobFactory';
import JobListener from 'job/JobListener';
import JobProviderFactory from 'job/JobProviderFactory';
import JobRunner from 'job/JobRunner';
import JobTerminals from 'terminal/JobTerminals';
import LatestCommittedImage from 'containerization/LatestCommittedImage';
import LocalCi from './common/LocalCi';
import License from 'license/License';
import LicenseInput from 'license/LicenseInput';
import LicensePresenter from 'license/LicensePresenter';
import LicenseProviderFactory from 'license/LicenseProviderFactory';
import LogFactory from 'log/LogFactory';
import LogFile from 'log/LogFile';
import LogProviderFactory from 'log/LogProviderFactory';
import NativeCommandFactory from 'job/NativeComandFactory';
import ParsedConfig from 'config/ParsedConfig';
import Persistence from 'process/Persistence';
import PipelineParameter from 'config/PipelineParameter';
import ProcessFile from 'process/ProcessFile';
import Refresh from 'command/Refresh';
import RefreshLicenseTree from 'command/RefreshLicenseTree';
import RegistrarFactory from 'common/RegistrarFactory';
import ReRunJob from 'command/ReRunJob';
import Retryer from 'job/Retryer';
import RunJob from 'command/RunJob';
import RunningContainer from 'containerization/RunningContainer';
import RunWalkthroughJob from 'command/RunWalkthroughJob';
import SelectRepo from 'command/SelectRepo';
import ShowLogFile from 'command/ShowLogFile';
import Spawn from 'common/Spawn';
import StartDocker from 'command/StartDocker';
import TryProcessAgain from 'command/TryProcessAgain';
import UncommittedFile from 'containerization/UncommittedFile';
import Volume from 'containerization/Volume';
import WarningCommandFactory from 'job/WarningCommandFactory';
import WarningFactory from 'job/WarningFactory';
import Workspace from 'common/Workspace';
const childProcessGateway = new ChildProcessGateway();
const editorGateway = new EditorGateway();
const fsGateway = new FsGateway();
const httpGateway = new HttpGateway();
const osGateway = new OsGateway();
const processGateway = new ProcessGateway();
const reporterGateway = new ReporterGateway(editorGateway);
const parsedConfig = new ParsedConfig(fsGateway);
const allJobs = new AllJobs(parsedConfig);
const envPath = new EnvPath(osGateway, processGateway);
const workspace = new Workspace(editorGateway);
const commandFactory = new CommandFactory(editorGateway);
const jobFactory = new JobFactory(editorGateway);
const logFactory = new LogFactory(editorGateway);
const warningFactory = new WarningFactory(editorGateway);
const warningCommandFactory = new WarningCommandFactory(warningFactory);
const spawn = new Spawn(envPath, processGateway, workspace);
const buildAgentSettings = new BuildAgentSettings(
childProcessGateway,
osGateway,
spawn
);
const children = new Children(
commandFactory,
editorGateway,
jobFactory,
logFactory,
new NativeCommandFactory(),
warningCommandFactory,
warningFactory
);
const pipelineParameter = new PipelineParameter(fsGateway);
const envVar = new EnvVar(childProcessGateway, spawn);
const volume = new Volume(fsGateway);
const persistence = new Persistence(volume);
const processFile = new ProcessFile(envVar, fsGateway, persistence);
const config = new Config(
childProcessGateway,
editorGateway,
fsGateway,
pipelineParameter,
processFile,
spawn
);
const allConfigFiles = new AllConfigFiles(editorGateway);
const configFile = new ConfigFile(
allConfigFiles,
editorGateway,
reporterGateway
);
const createConfigFile = new CreateConfigFile(editorGateway, reporterGateway);
const debugRepo = new DebugRepo(editorGateway, reporterGateway);
const docker = new Docker(childProcessGateway, spawn);
const email = new Email(editorGateway, httpGateway, reporterGateway);
const enterToken = new EnterToken(editorGateway);
const images = new Images(childProcessGateway, spawn);
const exitAllJobs = new ExitAllJobs(images, editorGateway, reporterGateway);
const finalTerminal = new FinalTerminal(
childProcessGateway,
editorGateway,
spawn
);
const logFile = new LogFile(editorGateway);
const jobListener = new JobListener(
childProcessGateway,
images,
configFile,
editorGateway,
fsGateway,
logFile,
parsedConfig,
spawn
);
const latestCommittedImage = new LatestCommittedImage(
spawn,
childProcessGateway
);
const runningContainer = new RunningContainer(spawn, childProcessGateway);
const uncommittedFile = new UncommittedFile(
childProcessGateway,
editorGateway,
spawn
);
const jobRunner = new JobRunner(
buildAgentSettings,
new CommandDecorators(editorGateway),
configFile,
editorGateway,
finalTerminal,
fsGateway,
images,
jobFactory,
jobListener,
latestCommittedImage,
parsedConfig,
runningContainer,
uncommittedFile
);
const jobTerminals = new JobTerminals(editorGateway);
const exitJob = new ExitJob(jobFactory, jobRunner, jobTerminals);
const getLicense = new GetLicense(editorGateway);
const license = new License(editorGateway, httpGateway);
const retryer = new Retryer();
const jobProviderFactory = new JobProviderFactory(
allConfigFiles,
children,
configFile,
commandFactory,
docker,
editorGateway,
fsGateway,
license,
config,
jobFactory,
logFactory,
reporterGateway,
retryer,
warningFactory,
allJobs
);
const licenseInput = new LicenseInput(editorGateway, license);
const licensePresenter = new LicensePresenter(license);
const licenseProviderFactory = new LicenseProviderFactory(
license,
licenseInput,
licensePresenter,
editorGateway
);
const registrarFactory = new RegistrarFactory(
new Complain(editorGateway),
configFile,
createConfigFile,
debugRepo,
new EnterLicense(licenseInput),
enterToken,
exitAllJobs,
exitJob,
new FirstActivation(editorGateway, reporterGateway, email),
getLicense,
new Help(editorGateway, reporterGateway),
licenseInput,
new LogProviderFactory(fsGateway),
new Refresh(),
new RefreshLicenseTree(editorGateway),
new ReRunJob(editorGateway, jobRunner, jobTerminals, reporterGateway),
new RunJob(editorGateway, jobRunner, reporterGateway),
new RunWalkthroughJob(config, configFile, editorGateway, reporterGateway),
new SelectRepo(allConfigFiles, images, editorGateway, reporterGateway),
new ShowLogFile(logFile),
new StartDocker(childProcessGateway, envPath, spawn),
new TryProcessAgain(configFile, fsGateway),
editorGateway
);
export const app = new LocalCi(
fsGateway,
jobProviderFactory,
licenseProviderFactory,
registrarFactory,
reporterGateway
);