generators

package
v0.0.0-...-521d647 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2017 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SkipAll skipAllErr = skipAllErr("skipped")

SkipAll indicates that all generators should skip this directory and subdirectories.

Functions

This section is empty.

Types

type DockerGenerator

type DockerGenerator struct {
	// contains filtered or unexported fields
}

DockerGenerator generates services from Docker files. Services are generated from a Dockerfile.

The container is build with a tag based on the directory name suffixed with ':nedward'. For a Dockerfile under 'service', the tag would be 'service:nedward'.

Ports identified with EXPOSE in the Dockerfile will be forwarded from the container, with the local port matching the port in the container.

func (*DockerGenerator) Err

func (b *DockerGenerator) Err() error

Err returns the most recent error from this generator

func (*DockerGenerator) Name

func (v *DockerGenerator) Name() string

Name returns 'docker' to identify this generator

func (*DockerGenerator) Services

func (v *DockerGenerator) Services() []*services.ServiceConfig

Services returns a slice of services identified in the directory walk

func (*DockerGenerator) SetErr

func (b *DockerGenerator) SetErr(err error)

SetErr allows an error to be applied to this generator from outside

func (*DockerGenerator) StartWalk

func (b *DockerGenerator) StartWalk(basePath string)

StartWalk lets a generator know that a directory walk has been started, with the given starting path

func (*DockerGenerator) StopWalk

func (b *DockerGenerator) StopWalk()

StopWalk lets a generator know that a directory walk has been completed, so it can perform any necessary cleanup or consolidation.

func (*DockerGenerator) VisitDir

func (v *DockerGenerator) VisitDir(path string) (bool, error)

VisitDir searches a directory for a Dockerfile and stores a service configuration if one is found. Returns true in the first return value if a service was found.

type Generator

type Generator interface {
	Name() string
	StartWalk(basePath string)
	StopWalk()
	VisitDir(path string) (bool, error)
	Err() error
	SetErr(err error)
}

Generator provides an interface to identify a generator and perform a directory walk to find projects for configuration.

type GeneratorCollection

type GeneratorCollection struct {
	Generators []Generator
	Path       string
	Targets    []string
}

GeneratorCollection provides the ability to execute multiple generators under the same path.

func (*GeneratorCollection) Generate

func (g *GeneratorCollection) Generate() error

Generate walks over the directories under the GeneratorCollection's Path and runs each generator on each directory in turn. If a generator finds a match, no other generators may run in that directory and subdirectories.

func (*GeneratorCollection) Groups

Groups returns any groups found during the Generate

func (*GeneratorCollection) Imports

func (g *GeneratorCollection) Imports() []string

Imports returns any imports found during the Generate

func (*GeneratorCollection) Services

func (g *GeneratorCollection) Services() []*services.ServiceConfig

Services returns any services found during the Generate

type GoGenerator

type GoGenerator struct {
	// contains filtered or unexported fields
}

GoGenerator generates go services from main packages

func (*GoGenerator) Err

func (b *GoGenerator) Err() error

Err returns the most recent error from this generator

func (*GoGenerator) Name

func (v *GoGenerator) Name() string

Name returns 'go' to identify this generator

func (*GoGenerator) Services

func (v *GoGenerator) Services() []*services.ServiceConfig

Services returns the services generated during the last walk

func (*GoGenerator) SetErr

func (b *GoGenerator) SetErr(err error)

SetErr allows an error to be applied to this generator from outside

func (*GoGenerator) StartWalk

func (v *GoGenerator) StartWalk(path string)

StartWalk lets a generator know that a directory walk has been started, with the given starting path

func (*GoGenerator) StopWalk

func (b *GoGenerator) StopWalk()

StopWalk lets a generator know that a directory walk has been completed, so it can perform any necessary cleanup or consolidation.

func (*GoGenerator) VisitDir

func (v *GoGenerator) VisitDir(path string) (bool, error)

VisitDir searches a directory for .go files, and will store a service if a main package is detected. Returns true in the first return value if a service was found.

type GroupGenerator

type GroupGenerator interface {
	Groups() []*services.ServiceGroupConfig
}

GroupGenerator provides an interface to return a slice of groups after performing a directory walk.

type IcbmGenerator

type IcbmGenerator struct {
	// contains filtered or unexported fields
}

IcbmGenerator generates services from an icbm build.spec file

func (*IcbmGenerator) Err

func (b *IcbmGenerator) Err() error

Err returns the most recent error from this generator

func (*IcbmGenerator) Name

func (v *IcbmGenerator) Name() string

Name returns 'icbm' to identify this generator

func (*IcbmGenerator) Services

func (v *IcbmGenerator) Services() []*services.ServiceConfig

Services returns a slice of all the services generated during this walk

func (*IcbmGenerator) SetErr

func (b *IcbmGenerator) SetErr(err error)

SetErr allows an error to be applied to this generator from outside

func (*IcbmGenerator) StartWalk

func (b *IcbmGenerator) StartWalk(basePath string)

StartWalk lets a generator know that a directory walk has been started, with the given starting path

func (*IcbmGenerator) StopWalk

func (b *IcbmGenerator) StopWalk()

StopWalk lets a generator know that a directory walk has been completed, so it can perform any necessary cleanup or consolidation.

func (*IcbmGenerator) VisitDir

func (v *IcbmGenerator) VisitDir(path string) (bool, error)

VisitDir checks a directory for a build.spec file. If found, it will parse the file to obtain service definitions. Once a spec file has been parsed, true, filepath.SkipDir will be returned to ensure no further directories below this are parsed.

type ImportGenerator

type ImportGenerator interface {
	Imports() []string
}

ImportGenerator provides an interface to return a slice of Nedward config file paths to be imported after a directory walk.

type NedwardGenerator

type NedwardGenerator struct {
	// contains filtered or unexported fields
}

NedwardGenerator generates imports for all Nedward config files in the directory hierarchy.

func (*NedwardGenerator) Err

func (b *NedwardGenerator) Err() error

Err returns the most recent error from this generator

func (*NedwardGenerator) Imports

func (v *NedwardGenerator) Imports() []string

Imports returns all imports found during previous walks.

func (*NedwardGenerator) Name

func (v *NedwardGenerator) Name() string

Name returns 'nedward' to identify this generator.

func (*NedwardGenerator) SetErr

func (b *NedwardGenerator) SetErr(err error)

SetErr allows an error to be applied to this generator from outside

func (*NedwardGenerator) StartWalk

func (b *NedwardGenerator) StartWalk(basePath string)

StartWalk lets a generator know that a directory walk has been started, with the given starting path

func (*NedwardGenerator) StopWalk

func (b *NedwardGenerator) StopWalk()

StopWalk lets a generator know that a directory walk has been completed, so it can perform any necessary cleanup or consolidation.

func (*NedwardGenerator) VisitDir

func (v *NedwardGenerator) VisitDir(path string) (bool, error)

VisitDir searches a directory for nedward.json files, and will store an import for any found. Returns true in the first return value if an import was found.

type ProcfileGenerator

type ProcfileGenerator struct {
	// contains filtered or unexported fields
}

ProcfileGenerator generates services and groups from Procfiles.

For each Procfile, a group is generated to contain a set of services, one per process in the Procfile.

The group is named for the directory containing the Procfile, services are named using the form '[group]:[process]'.

func (*ProcfileGenerator) Err

func (b *ProcfileGenerator) Err() error

Err returns the most recent error from this generator

func (*ProcfileGenerator) Groups

Groups returns a slice of groups generated on previous walks

func (*ProcfileGenerator) Name

func (v *ProcfileGenerator) Name() string

Name returns 'procfile' to identify this generator

func (*ProcfileGenerator) Services

func (v *ProcfileGenerator) Services() []*services.ServiceConfig

Services returns a slice of services generated on previous walks

func (*ProcfileGenerator) SetErr

func (b *ProcfileGenerator) SetErr(err error)

SetErr allows an error to be applied to this generator from outside

func (*ProcfileGenerator) StartWalk

func (b *ProcfileGenerator) StartWalk(basePath string)

StartWalk lets a generator know that a directory walk has been started, with the given starting path

func (*ProcfileGenerator) StopWalk

func (b *ProcfileGenerator) StopWalk()

StopWalk lets a generator know that a directory walk has been completed, so it can perform any necessary cleanup or consolidation.

func (*ProcfileGenerator) VisitDir

func (v *ProcfileGenerator) VisitDir(path string) (bool, error)

VisitDir searches a directory for a Procfile, generating services and groups for any found. Returns true in the first return value if a Procfile was found.

type ServiceGenerator

type ServiceGenerator interface {
	Services() []*services.ServiceConfig
}

ServiceGenerator provides an interface to return a slice of services after performing a directory walk.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL