diff options
Diffstat (limited to 'runner_builder.go')
-rw-r--r-- | runner_builder.go | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/runner_builder.go b/runner_builder.go new file mode 100644 index 0000000..848d09b --- /dev/null +++ b/runner_builder.go @@ -0,0 +1,42 @@ +package planr + +type RunnerBuilder struct { + adapters [] Adapter + dirs DirConfig +} + +func ConfigureRunner() RunnerBuilder { + return RunnerBuilder {} +} + +func RegisterAdapter(b RunnerBuilder, a Adapter) RunnerBuilder { + b.adapters = append(b.adapters, 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 Runner { + dirs: b.dirs, + adapters: b.adapters, + } +} |