blob: 7df0d131abf4b00c1b7dcb27ce7ba9b04b7bd715 (
plain)
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
|
package models
import "path/filepath"
type SubmoduleConfig struct {
Name string
Path string
Url string
ParentModule *SubmoduleConfig // nil if top-level
}
func (r *SubmoduleConfig) FullName() string {
if r.ParentModule != nil {
return r.ParentModule.FullName() + "/" + r.Name
}
return r.Name
}
func (r *SubmoduleConfig) FullPath() string {
if r.ParentModule != nil {
return r.ParentModule.FullPath() + "/" + r.Path
}
return r.Path
}
func (r *SubmoduleConfig) RefName() string {
return r.FullName()
}
func (r *SubmoduleConfig) ID() string {
return r.RefName()
}
func (r *SubmoduleConfig) Description() string {
return r.RefName()
}
func (r *SubmoduleConfig) GitDirPath(repoGitDirPath string) string {
parentPath := repoGitDirPath
if r.ParentModule != nil {
parentPath = r.ParentModule.GitDirPath(repoGitDirPath)
}
return filepath.Join(parentPath, "modules", r.Name)
}
|