parser

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2014 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandSequence

type CommandSequence struct {
	Commands []*SubSequence
}

A CommandSequence is an intermediate data type in the parsing process. Once a Builderfile is parsed into an InstructionSet, it is further parsed into a CommandSequence, which is essential an array of strings where each string is a command to be run.

type InstructionSet

type InstructionSet struct {
	DockerBuildOpts []string
	DockerTagOpts   []string
	Containers      map[string]builderfile.ContainerSection
}

An InstructionSet is an intermediate datatype - once a Builderfile is parsed and the TOML is validated, the parser parses the data into an InstructionSet. The primary purpose of this step is to merge any global container options into the sections for the individual containers.

type Parser

type Parser struct {
	*logrus.Logger
	// contains filtered or unexported fields
}

Parser is a struct that contains a Builderfile and knows how to parse it both as raw text and to convert toml to a Builderfile struct. It also knows how to tell if the Builderfile is valid (openable) or nat.

func NewParser

func NewParser(filename string, logger *logrus.Logger) (*Parser, error)

NewParser returns an initialized Parser. Not currently necessary, as no default values are assigned to a new Parser, but useful to have in case we need to change this.

func (*Parser) AssertLint

func (parser *Parser) AssertLint()

AssertLint is like Lint except that instead of returning an nil/error to indicate success/failure, it exits nonzero if linting fails.

func (*Parser) IsOpenable

func (parser *Parser) IsOpenable() bool

IsOpenable examines the Builderfile provided to the Parser and returns a bool indicating whether or not the file exists and openable.

func (*Parser) Lint

func (parser *Parser) Lint() error

Lint parses a builderfile and returns either nil if the file was parsed successfully or an error indicating that parsing failed and the file is invalid.

func (*Parser) NextUUID

func (parser *Parser) NextUUID() (string, error)

NextUUID returns the next UUID generated by the parser's uuid generator. This will either be a random uuid (normal behavior) or the same uuid every time if the generator is "seeded" (used for tests)

func (*Parser) Parse

func (parser *Parser) Parse() (*CommandSequence, error)

Parse further parses the Builderfile struct into an InstructionSet struct, merging the global container options into the individual container sections.

func (*Parser) RandomizeUUIDGenerator

func (parser *Parser) RandomizeUUIDGenerator()

RandomizeUUIDGenerator turns this parser's uuidGenerator into a random generator. All calls to NextUUID() will produce a random uuid after this function is called and until SeedUUIDGenerator() is called.

func (*Parser) SeedUUIDGenerator

func (parser *Parser) SeedUUIDGenerator()

SeedUUIDGenerator turns this parser's uuidGenerator into a seeded generator. All calls to NextUUID() will produce the same uuid after this function is called and until RandomizeUUIDGenerator() is called.

type SubSequence

type SubSequence struct {
	Metadata   *SubSequenceMetadata
	SubCommand []exec.Cmd
}

A SubSequence is a logical grouping of commands such as a sequence of build, tag, and push commands. In addition, the subsequence metadata contains any important metadata about the container build such as the name of the Dockerfile and which files/dirs to exclude.

type SubSequenceMetadata

type SubSequenceMetadata struct {
	Name       string
	Dockerfile string
	Included   []string
	Excluded   []string
	UUID       string
	SkipPush   bool
}

SubSequenceMetadata contains any important metadata about the container build such as the name of the Dockerfile and which files/dirs to exclude.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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