forked from deis/deisrel
/
repo_names.go
58 lines (51 loc) · 1.66 KB
/
repo_names.go
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
package git
var (
// TODO: https://github.com/deis/deisrel/issues/12
repoToComponentNames = map[string][]string{
"builder": {"Builder"},
"controller": {"Controller"},
"dockerbuilder": {"DockerBuilder"},
"fluentd": {"FluentD"},
"monitor": {"InfluxDB", "Grafana", "Telegraf"},
"logger": {"Logger"},
"minio": {"Minio"},
"nsq": {"NSQ"},
"postgres": {"Database"},
"registry": {"Registry"},
"router": {"Router"},
"slugbuilder": {"SlugBuilder"},
"slugrunner": {"SlugRunner"},
"workflow-e2e": {"WorkflowE2E"},
"workflow-manager": {"WorkflowManager"},
}
repoNames = getRepoNames(repoToComponentNames)
componentNames = getComponentNames(repoToComponentNames)
)
// RepoNames returns a slice of known repository names
func RepoNames() []string {
return repoNames
}
// ComponentNames returns a slice of known component names
func ComponentNames() []string {
return componentNames
}
// RepoToComponentNames returns a mapping from each repository name to its known component names
func RepoToComponentNames() map[string][]string {
return repoToComponentNames
}
func getRepoNames(repoToComponentNames map[string][]string) []string {
repoNames := make([]string, 0, len(repoToComponentNames))
for repoName := range repoToComponentNames {
repoNames = append(repoNames, repoName)
}
return repoNames
}
func getComponentNames(repoToComponentNames map[string][]string) []string {
var ret []string
for _, componentNames := range repoToComponentNames {
for _, componentName := range componentNames {
ret = append(ret, componentName)
}
}
return ret
}