aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcolincross <github@colincross.com>2019-03-03 17:06:47 -0800
committerGitHub <noreply@github.com>2019-03-03 17:06:47 -0800
commit17a0b9644053af3d227672901d662daf8b9f005c (patch)
tree315b79b737723bacc4654343b1dc8cfe3147cf0b
parentbf8c1d31d9cb9ade9efa50ccbe6ae5bb7c1eb343 (diff)
parentd28b304d30eb34a1167c92edcccfb913763dfde9 (diff)
downloadblueprint-17a0b9644053af3d227672901d662daf8b9f005c.tar.gz
Merge pull request #240 from colincross/other_module
Add more OtherModule* methods
-rw-r--r--module_ctx.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/module_ctx.go b/module_ctx.go
index 9dbf43d..d127c0e 100644
--- a/module_ctx.go
+++ b/module_ctx.go
@@ -123,6 +123,7 @@ type DynamicDependerModule interface {
type BaseModuleContext interface {
ModuleName() string
ModuleDir() string
+ ModuleType() string
Config() interface{}
ContainsProperty(name string) bool
@@ -154,6 +155,9 @@ type ModuleContext interface {
BaseModuleContext
OtherModuleName(m Module) string
+ OtherModuleDir(m Module) string
+ OtherModuleSubDir(m Module) string
+ OtherModuleType(m Module) string
OtherModuleErrorf(m Module, fmt string, args ...interface{})
OtherModuleDependencyTag(m Module) DependencyTag
@@ -199,6 +203,10 @@ func (d *baseModuleContext) ModuleName() string {
return d.module.Name()
}
+func (d *baseModuleContext) ModuleType() string {
+ return d.module.typeName
+}
+
func (d *baseModuleContext) ContainsProperty(name string) bool {
_, ok := d.module.propertyPos[name]
return ok
@@ -291,6 +299,21 @@ func (m *baseModuleContext) OtherModuleName(logicModule Module) string {
return module.Name()
}
+func (m *baseModuleContext) OtherModuleDir(logicModule Module) string {
+ module := m.context.moduleInfo[logicModule]
+ return filepath.Dir(module.relBlueprintsFile)
+}
+
+func (m *baseModuleContext) OtherModuleSubDir(logicModule Module) string {
+ module := m.context.moduleInfo[logicModule]
+ return module.variantName
+}
+
+func (m *baseModuleContext) OtherModuleType(logicModule Module) string {
+ module := m.context.moduleInfo[logicModule]
+ return module.typeName
+}
+
func (m *baseModuleContext) OtherModuleErrorf(logicModule Module, format string,
args ...interface{}) {
@@ -559,6 +582,9 @@ type TopDownMutatorContext interface {
baseMutatorContext
OtherModuleName(m Module) string
+ OtherModuleDir(m Module) string
+ OtherModuleSubDir(m Module) string
+ OtherModuleType(m Module) string
OtherModuleErrorf(m Module, fmt string, args ...interface{})
OtherModuleDependencyTag(m Module) DependencyTag