forked from herrjulz/aviator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.go
120 lines (102 loc) · 2.84 KB
/
models.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
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
package aviator
import "os"
type AviatorYaml struct {
Spruce []Spruce `yaml:"spruce"`
Fly Fly `yaml:"fly"`
}
type Spruce struct {
Base string `yaml:"base"`
Merge []Merge `yaml:"merge"`
ForEach ForEach `yaml:"for_each"`
Prune []string `yaml:"prune"`
CherryPicks []string `yaml:"cherry_pick"`
SkipEval bool `yaml:"skip_eval"`
To string `yaml:"to"`
ToDir string `yaml:"to_dir"`
Modify Modify `yaml:"modify"`
}
type Merge struct {
With With `yaml:"with"`
WithIn string `yaml:"with_in"`
WithAllIn string `yaml:"with_all_in"`
Except []string `yaml:"except"`
Regexp string `yaml:"regexp"`
}
type With struct {
Files []string `yaml:"files"`
InDir string `yaml:"in_dir"`
Skip bool `yaml:"skip_non_existing"`
}
type ForEach struct {
Files []string `yaml:"files"`
InDir string `yaml:"in_dir"`
Skip bool `yaml:"skip_non_existing"`
In string `yaml:"in"`
Except []string `yaml:"except"`
SubDirs bool `yaml:"include_sub_dirs"`
EnableMatching bool `yaml:"enable_matching"`
CopyParents bool `yaml:"copy_parents"`
ForAll string `yaml:"for_all"`
Regexp string `yaml:"regexp"`
}
type Fly struct {
Name string `yaml:"name"`
Target string `yaml:"target"`
Config string `yaml:"config"`
Vars []string `yaml:"vars"`
Expose bool `yaml:"expose"`
}
type MergeConf struct {
Files []string
Prune []string
CherryPicks []string
SkipEval bool
FallbackAppend bool
}
type Modify struct {
Delete []string `yaml:"delete"`
Set []PathVal `yaml:"set"`
Update []PathVal `yaml:"update"`
}
type PathVal struct {
Path string `yaml:"path"`
Value string `yaml:"value"`
}
//go:generate counterfeiter . SpruceProcessor
type SpruceProcessor interface {
Process([]Spruce) error
ProcessWithOpts([]Spruce, bool, bool) error
}
//go:generate counterfeiter . FlyExecuter
type FlyExecuter interface {
Execute(Fly) error
}
//go:generate counterfeiter . SpruceClient
type SpruceClient interface {
MergeWithOpts(MergeConf) ([]byte, error)
}
//go:generate counterfeiter . FileStore
type FileStore interface {
ReadFile(string) ([]byte, bool)
WriteFile(string, []byte) error
ReadDir(string) ([]os.FileInfo, error)
Walk(string) ([]string, error)
}
//go:generate counterfeiter . Validator
type Validator interface {
ValidateSpruce([]Spruce) error
}
//go:generate counterfeiter . Executor
type Executor interface {
Execute(interface{}) error
}
//go:generate counterfeiter . Modifier
type Modifier interface {
Modify([]byte, Modify) ([]byte, error)
}
//go:generate counterfeiter . GomlClient
type GomlClient interface {
Delete([]byte, string) ([]byte, error)
Set([]byte, string, string) ([]byte, error)
Update([]byte, string, string) ([]byte, error)
}