-
Notifications
You must be signed in to change notification settings - Fork 31
/
path.go
80 lines (62 loc) · 1.54 KB
/
path.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
package tachyon
import (
"path/filepath"
)
type Paths interface {
Base() string
Role(name string) string
Vars(name string) string
Task(name string) string
Handler(name string) string
File(name string) string
Meta(name string) string
}
type SimplePath struct {
Root string
}
func (s SimplePath) Base() string {
return s.Root
}
func (s SimplePath) Role(name string) string {
return filepath.Join(s.Root, "roles", name)
}
func (s SimplePath) Vars(name string) string {
return filepath.Join(s.Root, name)
}
func (s SimplePath) Task(name string) string {
return filepath.Join(s.Root, name)
}
func (s SimplePath) Handler(name string) string {
return filepath.Join(s.Root, name)
}
func (s SimplePath) File(name string) string {
return filepath.Join(s.Root, name)
}
func (s SimplePath) Meta(name string) string {
return filepath.Join(s.Root, name)
}
type SeparatePaths struct {
Top string
Root string
}
func (s SeparatePaths) Base() string {
return s.Root
}
func (s SeparatePaths) Role(name string) string {
return filepath.Join(s.Top, "roles", name)
}
func (s SeparatePaths) Vars(name string) string {
return filepath.Join(s.Root, "vars", name)
}
func (s SeparatePaths) Task(name string) string {
return filepath.Join(s.Root, "tasks", name)
}
func (s SeparatePaths) Handler(name string) string {
return filepath.Join(s.Root, "handlers", name)
}
func (s SeparatePaths) File(name string) string {
return filepath.Join(s.Root, "files", name)
}
func (s SeparatePaths) Meta(name string) string {
return filepath.Join(s.Root, "meta", name)
}