-
Notifications
You must be signed in to change notification settings - Fork 2
/
content-source-factory.js
42 lines (39 loc) · 1.27 KB
/
content-source-factory.js
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
class ContentSourceFactory {
mavenClient;
git;
logger;
/**
*
* @param {MavenClient} mavenClient
* @param {Git} git
* @param logger
*/
constructor(mavenClient, git, logger) {
this.mavenClient = mavenClient;
this.git = git;
this.logger = logger;
}
/**
* @param {MavenRepository[]} repositories
* @param {MavenContentCoordinate[]} coordinates
* @param playbook
* @returns {Promise<void>}
*/
async produceContentSourcesIntoPlaybook(repositories, coordinates, playbook) {
await Promise.all(coordinates.map(async (coordinate) => {
await Promise.all(
(await coordinate.resolveToContentSources(
this.mavenClient,
repositories,
this.git,
playbook.runtime?.cacheDir ? playbook.runtime.cacheDir + '/maven' : '.cache/maven',
this.logger)
)
.map(contentSource => {
this.logger.info("Adding " + contentSource + ' to playbook.')
return contentSource.addAsSourceToPlaybook(playbook)
}));
}));
}
}
module.exports = ContentSourceFactory