-
Notifications
You must be signed in to change notification settings - Fork 56
/
builder.go
168 lines (143 loc) · 3.54 KB
/
builder.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
package spec
import "strconv"
type builder struct {
pattern string
// Deprecated, use Exclusions instead
excludePatterns []string
exclusions []string
target string
explode string
props string
excludeProps string
sortOrder string
sortBy []string
offset int
limit int
build string
excludeArtifacts bool
includeDeps bool
bundle string
recursive bool
flat bool
regexp bool
includeDirs bool
archiveEntries string
validateSymlinks bool
}
func NewBuilder() *builder {
return &builder{}
}
func (b *builder) Pattern(pattern string) *builder {
b.pattern = pattern
return b
}
func (b *builder) ArchiveEntries(archiveEntries string) *builder {
b.archiveEntries = archiveEntries
return b
}
func (b *builder) ExcludePatterns(excludePatterns []string) *builder {
b.excludePatterns = excludePatterns
return b
}
func (b *builder) Exclusions(exclusions []string) *builder {
b.exclusions = exclusions
return b
}
func (b *builder) Target(target string) *builder {
b.target = target
return b
}
func (b *builder) Explode(explode string) *builder {
b.explode = explode
return b
}
func (b *builder) Props(props string) *builder {
b.props = props
return b
}
func (b *builder) ExcludeProps(excludeProps string) *builder {
b.excludeProps = excludeProps
return b
}
func (b *builder) SortOrder(sortOrder string) *builder {
b.sortOrder = sortOrder
return b
}
func (b *builder) SortBy(sortBy []string) *builder {
b.sortBy = sortBy
return b
}
func (b *builder) Offset(offset int) *builder {
b.offset = offset
return b
}
func (b *builder) Limit(limit int) *builder {
b.limit = limit
return b
}
func (b *builder) Build(build string) *builder {
b.build = build
return b
}
func (b *builder) ExcludeArtifacts(excludeArtifacts bool) *builder {
b.excludeArtifacts = excludeArtifacts
return b
}
func (b *builder) IncludeDeps(includeDeps bool) *builder {
b.includeDeps = includeDeps
return b
}
func (b *builder) Bundle(bundle string) *builder {
b.bundle = bundle
return b
}
func (b *builder) Recursive(recursive bool) *builder {
b.recursive = recursive
return b
}
func (b *builder) Flat(flat bool) *builder {
b.flat = flat
return b
}
func (b *builder) Regexp(regexp bool) *builder {
b.regexp = regexp
return b
}
func (b *builder) IncludeDirs(includeDirs bool) *builder {
b.includeDirs = includeDirs
return b
}
func (b *builder) ValidateSymlinks(validateSymlinks bool) *builder {
b.validateSymlinks = validateSymlinks
return b
}
func (b *builder) BuildSpec() *SpecFiles {
return &SpecFiles{
Files: []File{
{
Pattern: b.pattern,
// Deprecated, use Exclusions instead
ExcludePatterns: b.excludePatterns,
Exclusions: b.exclusions,
Target: b.target,
Props: b.props,
ExcludeProps: b.excludeProps,
SortOrder: b.sortOrder,
SortBy: b.sortBy,
Offset: b.offset,
Limit: b.limit,
Build: b.build,
Bundle: b.bundle,
Explode: b.explode,
ArchiveEntries: b.archiveEntries,
Recursive: strconv.FormatBool(b.recursive),
Flat: strconv.FormatBool(b.flat),
Regexp: strconv.FormatBool(b.regexp),
IncludeDirs: strconv.FormatBool(b.includeDirs),
ValidateSymlinks: strconv.FormatBool(b.validateSymlinks),
ExcludeArtifacts: strconv.FormatBool(b.excludeArtifacts),
IncludeDeps: strconv.FormatBool(b.includeDeps),
},
},
}
}