summaryrefslogtreecommitdiff
path: root/runner_builder.go
blob: b3c07d93c62e2c8e06f40797a7179976c24472ab (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
package planr

type RunnerBuilder struct {
  adapters    map[string] Adapter
  dirs        DirConfig
}

func ConfigureRunner() RunnerBuilder {
  builder := RunnerBuilder{}
  builder.adapters = make(map[string] Adapter, 0)
  return builder
}

func RegisterAdapter(b RunnerBuilder, a Adapter) RunnerBuilder {
  nm := a.Config().Name
  b.adapters[nm] = a
  return b
}

func SetConfigDirFromTree(b RunnerBuilder, childPath string) RunnerBuilder {
  b.dirs.SetConfigFromTree(childPath)
  return b
}

func SetConfigDir(b RunnerBuilder, dir string) RunnerBuilder {
  b.dirs.SetConfig(dir)
  return b
}

func SetBuildDir(b RunnerBuilder, dir string) RunnerBuilder {
  b.dirs.SetBuild(dir)
  return b
}

func SetSrcDir(b RunnerBuilder, dir string) RunnerBuilder {
  b.dirs.SetSrc(dir)
  return b
}

func (b RunnerBuilder) New() Runner {
  return NewRunner(b.adapters, b.dirs)
}