-
Notifications
You must be signed in to change notification settings - Fork 199
/
git_export_base.go
47 lines (38 loc) · 1012 Bytes
/
git_export_base.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
package config
import (
"path/filepath"
"strings"
)
type GitExportBase struct {
*GitExport
StageDependencies *StageDependencies
}
func (c *ExportBase) GitMappingAdd() string {
if c.Add == "/" {
return ""
}
return filepath.FromSlash(strings.TrimPrefix(c.Add, "/"))
}
func (c *ExportBase) GitMappingTo() string {
return c.To
}
func (c *ExportBase) GitMappingIncludePaths() []string {
return gitMappingPaths(c.IncludePaths)
}
func (c *ExportBase) GitMappingExcludePath() []string {
return gitMappingPaths(c.ExcludePaths)
}
func (c *GitExportBase) GitMappingStageDependencies() *StageDependencies {
s := &StageDependencies{}
s.Install = gitMappingPaths(c.StageDependencies.Install)
s.BeforeSetup = gitMappingPaths(c.StageDependencies.BeforeSetup)
s.Setup = gitMappingPaths(c.StageDependencies.Setup)
return s
}
func gitMappingPaths(paths []string) []string {
var newPaths []string
for _, path := range paths {
newPaths = append(newPaths, filepath.FromSlash(path))
}
return newPaths
}