aboutsummaryrefslogtreecommitdiff
path: root/adapters.go
diff options
context:
space:
mode:
authorFlu0r1ne <flur01ne@flu0r1ne.net>2021-09-02 03:14:47 -0500
committerFlu0r1ne <flur01ne@flu0r1ne.net>2021-09-02 03:14:47 -0500
commitd078f6dc10eb265a5d88cd96adf86173d6d3ba2e (patch)
treeed8bc2405b60b2ae31405c3d8e27b24fda3ac003 /adapters.go
parent96701f87a114557f1a013229e889b4b726aa7dc1 (diff)
downloadplanr-d078f6dc10eb265a5d88cd96adf86173d6d3ba2e.tar.xz
planr-d078f6dc10eb265a5d88cd96adf86173d6d3ba2e.zip
Make adapters and internals complient with new directory structure
Diffstat (limited to 'adapters.go')
-rw-r--r--adapters.go24
1 files changed, 23 insertions, 1 deletions
diff --git a/adapters.go b/adapters.go
index 8419c8b..f4e53ce 100644
--- a/adapters.go
+++ b/adapters.go
@@ -1,16 +1,38 @@
package planr
+import (
+ "github.com/BurntSushi/toml"
+)
+
// Test adapters must implement all life cycle hooks
// This allows common config, code generation, etc
// Test cases matching adapter configurations will be
// fed into the adapter interface
type Adapter interface {
- //
Config() AdapterConfig
+ Init(dirs DirConfig)
+
// Called once to preform expensive code generation
Build(testCase []*TestCase)
// Called every time source changes
Evaluate(testCase []*TestCase)
}
+
+// A parser function takes a blob of TOML and decodes it into
+// configuration relevant to an adapter
+type TomlParser func (toml.Primitive) (InheritableConfig, error)
+
+// The name under which an adapter registers corresponds
+// to a table under the super-table adapters. All corresponding
+// TOML will be passed to the ParseConfig method or ParseDefaultConfig
+// for parsing. The ParseConfig file parses options in test case files.
+// The ParseDefaultConfig is parsed by `defaults.toml` files and can
+// be used to establish default configuration that will be inherited
+// by all units in a common directory (collection)
+type AdapterConfig struct {
+ Name string
+ ParseConfig TomlParser
+ ParseDefaultConfig TomlParser
+}